summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-10-23 14:23:32 +0200
committerunknown <pem@mysql.comhem.se>2004-10-23 14:23:32 +0200
commit4c06b4aed7d2df6d7b05de18c646592a2ff3ea94 (patch)
treef4b048b3634a78816e13bcf72711e9dca201ab1a /mysql-test
parentd925bcd8d61ada4bd61fcbf6ae35b2ee2b1def93 (diff)
downloadmariadb-git-4c06b4aed7d2df6d7b05de18c646592a2ff3ea94.tar.gz
Fixed BUG#6029: Stored procedure specific handlers should have priority.
mysql-test/r/sp.result: New test case for BUG#6022. mysql-test/t/sp.test: New test case for BUG#6022. sql/sp_rcontext.cc: Find the most specific condition handler, not just the first one. (And corrected the return type for find_handler) sql/sp_rcontext.h: Corrected return type for find_handler.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp.result20
-rw-r--r--mysql-test/t/sp.test26
2 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index fea4e94ec4c..7ff7779aa83 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -1947,6 +1947,26 @@ select bug6022(5)|
bug6022(5)
0
drop function bug6022|
+drop procedure if exists bug6029|
+create procedure bug6029()
+begin
+declare exit handler for 1136 select '1136';
+declare exit handler for sqlstate '23000' select 'sqlstate 23000';
+declare continue handler for sqlexception select 'sqlexception';
+insert into t3 values (1);
+insert into t3 values (1,2);
+end|
+create table t3 (s1 int, primary key (s1))|
+insert into t3 values (1)|
+call bug6029()|
+sqlstate 23000
+sqlstate 23000
+delete from t3|
+call bug6029()|
+1136
+1136
+drop procedure bug6029|
+drop table t3|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7b673d27025..654d8966255 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -2109,6 +2109,32 @@ end|
select bug6022(5)|
drop function bug6022|
+#
+# BUG#6029: Stored procedure specific handlers should have priority
+#
+--disable_warnings
+drop procedure if exists bug6029|
+--enable_warnings
+
+create procedure bug6029()
+begin
+ declare exit handler for 1136 select '1136';
+ declare exit handler for sqlstate '23000' select 'sqlstate 23000';
+ declare continue handler for sqlexception select 'sqlexception';
+
+ insert into t3 values (1);
+ insert into t3 values (1,2);
+end|
+
+create table t3 (s1 int, primary key (s1))|
+insert into t3 values (1)|
+call bug6029()|
+delete from t3|
+call bug6029()|
+
+drop procedure bug6029|
+drop table t3|
+
#
# Some "real" examples