| 413 | */ |
| 414 | |
| 415 | const CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name) |
| 416 | { |
| 417 | HA_CREATE_INFO db_info; |
| 418 | |
| 419 | if (thd->db != NULL && strcmp(db_name, thd->db) == 0) |
| 420 | return thd->db_charset; |
| 421 | |
| 422 | load_db_opt_by_name(thd, db_name, &db_info); |
| 423 | |
| 424 | /* |
| 425 | NOTE: even if load_db_opt_by_name() fails, |
| 426 | db_info.default_table_charset contains valid character set |
| 427 | (collation_server). We should not fail if load_db_opt_by_name() fails, |
| 428 | because it is valid case. If a database has been created just by |
| 429 | "mkdir", it does not contain db.opt file, but it is valid database. |
| 430 | */ |
| 431 | |
| 432 | return db_info.default_table_charset; |
| 433 | } |
nothing calls this directly
no test coverage detected