17 #include <drizzled/error.h>
18 #include <drizzled/session.h>
19 #include <drizzled/item/row.h>
38 Item(), used_tables_cache(0), const_item_cache(1), with_null(0)
42 if ((arg_count= arg.size()))
43 items= (
Item**) memory::sql_alloc(
sizeof(
Item*)*arg_count);
48 while (
Item* item= li++)
55 void Item_row::illegal_method_call(
const char *)
58 my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
61 bool Item_row::fix_fields(Session *session, Item **)
66 Item **arg, **arg_end;
67 for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
69 if ((*arg)->fix_fields(session, arg))
73 used_tables_cache |= item->used_tables();
74 const_item_cache&= item->const_item() && !with_null;
78 with_null|= item->null_inside();
86 with_sum_func= with_sum_func || item->with_sum_func;
93 void Item_row::cleanup()
98 const_item_cache=
true;
105 void Item_row::split_sum_func(Session *session, Item **ref_pointer_array,
108 Item **arg, **arg_end;
109 for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
110 (*arg)->split_sum_func(session, ref_pointer_array, fields, arg,
true);
114 void Item_row::update_used_tables()
116 used_tables_cache= 0;
117 const_item_cache=
true;
118 for (uint32_t i= 0; i < arg_count; i++)
120 items[i]->update_used_tables();
128 used_tables_cache= 0;
129 const_item_cache=
true;
130 for (uint32_t i= 0; i < arg_count; i++)
138 bool Item_row::check_cols(uint32_t c)
142 my_error(ER_OPERAND_COLUMNS, MYF(0), c);
151 for (uint32_t i= 0; i < arg_count; i++)
155 items[i]->
print(str);
161 bool Item_row::walk(Item_processor processor,
bool walk_subquery,
unsigned char *arg)
163 for (uint32_t i= 0; i < arg_count; i++)
165 if (items[i]->walk(processor, walk_subquery, arg))
168 return (this->*processor)(arg);
174 for (uint32_t i= 0; i < arg_count; i++)
181 return (this->*transformer)(arg);
184 void Item_row::bring_value()
186 for (uint32_t i= 0; i < arg_count; i++)
187 items[i]->bring_value();
virtual bool const_item() const
TODO: Rename this file - func.h is stupid.
Item * transform(Item_transformer transformer, unsigned char *arg)
virtual Item * transform(Item_transformer transformer, unsigned char *arg)
virtual void print(String *str)
void fix_after_pullout(Select_Lex *new_parent, Item **ref)
virtual void fix_after_pullout(Select_Lex *new_parent, Item **ref)
virtual void print(String *str)
virtual table_map used_tables() const