fixed using in SP sentences which use Item tree temporary changes rollback (BUG#7992)
mysql-test/r/sp.result: rolling back temporary Item tree changes in SP mysql-test/t/sp.test: rolling back temporary Item tree changes in SP sql/sp_head.cc: if PS instruction made some temporary changes in Item tree we have to roll it back
This commit is contained in:
parent
59a68b8964
commit
fdb6225390
@ -2321,3 +2321,16 @@ select `foo` ();
|
|||||||
`foo` ()
|
`foo` ()
|
||||||
5
|
5
|
||||||
drop function `foo`;
|
drop function `foo`;
|
||||||
|
drop procedure if exists p1;
|
||||||
|
create table t1(id int);
|
||||||
|
insert into t1 values(1);
|
||||||
|
create procedure p1()
|
||||||
|
begin
|
||||||
|
declare i int;
|
||||||
|
select max(id)+1 into i from t1;
|
||||||
|
end
|
||||||
|
//
|
||||||
|
call p1()//
|
||||||
|
call p1()//
|
||||||
|
drop procedure p1;
|
||||||
|
drop table t1;
|
||||||
|
@ -2739,3 +2739,24 @@ drop function if exists foo;
|
|||||||
create function `foo` () returns int return 5;
|
create function `foo` () returns int return 5;
|
||||||
select `foo` ();
|
select `foo` ();
|
||||||
drop function `foo`;
|
drop function `foo`;
|
||||||
|
|
||||||
|
#
|
||||||
|
# rolling back temporary Item tree changes in SP
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop procedure if exists p1;
|
||||||
|
--enable_warnings
|
||||||
|
create table t1(id int);
|
||||||
|
insert into t1 values(1);
|
||||||
|
delimiter //;
|
||||||
|
create procedure p1()
|
||||||
|
begin
|
||||||
|
declare i int;
|
||||||
|
select max(id)+1 into i from t1;
|
||||||
|
end
|
||||||
|
//
|
||||||
|
call p1()//
|
||||||
|
call p1()//
|
||||||
|
delimiter ;//
|
||||||
|
drop procedure p1;
|
||||||
|
drop table t1;
|
||||||
|
@ -482,6 +482,7 @@ sp_head::execute(THD *thd)
|
|||||||
break;
|
break;
|
||||||
DBUG_PRINT("execute", ("Instruction %u", ip));
|
DBUG_PRINT("execute", ("Instruction %u", ip));
|
||||||
ret= i->execute(thd, &ip);
|
ret= i->execute(thd, &ip);
|
||||||
|
thd->rollback_item_tree_changes();
|
||||||
if (i->free_list)
|
if (i->free_list)
|
||||||
cleanup_items(i->free_list);
|
cleanup_items(i->free_list);
|
||||||
// Check if an exception has occurred and a handler has been found
|
// Check if an exception has occurred and a handler has been found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user