diff options
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 517cb9139e9..8b92259573e 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1357,13 +1357,9 @@ static inline bool cmp_db_names(const char *db1_name, const char *db2_name) { - return - /* db1 is NULL and db2 is NULL */ - (!db1_name && !db2_name) || - - /* db1 is not-NULL, db2 is not-NULL, db1 == db2. */ - (db1_name && db2_name && - my_strcasecmp(system_charset_info, db1_name, db2_name) == 0); + return ((!db1_name && !db2_name) || + (db1_name && db2_name && + my_strcasecmp(system_charset_info, db1_name, db2_name) == 0)); } @@ -1436,12 +1432,9 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) Security_context *sctx= thd->security_ctx; ulong db_access= sctx->db_access; CHARSET_INFO *db_default_cl; - DBUG_ENTER("mysql_change_db"); - DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); - if (new_db_name == NULL || - new_db_name->length == 0) + if (new_db_name->length == 0) { if (force_switch) { @@ -1450,8 +1443,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) after loading stored program. The thing is that loading of stored program can happen when there is no current database. - TODO: actually, new_db_name and new_db_name->str seem to be always - non-NULL. In case of stored program, new_db_name->str == "" and + In case of stored program, new_db_name->str == "" and new_db_name->length == 0. */ @@ -1466,6 +1458,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) DBUG_RETURN(TRUE); } } + DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); if (is_infoschema_db(new_db_name->str, new_db_name->length)) { |