diff options
author | unknown <malff/marcsql@weblab.(none)> | 2007-08-30 13:23:59 -0600 |
---|---|---|
committer | unknown <malff/marcsql@weblab.(none)> | 2007-08-30 13:23:59 -0600 |
commit | 89d3d585112fd71d62bcac511dab6530b6df793e (patch) | |
tree | 8a9eb637bc86a49e83f7ac315d1483f381fea0a2 /sql/sp.cc | |
parent | 674f49f8f415c35b37660d85234e268bd3bd03ef (diff) | |
parent | 88cf551a16af65e6b5e1396a31447e9b38cd5519 (diff) | |
download | mariadb-git-89d3d585112fd71d62bcac511dab6530b6df793e.tar.gz |
Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt50-merge
client/mysql.cc:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 437ffb3b484..4828618c0cb 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -575,7 +575,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, we'll update it later in switch_query_ctx(). */ - if ((ret= sp_use_new_db(thd, name->m_db, &old_db, 1, &dbchanged))) + if ((ret= sp_use_new_db(thd, name->m_db, &old_db, TRUE, &dbchanged))) goto end; thd->spcont= NULL; @@ -2028,34 +2028,41 @@ create_string(THD *thd, String *buf, -/* +/** Change the current database if needed. - SYNOPSIS - sp_use_new_db() - thd thread handle - new_db new database name (a string and its length) - old_db [IN] str points to a buffer where to store the old - database, length contains the size of the buffer - [OUT] if old db was not NULL, its name is copied - to the buffer pointed at by str and length is updated - accordingly. Otherwise str[0] is set to '\0' and length - is set to 0. The out parameter should be used only if - the database name has been changed (see dbchangedp). - dbchangedp [OUT] is set to TRUE if the current database is changed, - FALSE otherwise. A database is not changed if the old - name is the same as the new one, both names are empty, - or an error has occurred. - - RETURN VALUE - 0 success - 1 access denied or out of memory (the error message is - set in THD) + @param[in] thd thread handle + @param[in] new_db new database name + @param[in, out] old_db IN: str points to a buffer where to store + the old database, length contains the + size of the buffer + OUT: if old db was not NULL, its name is + copied to the buffer pointed at by str + and length is updated accordingly. + Otherwise str[0] is set to '\0' and + length is set to 0. The out parameter + should be used only if the database name + has been changed (see dbchangedp). + @param[in] force_switch Flag to mysql_change_db(). For more information, + see mysql_change_db() comment. + @param[out] dbchangedp is set to TRUE if the current database is + changed, FALSE otherwise. The current + database is not changed if the old name + is equal to the new one, both names are + empty, or an error has occurred. + + @return Operation status. + @retval 0 on success + @retval 1 access denied or out of memory + (the error message is set in THD) */ int -sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, - bool no_access_check, bool *dbchangedp) +sp_use_new_db(THD *thd, + LEX_STRING new_db, + LEX_STRING *old_db, + bool force_switch, + bool *dbchangedp) { int ret; DBUG_ENTER("sp_use_new_db"); @@ -2086,7 +2093,7 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, DBUG_RETURN(0); } - ret= mysql_change_db(thd, &new_db, no_access_check); + ret= mysql_change_db(thd, &new_db, force_switch); *dbchangedp= ret == 0; DBUG_RETURN(ret); |