22 #include "sql_class.h"
40 Item(), used_tables_cache(0), not_null_tables_cache(0),
41 const_item_cache(1), with_null(0)
45 if ((arg_count= arg.elements))
59 void Item_row::illegal_method_call(
const char *method)
61 DBUG_ENTER(
"Item_row::illegal_method_call");
62 DBUG_PRINT(
"error", (
"!!! %s method was called for row item", method));
64 my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
68 bool Item_row::fix_fields(THD *thd,
Item **ref)
70 DBUG_ASSERT(fixed == 0);
73 Item **arg, **arg_end;
74 for (arg=
items, arg_end=
items+arg_count; arg != arg_end ; arg++)
76 if ((*arg)->fix_fields(thd, arg))
80 used_tables_cache |= item->used_tables();
81 const_item_cache&= item->const_item() && !with_null;
82 not_null_tables_cache|= item->not_null_tables();
87 with_null|= item->null_inside();
94 maybe_null|= item->maybe_null;
95 with_sum_func|= item->with_sum_func;
103 void Item_row::cleanup()
105 DBUG_ENTER(
"Item_row::cleanup");
109 used_tables_cache= 0;
117 void Item_row::split_sum_func(THD *thd,
Ref_ptr_array ref_pointer_array,
120 Item **arg, **arg_end;
121 for (arg=
items, arg_end=
items+arg_count; arg != arg_end ; arg++)
126 void Item_row::update_used_tables()
128 used_tables_cache= 0;
130 with_subselect=
false;
131 with_stored_program=
false;
132 for (uint
i= 0;
i < arg_count;
i++)
134 items[
i]->update_used_tables();
135 used_tables_cache|=
items[
i]->used_tables();
136 const_item_cache&=
items[
i]->const_item();
137 with_subselect|=
items[
i]->has_subquery();
138 with_stored_program|=
items[
i]->has_stored_program();
143 st_select_lex *removed_select)
145 used_tables_cache= 0;
147 for (uint
i= 0;
i < arg_count;
i++)
149 items[
i]->fix_after_pullout(parent_select, removed_select);
150 used_tables_cache|=
items[
i]->used_tables();
151 const_item_cache&=
items[
i]->const_item();
155 bool Item_row::check_cols(uint c)
159 my_error(ER_OPERAND_COLUMNS, MYF(0), c);
168 for (uint
i= 0;
i < arg_count;
i++)
172 items[
i]->print(str, query_type);
178 bool Item_row::walk(Item_processor processor,
bool walk_subquery, uchar *arg)
180 for (uint
i= 0;
i < arg_count;
i++)
182 if (
items[
i]->walk(processor, walk_subquery, arg))
185 return (this->*processor)(arg);
191 DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
193 for (uint
i= 0;
i < arg_count;
i++)
195 Item *new_item=
items[
i]->transform(transformer, arg);
206 current_thd->change_item_tree(&
items[
i], new_item);
208 return (this->*transformer)(arg);
211 void Item_row::bring_value()
213 for (uint
i= 0;
i < arg_count;
i++)