mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
Fix BUG#2260: Handler NOT FOUND declaration does't work in stored procedure
This commit is contained in:
parent
cfd97c022e
commit
c40e51f283
3 changed files with 37 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue