diff options
Diffstat (limited to 'mysql-test/include/query_cache_sql_prepare.inc')
-rw-r--r-- | mysql-test/include/query_cache_sql_prepare.inc | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/mysql-test/include/query_cache_sql_prepare.inc b/mysql-test/include/query_cache_sql_prepare.inc index 1842d5412bb..769cd535f37 100644 --- a/mysql-test/include/query_cache_sql_prepare.inc +++ b/mysql-test/include/query_cache_sql_prepare.inc @@ -1,11 +1,13 @@ ############### include/query_cache_sql_prepare.inc ################ # # This is to see how statements prepared via the PREPARE SQL command -# go into the query cache: if using parameters they cannot; if not -# using parameters they can. +# go into the query cache. # Query cache is abbreviated as "QC" # # Last update: +# 2008-05-26 Kostja +# - Add test coverage for automatic statement reprepare +# # 2007-05-03 ML - Move t/query_cache_sql_prepare.test # to include/query_cache_sql_prepare.inc # - Create two toplevel tests sourcing this routine @@ -25,7 +27,7 @@ connect (con1,localhost,root,,test,$MASTER_MYPORT,); connection default; set @initial_query_cache_size = @@global.query_cache_size; -set @@global.query_cache_size=100000; +set @@global.query_cache_size=102400; flush status; --disable_warnings drop table if exists t1; @@ -176,7 +178,7 @@ show status like 'Qcache_hits'; # then QC is re-enabled for more EXECUTE. --echo ---- switch to connection default ---- connection default; -set global query_cache_size=100000; +set global query_cache_size=102400; # Expect to see additional Qcache_hits. # The fact that the QC was temporary disabled should have no affect # except that the first execute will not hit results from the @@ -233,7 +235,7 @@ prepare stmt3 from "select * from t1 where c1=10"; --echo ---- switch to connection default ---- connection default; # then QC is enabled at EXECUTE -set global query_cache_size=100000; +set global query_cache_size=102400; show status like 'Qcache_hits'; execute stmt1; show status like 'Qcache_hits'; @@ -258,7 +260,7 @@ connection default; set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=?"; # then QC is enabled at EXECUTE -set global query_cache_size=100000; +set global query_cache_size=102400; show status like 'Qcache_hits'; set @a=1; execute stmt1 using @a; @@ -490,6 +492,37 @@ use test; --echo --echo ######################################################################## +--echo # +--echo # Bug#27430 Crash in subquery code when in PS and table DDL changed +--echo # after PREPARE +--echo # Check the effect of automatic reprepare on query cache +--echo # +--echo ######################################################################## +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a varchar(255)); +insert into t1 (a) values ("Pack my box with five dozen liquor jugs."); +flush status; +prepare stmt from "select a from t1"; +execute stmt; +set @@global.query_cache_size=0; +alter table t1 add column b int; +execute stmt; +set @@global.query_cache_size=102400; +execute stmt; +execute stmt; +--echo # +--echo # Sic: ALTER TABLE caused an automatic reprepare +--echo # of the prepared statement. Since the query cache was disabled +--echo # at the time of reprepare, the new prepared statement doesn't +--echo # work with it. +--echo # +show status like 'Qcache_hits'; +show status like 'Qcache_queries_in_cache'; +--echo # Cleanup +deallocate prepare stmt; +drop table t1; ############################################################################### |