summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-08-19 16:05:58 +0300
committerunknown <timour@mysql.com>2005-08-19 16:05:58 +0300
commite39656fb3b526faf10940339f0cc17452724f524 (patch)
treeb0a218e41983ec6c1cdb0bbbc12437a5f46e839b /mysql-test
parentf887aec2f38ba13cf7ec82ac5943aab0ce57d333 (diff)
parent276bd123b7b9cf516c8ddd7a28952f6e1275aa8c (diff)
downloadmariadb-git-e39656fb3b526faf10940339f0cc17452724f524.tar.gz
Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into mysql.com:/home/timka/mysql/src/5.0-2486
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp.result66
-rw-r--r--mysql-test/t/sp.test66
2 files changed, 132 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 78bf22d0b27..d1d41035475 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3100,4 +3100,70 @@ end|
call p_bug11247(10)|
drop function f_bug11247|
drop procedure p_bug11247|
+drop procedure if exists bug12168|
+drop table if exists t1, t2|
+create table t1 (a int)|
+insert into t1 values (1),(2),(3),(4)|
+create table t2 (a int)|
+create procedure bug12168(arg1 char(1))
+begin
+declare b, c integer;
+if arg1 = 'a' then
+begin
+declare c1 cursor for select a from t1 where a % 2;
+declare continue handler for not found set b = 1;
+set b = 0;
+open c1;
+c1_repeat: repeat
+fetch c1 into c;
+if (b = 1) then
+leave c1_repeat;
+end if;
+insert into t2 values (c);
+until b = 1
+end repeat;
+end;
+end if;
+if arg1 = 'b' then
+begin
+declare c2 cursor for select a from t1 where not a % 2;
+declare continue handler for not found set b = 1;
+set b = 0;
+open c2;
+c2_repeat: repeat
+fetch c2 into c;
+if (b = 1) then
+leave c2_repeat;
+end if;
+insert into t2 values (c);
+until b = 1
+end repeat;
+end;
+end if;
+end|
+call bug12168('a')|
+select * from t2|
+a
+1
+3
+truncate t2|
+call bug12168('b')|
+select * from t2|
+a
+2
+4
+truncate t2|
+call bug12168('a')|
+select * from t2|
+a
+1
+3
+truncate t2|
+call bug12168('b')|
+select * from t2|
+a
+2
+4
+truncate t2|
+drop procedure if exists bug12168|
drop table t1,t2;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index cde5d3922ab..f3e7c3e07a0 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -3928,6 +3928,72 @@ end|
call p_bug11247(10)|
drop function f_bug11247|
drop procedure p_bug11247|
+#
+# BUG#12168: "'DECLARE CONTINUE HANDLER FOR NOT FOUND ...' in conditional
+# handled incorrectly"
+#
+--disable_warnings
+drop procedure if exists bug12168|
+drop table if exists t1, t2|
+--enable_warnings
+
+create table t1 (a int)|
+insert into t1 values (1),(2),(3),(4)|
+
+create table t2 (a int)|
+
+create procedure bug12168(arg1 char(1))
+begin
+ declare b, c integer;
+ if arg1 = 'a' then
+ begin
+ declare c1 cursor for select a from t1 where a % 2;
+ declare continue handler for not found set b = 1;
+ set b = 0;
+ open c1;
+ c1_repeat: repeat
+ fetch c1 into c;
+ if (b = 1) then
+ leave c1_repeat;
+ end if;
+
+ insert into t2 values (c);
+ until b = 1
+ end repeat;
+ end;
+ end if;
+ if arg1 = 'b' then
+ begin
+ declare c2 cursor for select a from t1 where not a % 2;
+ declare continue handler for not found set b = 1;
+ set b = 0;
+ open c2;
+ c2_repeat: repeat
+ fetch c2 into c;
+ if (b = 1) then
+ leave c2_repeat;
+ end if;
+
+ insert into t2 values (c);
+ until b = 1
+ end repeat;
+ end;
+ end if;
+end|
+
+call bug12168('a')|
+select * from t2|
+truncate t2|
+call bug12168('b')|
+select * from t2|
+truncate t2|
+call bug12168('a')|
+select * from t2|
+truncate t2|
+call bug12168('b')|
+select * from t2|
+truncate t2|
+drop procedure if exists bug12168|
#
# BUG#NNNN: New bug synopsis