summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-03-25 14:40:36 +0200
committerunknown <bell@sanja.is.com.ua>2004-03-25 14:40:36 +0200
commitbdb874226efb55979eb8eef909f050ba6f949ab8 (patch)
treee6f396c962b2435d0ee4fe03d4febadbd4439111 /sql/sql_union.cc
parent7674fd064c7a2d8b2efec1ee8d7b4eaae0dd7fc5 (diff)
parentaadc499aeaa3f6976d9ebea1ef787e294d759ee2 (diff)
downloadmariadb-git-bdb874226efb55979eb8eef909f050ba6f949ab8.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-alias-4.1 sql/sql_lex.cc: Auto merged sql/sql_union.cc: Auto merged
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 3a27e606cff..6eb72b3ac3d 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -226,13 +226,23 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg->lex->current_select= lex_select_save;
{
+ Statement *stmt= thd->current_statement;
+ Statement backup;
+ if (stmt)
+ thd->set_n_backup_item_arena(stmt, &backup);
Field **field;
for (field= table->field; *field; field++)
{
Item_field *item= new Item_field(*field);
if (!item || item_list.push_back(item))
+ {
+ if (stmt)
+ thd->restore_backup_item_arena(stmt, &backup);
DBUG_RETURN(-1);
+ }
}
+ if (stmt)
+ thd->restore_backup_item_arena(stmt, &backup);
}
}
else
@@ -431,7 +441,7 @@ int st_select_lex_unit::cleanup()
{
DBUG_RETURN(0);
}
- cleaned= 0;
+ cleaned= 1;
if (union_result)
{
@@ -465,16 +475,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
{
prepared= optimized= executed= 0;
#ifndef DBUG_OFF
- List_iterator_fast<Item> it(item_list);
- Item_field *field;
- while ((field= (Item_field *)it++))
+ if (first_select()->next_select())
{
- /*
- we can't cleanup here, because it broke link to temporary table field,
- but have to drop fixed flag to allow next fix_field of this field
- during re-executing
- */
- field->fixed= 0;
+ List_iterator_fast<Item> it(item_list);
+ Item *field;
+ while ((field= it++))
+ {
+ /*
+ we can't cleanup here, because it broke link to temporary table field,
+ but have to drop fixed flag to allow next fix_field of this field
+ during re-executing
+ */
+ field->fixed= 0;
+ }
}
#endif
}