1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for BUG#25843: changing default database between PREPARE and EXECUTE

of statement breaks binlog.

There were two problems discovered by this bug:

  1. Default (current) database is not fixed at the creation time.
     That leads to wrong output of DATABASE() function.

  2. Database attributes (@@collation_database) are not fixed at
     the creation time. That leads to wrong resultset.

Binlog breakage and Query Cache wrong output happened because of
the first problem.

The fix is to remember the current database at the PREPARE-time and
set it each time at EXECUTE.
This commit is contained in:
anozdrin/alik@ibm.opbmk
2007-08-31 20:42:14 +04:00
parent f141ba5e26
commit d6f94b062c
13 changed files with 891 additions and 153 deletions

View File

@ -937,9 +937,16 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
char *new_table_name, char *new_table_alias,
bool skip_error);
bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
bool force_switch);
bool mysql_opt_change_db(THD *thd,
const LEX_STRING *new_db_name,
LEX_STRING *saved_db_name,
bool force_switch,
bool *cur_db_changed);
void mysql_parse(THD *thd, const char *inBuf, uint length,
const char ** semicolon);