summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-17 17:23:21 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-17 17:23:21 +0400
commit952d284ba4617958840005d314ae8d19428df1c3 (patch)
tree72bde7f393958ae287e171c58530151b07acb72a /mysql-test
parent0077ba49400a58e2b35181f8b9d6e78314a9b36f (diff)
downloadmariadb-git-952d284ba4617958840005d314ae8d19428df1c3.tar.gz
Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines(for 5.1)
mysql-test/r/myisampack.result: result fix mysql-test/t/myisampack.test: test case fix
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/myisampack.result2
-rw-r--r--mysql-test/r/status2.result73
-rw-r--r--mysql-test/t/myisampack.test2
-rw-r--r--mysql-test/t/status2.test68
4 files changed, 143 insertions, 2 deletions
diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result
index 14b6283bf8f..7ed9b86d887 100644
--- a/mysql-test/r/myisampack.result
+++ b/mysql-test/r/myisampack.result
@@ -28,7 +28,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
drop table if exists t1;
-create table t1(f1 int, f2 varchar(255));
+create table t1(f1 int, f2 char(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result
new file mode 100644
index 00000000000..146fb2adbaf
--- /dev/null
+++ b/mysql-test/r/status2.result
@@ -0,0 +1,73 @@
+#
+# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
+#
+FLUSH STATUS;
+CREATE FUNCTION testQuestion() RETURNS INTEGER
+BEGIN
+DECLARE foo INTEGER;
+DECLARE bar INTEGER;
+SET foo=1;
+SET bar=2;
+RETURN foo;
+END $$
+CREATE PROCEDURE testQuestion2()
+BEGIN
+SELECT 1;
+END $$
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
+DO INSERT INTO t1 VALUES(1);
+Assert Questions == 7
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 7
+SELECT testQuestion();
+testQuestion()
+1
+Assert Questions == 9
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 9
+CALL testQuestion2();
+1
+1
+Assert Questions == 11
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 11
+SELECT 1;
+1
+1
+Assert Questions == 13
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 13
+SELECT 1;
+1
+1
+Assert Questions == 14
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 14
+CREATE TRIGGER trigg1 AFTER INSERT ON t1
+FOR EACH ROW BEGIN
+INSERT INTO t2 VALUES (1);
+END;
+$$
+Assert Questions == 16
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 16
+INSERT INTO t1 VALUES (1);
+Assert Questions == 18
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 18
+DROP PROCEDURE testQuestion2;
+DROP TRIGGER trigg1;
+DROP FUNCTION testQuestion;
+DROP EVENT ev1;
+DROP TABLE t1,t2;
+End of 6.0 tests
diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test
index 99767f81033..3b55154d433 100644
--- a/mysql-test/t/myisampack.test
+++ b/mysql-test/t/myisampack.test
@@ -38,7 +38,7 @@ DROP TABLE t1;
--disable_warnings
drop table if exists t1;
--enable_warnings
-create table t1(f1 int, f2 varchar(255));
+create table t1(f1 int, f2 char(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test
new file mode 100644
index 00000000000..2d1541c54f2
--- /dev/null
+++ b/mysql-test/t/status2.test
@@ -0,0 +1,68 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
+--echo #
+FLUSH STATUS;
+DELIMITER $$;
+CREATE FUNCTION testQuestion() RETURNS INTEGER
+BEGIN
+ DECLARE foo INTEGER;
+ DECLARE bar INTEGER;
+ SET foo=1;
+ SET bar=2;
+ RETURN foo;
+END $$
+CREATE PROCEDURE testQuestion2()
+BEGIN
+ SELECT 1;
+END $$
+DELIMITER ;$$
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
+ DO INSERT INTO t1 VALUES(1);
+
+--echo Assert Questions == 7
+SHOW STATUS LIKE 'Questions';
+SELECT testQuestion();
+--echo Assert Questions == 9
+SHOW STATUS LIKE 'Questions';
+CALL testQuestion2();
+--echo Assert Questions == 11
+SHOW STATUS LIKE 'Questions';
+SELECT 1;
+--echo Assert Questions == 13
+SHOW STATUS LIKE 'Questions';
+connect (con1,localhost,root,,);
+connection con1;
+SELECT 1;
+connection default;
+disconnect con1;
+--echo Assert Questions == 14
+SHOW STATUS LIKE 'Questions';
+DELIMITER $$;
+CREATE TRIGGER trigg1 AFTER INSERT ON t1
+ FOR EACH ROW BEGIN
+ INSERT INTO t2 VALUES (1);
+ END;
+$$
+DELIMITER ;$$
+--echo Assert Questions == 16
+SHOW STATUS LIKE 'Questions';
+INSERT INTO t1 VALUES (1);
+--echo Assert Questions == 18
+SHOW STATUS LIKE 'Questions';
+# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented.
+# FLUSH STATUS;
+# SHOW GLOBAL STATUS LIKE 'Questions';
+DROP PROCEDURE testQuestion2;
+DROP TRIGGER trigg1;
+DROP FUNCTION testQuestion;
+DROP EVENT ev1;
+DROP TABLE t1,t2;
+--echo End of 6.0 tests
+