From 742606bafd847fac184f9d335604bfc79cbdff88 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 May 2004 18:45:59 +0200 Subject: current_thd is 0 if ha_resolve_by_name() is called when parsing command-line options --- sql/handler.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index f8eca1b93ef..9acd55db0b1 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -103,15 +103,16 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", enum db_type ha_resolve_by_name(const char *name, uint namelen) { - if (!my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) { - return(enum db_type) current_thd->variables.table_type; + THD *thd=current_thd; + if (thd && !my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) { + return (enum db_type) thd->variables.table_type; } show_table_type_st *types; for (types= sys_table_types; types->type; types++) { if (!my_strcasecmp(&my_charset_latin1, name, types->type)) - return(enum db_type)types->db_type; + return (enum db_type) types->db_type; } return DB_TYPE_UNKNOWN; } -- cgit v1.2.1 From 0e86cf8aba3c7d067dd28efd78f138d467ec7e7b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 May 2004 23:41:58 +0400 Subject: Fix for bug which caused grant.test fail on darwin7.3. We were converting db and table names to lower case using latin1 instead of utf-8 in sql_acl.cc if lower_case_table_names was on. Also replaced in other such places system_charset_info with files_charset_info for consistency. sql/handler.cc: Replaced system_charset_info with files_charset_info in places where we are converting names to lower case because of lower_case_table_names for consistency. sql/sql_acl.cc: We should use files_charset_info when converting db/table names to lower case because they could be in utf-8 and not in latin1! sql/sql_cache.cc: Added clarifying comments in tricky place after discussion with Sanja. Replaced system_charset_info with files_charset_info in places where we are converting names to lower case because of lower_case_table_names for consistency. sql/sql_db.cc: Replaced system_charset_info with files_charset_info in places where we are converting names to lower case because of lower_case_table_names for consistency. sql/sql_show.cc: Replaced system_charset_info with files_charset_info in places where we are converting names to lower case because of lower_case_table_names for consistency. sql/sql_table.cc: Replaced system_charset_info with files_charset_info in places where we are converting names to lower case because of lower_case_table_names for consistency. --- sql/handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 9acd55db0b1..bc86241bd00 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -743,7 +743,7 @@ int ha_delete_table(enum db_type table_type, const char *path) { /* Ensure that table handler get path in lower case */ strmov(tmp_path, path); - my_casedn_str(system_charset_info, tmp_path); + my_casedn_str(files_charset_info, tmp_path); path= tmp_path; } int error=file->delete_table(path); @@ -1247,7 +1247,7 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, { /* Ensure that handler gets name in lower case */ strmov(name_buff, name); - my_casedn_str(system_charset_info, name_buff); + my_casedn_str(files_charset_info, name_buff); name= name_buff; } -- cgit v1.2.1