diff options
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 39c33da23ef..460b41349b3 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1524,13 +1524,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)); } @@ -1603,12 +1599,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) { @@ -1617,8 +1610,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. */ @@ -1633,6 +1625,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_schema_db(new_db_name->str, new_db_name->length)) { |