summaryrefslogtreecommitdiff
path: root/sql/sql_handler.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-01-13 12:31:25 +0100
committerunknown <serg@serg.mylan>2004-01-13 12:31:25 +0100
commitfebc79bb5d8a7cfe1f8e5eef50595f321786c467 (patch)
tree66fde442464b3be35a42583932a1fda9901670c7 /sql/sql_handler.cc
parentf61cec71d19659759b44f42f1deccbe64a25bdbb (diff)
downloadmariadb-git-febc79bb5d8a7cfe1f8e5eef50595f321786c467.tar.gz
BUG#2304 - HANDLER and tables in non-current db
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 208545a435b..963111015da 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -276,14 +276,13 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
int dblen;
TABLE **ptr;
- if (!db || ! *db)
- db= thd->db ? thd->db : "";
- dblen=strlen(db)+1;
+ DBUG_ASSERT(db);
+ dblen=*db ? strlen(db)+1 : 0;
ptr=&(thd->handler_tables);
for (TABLE *table=*ptr; table ; table=*ptr)
{
- if (!memcmp(table->table_cache_key, db, dblen) &&
+ if ((!dblen || !memcmp(table->table_cache_key, db, dblen)) &&
!my_strcasecmp((is_alias ? table->table_name : table->real_name),table_name))
{
if (table->version != refresh_version)