diff options
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 61d8f12deaa..ddc5234fa01 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* create and drop of databases */ @@ -1441,12 +1441,12 @@ static void backup_current_db_name(THD *thd, a stack pointer set by Stored Procedures was used by replication after the stack address was long gone. - @return Operation status - @retval FALSE Success - @retval TRUE Error + @return error code (ER_XXX) + @retval 0 Success + @retval >0 Error */ -bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, +uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, bool force_switch) { LEX_CSTRING new_db_file_name; @@ -1477,7 +1477,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, { my_message(ER_NO_DB_ERROR, ER_THD(thd, ER_NO_DB_ERROR), MYF(0)); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_NO_DB_ERROR); } } DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); @@ -1503,7 +1503,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, new_db_file_name.length= new_db_name->length; if (new_db_file_name.str == NULL) - DBUG_RETURN(TRUE); /* the error is set */ + DBUG_RETURN(ER_OUT_OF_RESOURCES); /* the error is set */ /* NOTE: if check_db_name() fails, we should throw an error in any case, @@ -1523,7 +1523,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, if (force_switch) mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_WRONG_DB_NAME); } DBUG_PRINT("info",("Use database: %s", new_db_file_name.str)); @@ -1553,7 +1553,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, general_log_print(thd, COM_INIT_DB, ER_THD(thd, ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); my_free(const_cast<char*>(new_db_file_name.str)); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_DBACCESS_DENIED_ERROR); } #endif @@ -1587,7 +1587,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, /* The operation failed. */ - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_BAD_DB_ERROR); } } @@ -1603,7 +1603,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, done: SESSION_TRACKER_CHANGED(thd, CURRENT_SCHEMA_TRACKER, NULL); SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL); - DBUG_RETURN(FALSE); + DBUG_RETURN(0); } @@ -1851,7 +1851,7 @@ bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db) /* Step9: Let's do "use newdb" if we renamed the current database */ if (change_to_newdb) - error|= mysql_change_db(thd, & new_db, FALSE); + error|= mysql_change_db(thd, & new_db, FALSE) != 0; exit: DBUG_RETURN(error); |