summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-05-17 18:45:59 +0200
committerunknown <serg@serg.mylan>2004-05-17 18:45:59 +0200
commit742606bafd847fac184f9d335604bfc79cbdff88 (patch)
tree48cd5368ed9369fdad3af04d515077523943c92b /sql
parent93168d599dfd311f27e508338443a10ece38e16a (diff)
downloadmariadb-git-742606bafd847fac184f9d335604bfc79cbdff88.tar.gz
current_thd is 0 if ha_resolve_by_name() is called when parsing command-line options
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc7
1 files changed, 4 insertions, 3 deletions
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;
}