summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@laptop.sanja.is.com.ua>2003-08-23 13:29:38 +0300
committerunknown <bell@laptop.sanja.is.com.ua>2003-08-23 13:29:38 +0300
commit93afa26ea7c6206aca6d8dc3b25873f4d732b929 (patch)
tree53f4829d55971fc556fdf48ef0def5296d1b9f18 /sql
parentb4a45538dfc89868246bdb1bd6ec8a20eba666b1 (diff)
downloadmariadb-git-93afa26ea7c6206aca6d8dc3b25873f4d732b929.tar.gz
fixed bug of lack of fix_fields call (after merge bugfix (SCRUM))
fixed bug in Item_sum fixed bug in dependence remover after merge fix mysql-test/r/subselect.result: after merge fix mysql-test/r/union.result: new test mysql-test/t/subselect.test: after merge fix mysql-test/t/union.test: new test sql/item.cc: fixed returned value sql/item.h: fixed flag dropper (I was not able to find Item whicj need more to be fix_fielded twice) sql/item_subselect.h: fixed initialisation sql/item_sum.cc: fixed absence of walk method of Item_sum sql/item_sum.h: fixed absence of walk method of Item_sum sql/mysql_priv.h: setup_fields reverter sql/sql_base.cc: setup_fields reverter sql/sql_derived.cc: fixed bug of lack of fix_fields call sql/sql_union.cc: fixed bug of lack of fix_fields call
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_subselect.h3
-rw-r--r--sql/item_sum.cc14
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/sql_base.cc15
-rw-r--r--sql/sql_derived.cc3
-rw-r--r--sql/sql_union.cc3
9 files changed, 42 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 86fa2d82c41..1a071174210 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -99,7 +99,7 @@ bool Item_ident::remove_dependence_processor(byte * arg)
DBUG_ENTER("Item_ident::remove_dependence_processor");
if (depended_from == (st_select_lex *) arg)
depended_from= 0;
- DBUG_RETURN(1);
+ DBUG_RETURN(0);
}
diff --git a/sql/item.h b/sql/item.h
index 296ad18b1f1..4a1c6ac37b6 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -195,6 +195,7 @@ public:
}
virtual bool remove_dependence_processor(byte * arg) { return 0; }
+ virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; }
// Row emulation
virtual uint cols() { return 1; }
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index d5c642fd337..194d75e3f30 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -206,7 +206,8 @@ public:
Item_in_subselect(THD *thd, Item * left_expr, st_select_lex *select_lex);
Item_in_subselect(Item_in_subselect *item);
- Item_in_subselect(): Item_exists_subselect(), abort_on_null(0) {}
+ Item_in_subselect()
+ :Item_exists_subselect(), abort_on_null(0), upper_not(0) {}
subs_type substype() { return IN_SUBS; }
void reset()
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 1d3e608c31c..b029bcf2b87 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -118,6 +118,20 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
return sum_item;
}
+bool Item_sum::walk (Item_processor processor, byte *argument)
+{
+ if (arg_count)
+ {
+ Item **arg,**arg_end;
+ for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++)
+ {
+ if ((*arg)->walk(processor, argument))
+ return 1;
+ }
+ }
+ return (this->*processor)(argument);
+}
+
String *
Item_sum_num::val_str(String *str)
{
diff --git a/sql/item_sum.h b/sql/item_sum.h
index ebb90c05215..651124e65f5 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -82,6 +82,8 @@ public:
virtual bool setup(THD *thd) {return 0;}
virtual void make_unique() {}
Item *get_tmp_table_item(THD *thd);
+
+ bool walk (Item_processor processor, byte *argument);
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index a5d9ce5bce3..a28d343ffd6 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -625,6 +625,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
int setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
List<Item> &item, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func);
+void unfix_item_list(List<Item> item_list);
int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
int setup_ftfuncs(SELECT_LEX* select);
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index dc6e791c4be..2b23b622cc6 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2007,6 +2007,21 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
}
/*
+ Mark all items in list as not fixed (0 assigned to 'fixed' field)
+
+ SYNOPSYS
+ unfix_item_list()
+ item_list - list of items
+*/
+void unfix_item_list(List<Item> item_list)
+{
+ Item *item;
+ List_iterator_fast<Item> it(item_list);
+ while ((item= it++))
+ item->walk(&Item::remove_fixed, 0);
+}
+
+/*
Remap table numbers if INSERT ... SELECT
Check also that the 'used keys' and 'ignored keys' exists and set up the
table structure accordingly
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 771d68e8462..fcbb1bcfdeb 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -144,6 +144,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
res= -1;
goto exit;
}
+ // Item list should be fix_fielded yet another time in JOIN::prepare
+ unfix_item_list(item_list);
+
bzero((char*) &tmp_table_param,sizeof(tmp_table_param));
tmp_table_param.field_count= item_list.elements;
/*
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 5d815bb2ffa..e5fe5b13b02 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -156,6 +156,9 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
item_list, 0, 0, 1))
goto err;
+ // Item list should be fix_fielded yet another time in JOIN::prepare
+ unfix_item_list(item_list);
+
t_and_f= 1;
while((item=it++))
{