Commit 17bd4e9f authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-bug7-5.0

parents 8080eb74 c3562541
...@@ -735,11 +735,10 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) ...@@ -735,11 +735,10 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
init_alloc_root(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0); init_alloc_root(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0);
thd->set_n_backup_item_arena(&call_arena, &backup_arena);
// QQ Should have some error checking here? (types, etc...) // QQ Should have some error checking here? (types, etc...)
nctx= new sp_rcontext(csize, hmax, cmax); nctx= new sp_rcontext(csize, hmax, cmax);
nctx->callers_mem_root= backup_arena.mem_root; nctx->callers_mem_root= thd->mem_root;
for (i= 0 ; i < argcount ; i++) for (i= 0 ; i < argcount ; i++)
{ {
sp_pvar_t *pvar = m_pcont->find_pvar(i); sp_pvar_t *pvar = m_pcont->find_pvar(i);
...@@ -765,6 +764,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) ...@@ -765,6 +764,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
} }
} }
thd->spcont= nctx; thd->spcont= nctx;
thd->set_n_backup_item_arena(&call_arena, &backup_arena);
/* mem_root was moved to backup_arena */
DBUG_ASSERT(nctx->callers_mem_root == backup_arena.mem_root);
ret= execute(thd); ret= execute(thd);
...@@ -834,7 +836,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) ...@@ -834,7 +836,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
} }
init_alloc_root(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0); init_alloc_root(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0);
thd->set_n_backup_item_arena(&call_arena, &backup_arena);
if (csize > 0 || hmax > 0 || cmax > 0) if (csize > 0 || hmax > 0 || cmax > 0)
{ {
...@@ -899,12 +900,11 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) ...@@ -899,12 +900,11 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
} }
if (! ret) if (! ret)
{
thd->set_n_backup_item_arena(&call_arena, &backup_arena);
ret= execute(thd); ret= execute(thd);
thd->restore_backup_item_arena(&call_arena, &backup_arena);
// Partially restore context now. }
// We still need the call mem root and free list for processing
// of out parameters.
thd->restore_backup_item_arena(&call_arena, &backup_arena);
if (!ret && csize > 0) if (!ret && csize > 0)
{ {
......
...@@ -646,6 +646,7 @@ bool st_select_lex::cleanup() ...@@ -646,6 +646,7 @@ bool st_select_lex::cleanup()
if (join) if (join)
{ {
DBUG_ASSERT((st_select_lex*)join->select_lex == this);
error|= join->destroy(); error|= join->destroy();
delete join; delete join;
join= 0; join= 0;
......
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