summaryrefslogtreecommitdiff
path: root/sql/sp.h
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@ibm.opbmk>2007-08-31 20:42:14 +0400
committerunknown <anozdrin/alik@ibm.opbmk>2007-08-31 20:42:14 +0400
commit7e0ad09edff587dadc3e9855fc81e1b7de8f2199 (patch)
tree38c6a445d870a736939fb8fa36bb8dc40fb08e20 /sql/sp.h
parent3edb630197ae42353905325e9d1c8e78d329c23a (diff)
downloadmariadb-git-7e0ad09edff587dadc3e9855fc81e1b7de8f2199.tar.gz
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. mysql-test/include/query_cache_sql_prepare.inc: The first part of the test case for BUG#25843. mysql-test/r/query_cache_ps_no_prot.result: Update result file. mysql-test/r/query_cache_ps_ps_prot.result: Update result file. mysql-test/suite/rpl/r/rpl_ps.result: Update result file. mysql-test/suite/rpl/t/rpl_ps.test: The second part of the test case for BUG#25843. sql/mysql_priv.h: Added mysql_opt_change_db() prototype. sql/sp.cc: 1. Polishing; 2. sp_use_new_db() has been removed; 3. Use mysql_opt_change_db() instead of sp_use_new_db(). sql/sp.h: sp_use_new_db() has been removed. This function has nothing to do with a) sp and b) *new* database. It was merely "switch the current database if needed". sql/sp_head.cc: 1. Polishing. 2. Use mysql_opt_change_db() instead of sp_use_new_db(). sql/sql_class.cc: Move THD::{db, db_length} into Statement. sql/sql_class.h: Move THD::{db, db_length} into Statement. sql/sql_db.cc: Introduce mysql_opt_change_db() as a replacement (and inspired by) sp_use_new_db(). sql/sql_prepare.cc: 1. Remember the current database in Prepared_statement::prepare(). 2. Switch/restore the current database in Prepared_statement::execute().
Diffstat (limited to 'sql/sp.h')
-rw-r--r--sql/sp.h11
1 files changed, 0 insertions, 11 deletions
diff --git a/sql/sp.h b/sql/sp.h
index 52b0344a2e2..3797eb289a4 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -85,15 +85,4 @@ extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
*/
TABLE *open_proc_table_for_read(THD *thd, Open_tables_state *backup);
-
-/*
- Do a "use new_db". The current db is stored at old_db. If new_db is the
- same as the current one, nothing is changed. dbchangedp is set to true if
- the db was actually changed.
-*/
-
-int
-sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db,
- bool no_access_check, bool *dbchangedp);
-
#endif /* _SP_H_ */