Commit c40e51f2 authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Fix BUG#2260: Handler NOT FOUND declaration does't work in stored procedure

parent cfd97c02
......@@ -893,6 +893,21 @@ avg 0 4.4
delete from t1|
delete from t2|
drop procedure bug1874|
create procedure bug2260()
begin
declare v1 int;
declare continue handler for not found set @x2 = 1;
declare c1 cursor for select data from t1;
open c1;
fetch c1 into v1;
set @x2 = 2;
close c1;
end|
call bug2260()|
select @x2|
@x2
2
drop procedure bug2260|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
......
......@@ -1036,6 +1036,25 @@ delete from t1|
delete from t2|
drop procedure bug1874|
#
# BUG#2260
#
create procedure bug2260()
begin
declare v1 int;
declare continue handler for not found set @x2 = 1;
declare c1 cursor for select data from t1;
open c1;
fetch c1 into v1;
set @x2 = 2;
close c1;
end|
call bug2260()|
select @x2|
drop procedure bug2260|
#
# Some "real" examples
......
......@@ -72,15 +72,15 @@ sp_rcontext::find_handler(uint sql_errno)
found= 1;
break;
case sp_cond_type_t::warning:
if (sqlstate[0] == '0' && sqlstate[0] == '1')
if (sqlstate[0] == '0' && sqlstate[1] == '1')
found= 1;
break;
case sp_cond_type_t::notfound:
if (sqlstate[0] == '0' && sqlstate[0] == '2')
if (sqlstate[0] == '0' && sqlstate[1] == '2')
found= 1;
break;
case sp_cond_type_t::exception:
if (sqlstate[0] != '0' || sqlstate[0] > '2')
if (sqlstate[0] != '0' || sqlstate[1] > '2')
found= 1;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment