Commit fdb62253 authored by unknown's avatar unknown

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
parent 59a68b89
......@@ -2321,3 +2321,16 @@ select `foo` ();
`foo` ()
5
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;
select `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;
DBUG_PRINT("execute", ("Instruction %u", ip));
ret= i->execute(thd, &ip);
thd->rollback_item_tree_changes();
if (i->free_list)
cleanup_items(i->free_list);
// Check if an exception has occurred and a handler has been found
......
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