165
165
virtual void div(Hybrid_type *val, ulonglong u) const
166
166
{ val->real/= ulonglong2double(u); }
168
virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const
168
virtual longlong val_int(Hybrid_type *val,
169
bool unsigned_flag __attribute__((__unused__))) const
169
170
{ return (longlong) rint(val->real); }
170
171
virtual double val_real(Hybrid_type *val) const { return val->real; }
171
172
virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const;
191
192
virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const;
192
193
virtual double val_real(Hybrid_type *val) const;
193
virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const
194
virtual my_decimal *val_decimal(Hybrid_type *val,
195
my_decimal *buf __attribute__((__unused__))) const
194
196
{ return &val->dec_buf[val->used_dec_buf_no]; }
195
197
virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const;
196
198
static const Hybrid_type_traits_decimal *instance();
213
215
virtual void div(Hybrid_type *val, ulonglong u) const
214
216
{ val->integer/= (longlong) u; }
216
virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const
218
virtual longlong val_int(Hybrid_type *val,
219
bool unsigned_flag __attribute__((__unused__))) const
217
220
{ return val->integer; }
218
221
virtual double val_real(Hybrid_type *val) const
219
222
{ return (double) val->integer; }
220
virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const
223
virtual my_decimal *val_decimal(Hybrid_type *val,
224
my_decimal *buf __attribute__((__unused__))) const
222
226
int2my_decimal(E_DEC_FATAL_ERROR, val->integer, 0, &val->dec_buf[2]);
223
227
return &val->dec_buf[2];
225
virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const
229
virtual String *val_str(Hybrid_type *val, String *buf,
230
uint8 decimals __attribute__((__unused__))) const
226
231
{ buf->set(val->integer, &my_charset_bin); return buf;}
227
232
static const Hybrid_type_traits_integer *instance();
228
233
Hybrid_type_traits_integer() {};
430
435
void operator=(Item &);
431
436
/* Cache of the result of is_expensive(). */
432
437
int8 is_expensive_cache;
433
virtual bool is_expensive_processor(uchar *arg) { return 0; }
438
virtual bool is_expensive_processor(uchar *arg __attribute__((__unused__)))
436
442
static void *operator new(size_t size)
437
443
{ return sql_alloc(size); }
438
444
static void *operator new(size_t size, MEM_ROOT *mem_root)
439
445
{ return alloc_root(mem_root, size); }
440
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
441
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
446
static void operator delete(void *ptr __attribute__((__unused__)),
447
size_t size __attribute__((__unused__)))
448
{ TRASH(ptr, size); }
449
static void operator delete(void *ptr __attribute__((__unused__)),
450
MEM_ROOT *mem_root __attribute__((__unused__)))
443
453
enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
444
454
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
510
520
Fix after some tables has been pulled out. Basically re-calculate all
511
521
attributes that are dependent on the tables.
513
virtual void fix_after_pullout(st_select_lex *new_parent, Item **ref) {};
523
virtual void fix_after_pullout(st_select_lex *new_parent __attribute__((__unused__)),
524
Item **ref __attribute__((__unused__))) {};
516
527
should be used in case where we are sure that we do not need
572
583
The output range bound, which equal to the value of val_int()
573
- If the value of the function is NULL then the bound is the
574
smallest possible value of LONGLONG_MIN
584
- If the value of the function is NULL then the bound is the
585
smallest possible value of LONGLONG_MIN
576
virtual longlong val_int_endpoint(bool left_endp, bool *incl_endp)
587
virtual longlong val_int_endpoint(bool left_endp __attribute__((__unused__)),
588
bool *incl_endp __attribute__((__unused__)))
577
589
{ DBUG_ASSERT(0); return 0; }
684
696
int save_date_in_field(Field *field);
685
697
int save_str_value_in_field(Field *field, String *result);
687
virtual Field *get_tmp_table_field() { return 0; }
699
virtual Field *get_tmp_table_field(void) { return 0; }
688
700
/* This is also used to create fields in CREATE ... SELECT: */
689
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; }
690
virtual const char *full_name() const { return name ? name : "???"; }
701
virtual Field *tmp_table_field(TABLE *t_arg __attribute__((__unused__)))
703
virtual const char *full_name(void) const { return name ? name : "???"; }
693
706
*result* family of methods is analog of *val* family (see above) but
752
765
query and why they should be generated from the Item-tree, @see
753
766
mysql_register_view().
755
virtual inline void print(String *str, enum_query_type query_type)
768
virtual inline void print(String *str,
769
enum_query_type query_type __attribute__((__unused__)))
757
771
str->append(full_name());
760
774
void print_item_w_name(String *, enum_query_type query_type);
761
775
virtual void update_used_tables() {}
762
virtual void split_sum_func(THD *thd, Item **ref_pointer_array,
763
List<Item> &fields) {}
776
virtual void split_sum_func(THD *thd __attribute__((__unused__)),
777
Item **ref_pointer_array __attribute__((__unused__)),
778
List<Item> &fields __attribute__((__unused__))) {}
764
779
/* Called for items that really have to be split */
765
780
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
766
781
Item **ref, bool skip_registered);
792
807
Item_cond_and and subquery-related item) enable special optimizations
793
808
when they are "top level".
795
virtual void top_level_item() {}
810
virtual void top_level_item(void) {}
797
812
set field of temporary table for Item which can be switched on temporary
798
813
table during query processing (grouping and so on)
800
virtual void set_result_field(Field *field) {}
801
virtual bool is_result_field() { return 0; }
802
virtual bool is_bool_func() { return 0; }
803
virtual void save_in_result_field(bool no_conversions) {}
815
virtual void set_result_field(Field *field __attribute__((__unused__))) {}
816
virtual bool is_result_field(void) { return 0; }
817
virtual bool is_bool_func(void) { return 0; }
818
virtual void save_in_result_field(bool no_conversions __attribute__((__unused__)))
805
821
set value of aggregate function in case of no rows for grouping were found
807
virtual void no_rows_in_result() {}
808
virtual Item *copy_or_same(THD *thd) { return this; }
809
virtual Item *copy_andor_structure(THD *thd) { return this; }
810
virtual Item *real_item() { return this; }
823
virtual void no_rows_in_result(void) {}
824
virtual Item *copy_or_same(THD *thd __attribute__((__unused__)))
826
virtual Item *copy_andor_structure(THD *thd __attribute__((__unused__)))
828
virtual Item *real_item(void) { return this; }
811
829
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
813
831
static CHARSET_INFO *default_charset();
814
832
virtual CHARSET_INFO *compare_collation() { return NULL; }
816
virtual bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
834
virtual bool walk(Item_processor processor __attribute__((__unused__)),
835
bool walk_subquery __attribute__((__unused__)),
818
838
return (this->*processor)(arg);
847
virtual void traverse_cond(Cond_traverser traverser,
848
void *arg, traverse_order order)
867
virtual void traverse_cond(Cond_traverser traverser __attribute__((__unused__)),
869
traverse_order order __attribute__((__unused__)))
850
871
(*traverser)(this, arg);
853
virtual bool remove_dependence_processor(uchar * arg) { return 0; }
854
virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; }
855
virtual bool cleanup_processor(uchar *arg);
856
virtual bool collect_item_field_processor(uchar * arg) { return 0; }
857
virtual bool find_item_in_field_list_processor(uchar *arg) { return 0; }
858
virtual bool change_context_processor(uchar *context) { return 0; }
859
virtual bool reset_query_id_processor(uchar *query_id_arg) { return 0; }
860
virtual bool register_field_in_read_map(uchar *arg) { return 0; }
874
virtual bool remove_dependence_processor(uchar * arg __attribute__((__unused__)))
876
virtual bool remove_fixed(uchar * arg __attribute__((__unused__)))
881
virtual bool cleanup_processor(uchar *arg __attribute__((__unused__)));
882
virtual bool collect_item_field_processor(uchar * arg __attribute__((__unused__)))
884
virtual bool find_item_in_field_list_processor(uchar *arg __attribute__((__unused__)))
886
virtual bool change_context_processor(uchar *context __attribute__((__unused__)))
888
virtual bool reset_query_id_processor(uchar *query_id_arg __attribute__((__unused__)))
890
virtual bool register_field_in_read_map(uchar *arg __attribute__((__unused__)))
861
892
virtual bool subst_argument_checker(uchar **arg)
868
virtual Item *equal_fields_propagator(uchar * arg) { return this; }
869
virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
870
virtual Item *replace_equal_field(uchar * arg) { return this; }
899
virtual Item *equal_fields_propagator(uchar * arg __attribute__((__unused__))) { return this; }
900
virtual bool set_no_const_sub(uchar *arg __attribute__((__unused__))) { return false; }
901
virtual Item *replace_equal_field(uchar * arg __attribute__((__unused__))) { return this; }
873
904
For SP local variable returns pointer to Item representing its
874
905
current value and pointer to current Item otherwise.
876
virtual Item *this_item() { return this; }
877
virtual const Item *this_item() const { return this; }
907
virtual Item *this_item(void) { return this; }
908
virtual const Item *this_item(void) const { return this; }
880
911
For SP local variable returns address of pointer to Item representing its
881
912
current value and pointer passed via parameter otherwise.
883
virtual Item **this_item_addr(THD *thd, Item **addr_arg) { return addr_arg; }
914
virtual Item **this_item_addr(THD *thd __attribute__((__unused__)), Item **addr_arg) { return addr_arg; }
886
917
virtual uint cols() { return 1; }
887
virtual Item* element_index(uint i) { return this; }
888
virtual Item** addr(uint i) { return 0; }
918
virtual Item* element_index(uint i __attribute__((__unused__))) { return this; }
919
virtual Item** addr(uint i __attribute__((__unused__))) { return 0; }
889
920
virtual bool check_cols(uint c);
890
921
// It is not row => null inside is impossible
891
922
virtual bool null_inside() { return 0; }
895
926
Field *tmp_table_field_from_field_type(TABLE *table, bool fixed_length);
896
927
virtual Item_field *filed_for_view_update() { return 0; }
898
virtual Item *neg_transformer(THD *thd) { return NULL; }
899
virtual Item *update_value_transformer(uchar *select_arg) { return this; }
929
virtual Item *neg_transformer(THD *thd __attribute__((__unused__))) { return NULL; }
930
virtual Item *update_value_transformer(uchar *select_arg __attribute__((__unused__))) { return this; }
900
931
virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
901
932
void delete_self()
1116
1147
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
1117
1148
Field *get_tmp_table_field() { return result_field; }
1118
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
1149
Field *tmp_table_field(TABLE *t_arg __attribute__((__unused__))) { return result_field; }
1119
1150
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
1120
1151
bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate);
1121
1152
bool get_time(MYSQL_TIME *ltime);
1744
1779
~Item_result_field() {} /* Required with gcc 2.95 */
1745
1780
Field *get_tmp_table_field() { return result_field; }
1746
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
1781
Field *tmp_table_field(TABLE *t_arg __attribute__((__unused__)))
1782
{ return result_field; }
1747
1783
table_map used_tables() const { return 1; }
1748
1784
virtual void fix_length_and_dec()=0;
1749
1785
void set_result_field(Field *field) { result_field= field; }
2101
2137
my_decimal *val_decimal(my_decimal *);
2102
2138
void make_field(Send_field *field) { item->make_field(field); }
2104
int save_in_field(Field *field, bool no_conversions)
2140
int save_in_field(Field *field,
2141
bool no_conversions __attribute__((__unused__)))
2106
2143
return save_str_value_in_field(field, &str_value);