diff options
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5325758fd12..43c80e907e1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2896,13 +2896,17 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, static void set_table_default_charset(THD *thd, HA_CREATE_INFO *create_info, char *db) { + /* + If the table character set was not given explicitly, + let's fetch the database default character set and + apply it to the table. + */ if (!create_info->default_table_charset) { HA_CREATE_INFO db_info; - char path[FN_REFLEN]; - /* Abuse build_table_filename() to build the path to the db.opt file */ - build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE); - load_db_opt(thd, path, &db_info); + + load_db_opt_by_name(thd, db, &db_info); + create_info->default_table_charset= db_info.default_table_charset; } } |