MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_default_db_collation

Function get_default_db_collation

sql/sql_db.cc:415–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413*/
414
415const 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}

Callers

nothing calls this directly

Calls 1

load_db_opt_by_nameFunction · 0.85

Tested by

no test coverage detected