Commit 7961968a authored by serg@serg.mylan's avatar serg@serg.mylan

current_thd is 0 if ha_resolve_by_name() is called when parsing command-line options

parent e58b9c62
...@@ -103,15 +103,16 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", ...@@ -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) enum db_type ha_resolve_by_name(const char *name, uint namelen)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) { THD *thd=current_thd;
return(enum db_type) current_thd->variables.table_type; if (thd && !my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) {
return (enum db_type) thd->variables.table_type;
} }
show_table_type_st *types; show_table_type_st *types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, types->type)) 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; return DB_TYPE_UNKNOWN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment