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

Fixed BUG#8757: Stored Procedures: Scope of Begin and End Statements do not work properly.

parent e3f286a0
......@@ -2174,6 +2174,36 @@ end if;
select plus;
end|
drop procedure bug6857|
drop procedure if exists bug8757|
create procedure bug8757()
begin
declare x int;
declare c1 cursor for select data from t1 limit 1;
begin
declare y int;
declare c2 cursor for select i from t2 limit 1;
open c2;
fetch c2 into y;
close c2;
select 2,y;
end;
open c1;
fetch c1 into x;
close c1;
select 1,x;
end|
delete from t1|
delete from t2|
insert into t1 values ("x", 1)|
insert into t2 values ("y", 2, 0.0)|
call bug8757()|
2 y
2 2
1 x
1 1
delete from t1|
delete from t2|
drop procedure bug8757|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
drop procedure if exists ifac|
......
......@@ -2676,6 +2676,43 @@ end|
drop procedure bug6857|
#
# BUG#8757: Stored Procedures: Scope of Begin and End Statements do not
# work properly.
--disable_warnings
drop procedure if exists bug8757|
--enable_warnings
create procedure bug8757()
begin
declare x int;
declare c1 cursor for select data from t1 limit 1;
begin
declare y int;
declare c2 cursor for select i from t2 limit 1;
open c2;
fetch c2 into y;
close c2;
select 2,y;
end;
open c1;
fetch c1 into x;
close c1;
select 1,x;
end|
delete from t1|
delete from t2|
insert into t1 values ("x", 1)|
insert into t2 values ("y", 2, 0.0)|
call bug8757()|
delete from t1|
delete from t2|
drop procedure bug8757|
#
# Some "real" examples
......
......@@ -264,7 +264,7 @@ sp_pcontext::find_cursor(LEX_STRING *name, uint *poff, my_bool scoped)
(const uchar *)name->str, name->length,
(const uchar *)n.str, n.length) == 0)
{
*poff= i;
*poff= m_coffset + i;
return TRUE;
}
}
......
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