summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2006-04-25 04:27:23 +0400
committerunknown <konstantin@mysql.com>2006-04-25 04:27:23 +0400
commitf28b9a34235b08f72bf3c2b8de85227958cac17d (patch)
treed727aecc399c52bb4ae1fb8dd09469ffe7ffbbb8 /mysql-test
parentef82f93dcc0d4636cdf102f6583224b49989581f (diff)
downloadmariadb-git-f28b9a34235b08f72bf3c2b8de85227958cac17d.tar.gz
A fix and a test case for Bug#19308 "REPAIR/OPTIMIZE/ANALYZE
supported in SP but not in PS": just enable them in prepared statements, the supporting functionality was implemented when they were enabled in stored procedures. mysql-test/r/ps.result: Bug#19308: test results fixed. mysql-test/r/ps_1general.result: Adjust existing test cases (ANALYZE/OPTIMIZE/REPAIR are now allowed in prepared statements. mysql-test/r/sp-dynamic.result: Adjust existing test cases (ANALYZE/OPTIMIZE/REPAIR are now allowed in prepared statements. mysql-test/t/ps.test: Add a test case for Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS" mysql-test/t/ps_1general.test: Adjust existing test cases (ANALYZE/OPTIMIZE/REPAIR are now allowed in prepared statements. sql/sql_prepare.cc: Enable ANALYZE, OPTIMIZE, REPAIR in prepared statements.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ps.result101
-rw-r--r--mysql-test/r/ps_1general.result3
-rw-r--r--mysql-test/r/sp-dynamic.result6
-rw-r--r--mysql-test/t/ps.test36
-rw-r--r--mysql-test/t/ps_1general.test3
5 files changed, 140 insertions, 9 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index b29185eaaea..fccaa9b1b66 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1056,3 +1056,104 @@ a b
1 9
3 7
drop table t1;
+create table t1 (a int);
+create table t2 like t1;
+create table t3 like t2;
+prepare stmt from "repair table t1";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+prepare stmt from "optimize table t1";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+prepare stmt from "analyze table t1";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+prepare stmt from "repair table t1, t2, t3";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+test.t3 repair status OK
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t2 repair status OK
+test.t3 repair status OK
+prepare stmt from "optimize table t1, t2, t3";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+test.t2 optimize status OK
+test.t3 optimize status OK
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+test.t2 optimize status Table is already up to date
+test.t3 optimize status Table is already up to date
+prepare stmt from "analyze table t1, t2, t3";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+test.t2 analyze status Table is already up to date
+test.t3 analyze status Table is already up to date
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+test.t2 analyze status Table is already up to date
+test.t3 analyze status Table is already up to date
+prepare stmt from "repair table t1, t4, t3";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t4 repair error Table 'test.t4' doesn't exist
+test.t3 repair status OK
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+test.t4 repair error Table 'test.t4' doesn't exist
+test.t3 repair status OK
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+prepare stmt from "optimize table t1, t3, t4";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+test.t3 optimize status OK
+test.t4 optimize error Table 'test.t4' doesn't exist
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+execute stmt;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+test.t3 optimize status Table is already up to date
+test.t4 optimize error Table 'test.t4' doesn't exist
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+prepare stmt from "analyze table t4, t1";
+execute stmt;
+Table Op Msg_type Msg_text
+test.t4 analyze error Table 'test.t4' doesn't exist
+test.t1 analyze status Table is already up to date
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+execute stmt;
+Table Op Msg_type Msg_text
+test.t4 analyze error Table 'test.t4' doesn't exist
+test.t1 analyze status Table is already up to date
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+deallocate prepare stmt;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 8e22c5daa8e..3c736a508d3 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -422,13 +422,10 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' analyze table t1 ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open ';
diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result
index c00b09f90e1..d9d5706cded 100644
--- a/mysql-test/r/sp-dynamic.result
+++ b/mysql-test/r/sp-dynamic.result
@@ -286,12 +286,12 @@ id stmt_text status
1 select 1 supported
2 flush tables not supported
3 handler t1 open as ha not supported
-4 analyze table t1 not supported
+4 analyze table t1 supported
5 check table t1 not supported
6 checksum table t1 not supported
7 check table t1 not supported
-8 optimize table t1 not supported
-9 repair table t1 not supported
+8 optimize table t1 supported
+9 repair table t1 supported
10 describe extended select * from t1 supported
11 help help not supported
12 show databases supported
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 1f5f17fe976..cc7d7ef2d82 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1110,4 +1110,40 @@ select * from t1 order by 1+1;
drop table t1;
+#
+# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS".
+# Add test coverage for the added commands.
+#
+create table t1 (a int);
+create table t2 like t1;
+create table t3 like t2;
+prepare stmt from "repair table t1";
+execute stmt;
+execute stmt;
+prepare stmt from "optimize table t1";
+execute stmt;
+execute stmt;
+prepare stmt from "analyze table t1";
+execute stmt;
+execute stmt;
+prepare stmt from "repair table t1, t2, t3";
+execute stmt;
+execute stmt;
+prepare stmt from "optimize table t1, t2, t3";
+execute stmt;
+execute stmt;
+prepare stmt from "analyze table t1, t2, t3";
+execute stmt;
+execute stmt;
+prepare stmt from "repair table t1, t4, t3";
+execute stmt;
+execute stmt;
+prepare stmt from "optimize table t1, t3, t4";
+execute stmt;
+execute stmt;
+prepare stmt from "analyze table t4, t1";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
# End of 5.0 tests
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 89fad3fa4fb..72b69fc8d9f 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -453,13 +453,10 @@ into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ;
##
---error 1295
prepare stmt1 from ' optimize table t1 ' ;
---error 1295
prepare stmt1 from ' analyze table t1 ' ;
--error 1295
prepare stmt1 from ' checksum table t1 ' ;
---error 1295
prepare stmt1 from ' repair table t1 ' ;
--error 1295
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;