summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-06-29 11:50:29 +0300
committerunknown <bell@sanja.is.com.ua>2005-06-29 11:50:29 +0300
commitc35625416ce62a653716e761acdee97fcd56b8fd (patch)
tree6cf23b2faab7872e617525ce08f988793195fe1c /sql
parent10986dba1bba289b8d8c3eee5335b5c38519bc6a (diff)
downloadmariadb-git-c35625416ce62a653716e761acdee97fcd56b8fd.tar.gz
fixed SP parameter execution
sql/sp_head.cc: execute parameters in statement mem_root sql/sql_union.cc: additional assert
Diffstat (limited to 'sql')
-rw-r--r--sql/sp_head.cc16
-rw-r--r--sql/sql_union.cc1
2 files changed, 9 insertions, 8 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index d075c86f8cd..e4dc64c993d 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -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);
- thd->set_n_backup_item_arena(&call_arena, &backup_arena);
// QQ Should have some error checking here? (types, etc...)
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++)
{
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)
}
}
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);
@@ -834,7 +836,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
}
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)
{
@@ -899,12 +900,11 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
}
if (! ret)
+ {
+ thd->set_n_backup_item_arena(&call_arena, &backup_arena);
ret= execute(thd);
-
- // 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);
+ thd->restore_backup_item_arena(&call_arena, &backup_arena);
+ }
if (!ret && csize > 0)
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 87b67a5127a..6e307dda5be 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -646,6 +646,7 @@ bool st_select_lex::cleanup()
if (join)
{
+ DBUG_ASSERT((st_select_lex*)join->select_lex == this);
error|= join->destroy();
delete join;
join= 0;