22 #include <drizzled/item/ident.h>
29 void set_properties();
31 enum Ref_Type { REF, DIRECT_REF, OUTER_REF };
35 const char *db_arg,
const char *table_name_arg,
36 const char *field_name_arg)
37 :
Item_ident(context_arg, db_arg, table_name_arg, field_name_arg),
38 result_field(0), ref(0) {}
54 const char *table_name_arg,
const char *field_name_arg,
55 bool alias_name_used_arg=
false);
59 :
Item_ident(session, item), result_field(item->result_field), ref(item->ref) {}
60 enum Type type()
const {
return REF_ITEM; }
61 bool eq(
const Item *item,
bool binary_cmp)
const
63 const Item *it= item->real_item();
64 return ref && (*ref)->
eq(it, binary_cmp);
74 int64_t val_int_result();
77 bool val_bool_result();
82 int save_in_field(
Field *field,
bool no_conversions);
83 void save_org_in_field(
Field *field);
84 enum Item_result result_type ()
const {
return (*ref)->result_type(); }
85 enum_field_types field_type()
const {
return (*ref)->field_type(); }
86 Field *get_tmp_table_field()
87 {
return result_field ? result_field : (*ref)->get_tmp_table_field(); }
88 Item *get_tmp_table_item(Session *session);
91 return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
93 void update_used_tables()
96 (*ref)->update_used_tables();
100 bool is_result_field() {
return 1; }
101 void save_in_result_field(
bool no_conversions)
103 (*ref)->save_in_field(result_field, no_conversions);
105 Item *real_item(
void)
107 return ref ? (*ref)->real_item() :
this;
109 const Item *real_item(
void)
const
111 return ref ? (*ref)->real_item() :
this;
113 bool walk(Item_processor processor,
bool walk_subquery,
unsigned char *arg)
114 {
return (*ref)->walk(processor, walk_subquery, arg); }
115 virtual void print(String *str);
118 return (*ref)->result_as_int64_t();
121 virtual Ref_Type ref_type() {
return REF; }
126 return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
128 Item* element_index(uint32_t i)
130 return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) :
this;
132 Item** addr(uint32_t i)
134 return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0;
136 bool check_cols(uint32_t c)
138 return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
139 : Item::check_cols(c);
143 return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
147 if (ref && result_type() == ROW_RESULT)
148 (*ref)->bring_value();
152 return (*ref)->basic_const_item();
bool basic_const_item() const
TODO: Rename this file - func.h is stupid.
virtual void print(String *str)
table_map used_tables() const
bool fix_fields(Session *, Item **)
virtual bool eq(const Item *, bool binary_cmp) const
void set_result_field(Field *field)
table_map not_null_tables() const
type::Decimal * val_decimal(type::Decimal *)
bool eq(const Item *item, bool binary_cmp) const
void fix_after_pullout(Select_Lex *new_parent, Item **ref)
void send(plugin::Client *client, String *tmp)
String * val_str(String *tmp)
bool get_date(type::Time <ime, uint32_t fuzzydate)