612
618
st_select_lex *select);
615
class Item_blob :public Item_string
618
Item_blob(const char *name, uint32_t length) :
619
Item_string(name, length, &my_charset_bin)
620
{ max_length= length; }
621
enum Type type() const { return TYPE_HOLDER; }
622
enum_field_types field_type() const { return DRIZZLE_TYPE_BLOB; }
627
Item_empty_string -- is a utility class to put an item into List<Item>
628
which is then used in protocol.send_fields() when sending SHOW output to
632
class Item_empty_string :public Item_string
635
Item_empty_string(const char *header,uint32_t length, const CHARSET_INFO * cs= NULL) :
636
Item_string("",0, cs ? cs : &my_charset_utf8_general_ci)
637
{ name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; }
638
void make_field(Send_field *field);
642
class Item_return_int :public Item_int
644
enum_field_types int_field_type;
646
Item_return_int(const char *name_arg, uint32_t length,
647
enum_field_types field_type_arg, int64_t value= 0)
648
:Item_int(name_arg, value, length), int_field_type(field_type_arg)
652
enum_field_types field_type() const { return int_field_type; }
656
class Item_hex_string: public Item_basic_constant
660
Item_hex_string(const char *str,uint32_t str_length);
661
enum Type type() const { return VARBIN_ITEM; }
665
return (double) (uint64_t) Item_hex_string::val_int();
668
bool basic_const_item() const { return 1; }
669
String *val_str(String*) { assert(fixed == 1); return &str_value; }
670
my_decimal *val_decimal(my_decimal *);
671
int save_in_field(Field *field, bool no_conversions);
672
enum Item_result result_type () const { return STRING_RESULT; }
673
enum Item_result cast_to_int_type() const { return INT_RESULT; }
674
enum_field_types field_type() const { return DRIZZLE_TYPE_VARCHAR; }
675
virtual void print(String *str, enum_query_type query_type);
676
bool eq(const Item *item, bool binary_cmp) const;
677
virtual Item *safe_charset_converter(const CHARSET_INFO * const tocs);
678
bool check_vcol_func_processor(unsigned char *)
683
class Item_bin_string: public Item_hex_string
686
Item_bin_string(const char *str,uint32_t str_length);
689
class Item_result_field :public Item /* Item with result field */
692
Field *result_field; /* Save result here */
693
Item_result_field() :result_field(0) {}
694
// Constructor used for Item_sum/Item_cond_and/or (see Item comment)
695
Item_result_field(Session *session, Item_result_field *item):
696
Item(session, item), result_field(item->result_field)
698
~Item_result_field() {} /* Required with gcc 2.95 */
699
Field *get_tmp_table_field() { return result_field; }
700
Field *tmp_table_field(Table *)
701
{ return result_field; }
702
table_map used_tables() const { return 1; }
703
virtual void fix_length_and_dec()=0;
704
void set_result_field(Field *field) { result_field= field; }
705
bool is_result_field() { return 1; }
706
void save_in_result_field(bool no_conversions)
708
save_in_field(result_field, no_conversions);
711
bool check_vcol_func_processor(unsigned char *)
716
class Item_ref :public Item_ident
719
void set_properties();
721
enum Ref_Type { REF, DIRECT_REF, OUTER_REF };
722
Field *result_field; /* Save result here */
724
Item_ref(Name_resolution_context *context_arg,
725
const char *db_arg, const char *table_name_arg,
726
const char *field_name_arg)
727
:Item_ident(context_arg, db_arg, table_name_arg, field_name_arg),
728
result_field(0), ref(0) {}
730
This constructor is used in two scenarios:
732
No initialization is performed, fix_fields() call will be necessary.
734
B) *item points to an Item this Item_ref will refer to. This is
735
used for GROUP BY. fix_fields() will not be called in this case,
736
so we call set_properties to make this item "fixed". set_properties
737
performs a subset of action Item_ref::fix_fields does, and this subset
738
is enough for Item_ref's used in GROUP BY.
740
TODO we probably fix a superset of problems like in BUG#6658. Check this
741
with Bar, and if we have a more broader set of problems like this.
743
Item_ref(Name_resolution_context *context_arg, Item **item,
744
const char *table_name_arg, const char *field_name_arg,
745
bool alias_name_used_arg= false);
747
/* Constructor need to process subselect with temporary tables (see Item) */
748
Item_ref(Session *session, Item_ref *item)
749
:Item_ident(session, item), result_field(item->result_field), ref(item->ref) {}
750
enum Type type() const { return REF_ITEM; }
751
bool eq(const Item *item, bool binary_cmp) const
753
Item *it= ((Item *) item)->real_item();
754
return ref && (*ref)->eq(it, binary_cmp);
758
my_decimal *val_decimal(my_decimal *);
760
String *val_str(String* tmp);
762
bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate);
764
int64_t val_int_result();
765
String *str_result(String* tmp);
766
my_decimal *val_decimal_result(my_decimal *);
767
bool val_bool_result();
768
bool send(Protocol *prot, String *tmp);
769
void make_field(Send_field *field);
770
bool fix_fields(Session *, Item **);
771
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
772
int save_in_field(Field *field, bool no_conversions);
773
void save_org_in_field(Field *field);
774
enum Item_result result_type () const { return (*ref)->result_type(); }
775
enum_field_types field_type() const { return (*ref)->field_type(); }
776
Field *get_tmp_table_field()
777
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); }
778
Item *get_tmp_table_item(Session *session);
779
table_map used_tables() const
781
return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
783
void update_used_tables()
786
(*ref)->update_used_tables();
788
table_map not_null_tables() const { return (*ref)->not_null_tables(); }
789
void set_result_field(Field *field) { result_field= field; }
790
bool is_result_field() { return 1; }
791
void save_in_result_field(bool no_conversions)
793
(*ref)->save_in_field(result_field, no_conversions);
797
return ref ? (*ref)->real_item() : this;
799
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
800
{ return (*ref)->walk(processor, walk_subquery, arg); }
801
virtual void print(String *str, enum_query_type query_type);
802
bool result_as_int64_t()
804
return (*ref)->result_as_int64_t();
807
Item_field *filed_for_view_update()
808
{ return (*ref)->filed_for_view_update(); }
809
virtual Ref_Type ref_type() { return REF; }
811
// Row emulation: forwarding of ROW-related calls to ref
814
return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
816
Item* element_index(uint32_t i)
818
return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this;
820
Item** addr(uint32_t i)
822
return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0;
824
bool check_cols(uint32_t c)
826
return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
827
: Item::check_cols(c);
831
return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
835
if (ref && result_type() == ROW_RESULT)
836
(*ref)->bring_value();
843
622
The same as Item_ref, but get value from val_* family of method to get
844
623
value of item on which it referred instead of result* family.