diff options
author | unknown <bell@sanja.is.com.ua> | 2003-01-28 15:34:59 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-01-28 15:34:59 +0200 |
commit | d7db6beec7e108290311f92107573e4506f680d8 (patch) | |
tree | b673163c5e5a1954a4b6351b9c75fc6ff05e31a0 /sql/item.h | |
parent | 7120b6688481605551408afd5c3ea5501658e9d8 (diff) | |
parent | ca0d06d599c7e174927a75720974dc457968be23 (diff) | |
download | mariadb-git-d7db6beec7e108290311f92107573e4506f680d8.tar.gz |
Merge
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/item.h:
SCCS merged
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/sql/item.h b/sql/item.h index 7aa33b25db8..ef8d722b76d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -53,6 +53,8 @@ public: // alloc & destruct is done as start of select using sql_alloc Item(); + // copy constructor used by Item_field, Item_ref & agregate (sum) functions + Item(Item &item); virtual ~Item() { name=0; } /*lint -e1509 */ void set_name(const char *str,uint length=0); void init_make_field(Send_field *tmp_field,enum enum_field_types type); @@ -71,7 +73,8 @@ public: virtual double val()=0; virtual longlong val_int()=0; virtual String *val_str(String*)=0; - virtual Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return 0; } + virtual Field *tmp_table_field() { return 0; } + virtual Field *tmp_table_field(TABLE *t_arg) { return 0; } virtual const char *full_name() const { return name ? name : "???"; } virtual double val_result() { return val(); } virtual longlong val_int_result() { return val_int(); } @@ -85,12 +88,14 @@ public: virtual bool const_item() const { return used_tables() == 0; } virtual void print(String *str_arg) { str_arg->append(full_name()); } virtual void update_used_tables() {} - virtual void split_sum_func(List<Item> &fields) {} + virtual void split_sum_func(Item **ref_pointer_array, List<Item> &fields) {} virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_time(TIME *ltime); virtual bool is_null() { return 0; }; virtual bool check_loop(uint id); virtual void top_level_item() {} + virtual Item * get_same() { return this; } + virtual Item * get_tmp_table_item() { return get_same(); } virtual bool binary() const { return str_value.charset()->state & MY_CS_BINSORT ? 1 : 0 ; } @@ -125,6 +130,8 @@ public: :db_name(db_name_par), table_name(table_name_par), field_name(field_name_par), depended_from(0), outer_resolving(0) { name = (char*) field_name_par; } + // copy constructor used by Item_field & Item_ref + Item_ident(Item_ident &item); const char *full_name() const; void set_outer_resolving() { outer_resolving= 1; } }; @@ -141,6 +148,8 @@ public: const char *field_name_par) :Item_ident(db_par,table_name_par,field_name_par),field(0),result_field(0) {} + // copy constructor need to process subselect with temporary tables + Item_field(Item_field &item); Item_field(Field *field); enum Type type() const { return FIELD_ITEM; } bool eq(const Item *item, bool binary_cmp) const; @@ -164,10 +173,12 @@ public: { return field->type(); } - Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; } + Field *tmp_table_field() { return result_field; } + Field *tmp_table_field(TABLE *t_arg) { return result_field; } bool get_date(TIME *ltime,bool fuzzydate); bool get_time(TIME *ltime); bool is_null() { return field->is_null(); } + Item * get_tmp_table_item(); friend class Item_default_value; }; @@ -427,8 +438,13 @@ class Item_result_field :public Item /* Item with result field */ public: Field *result_field; /* Save result here */ Item_result_field() :result_field(0) {} + Item_result_field(Item_result_field &item): Item(item) + { + result_field= item.result_field; + } ~Item_result_field() {} /* Required with gcc 2.95 */ - Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; } + Field *tmp_table_field() { return result_field; } + Field *tmp_table_field(TABLE *t_arg) { return result_field; } table_map used_tables() const { return 1; } virtual void fix_length_and_dec()=0; }; @@ -442,6 +458,8 @@ public: :Item_ident(db_par,table_name_par,field_name_par),ref(0) {} Item_ref(Item **item, char *table_name_par,char *field_name_par) :Item_ident(NullS,table_name_par,field_name_par),ref(item) {} + // copy constructor need to process subselect with temporary tables + Item_ref(Item_ref &item): Item_ident(item), ref(item.ref) {} enum Type type() const { return REF_ITEM; } bool eq(const Item *item, bool binary_cmp) const { return ref && (*ref)->eq(item, binary_cmp); } @@ -511,14 +529,14 @@ public: class Item_ref_on_list_position: public Item_ref_null_helper { protected: - List<Item> &list; + st_select_lex *select_lex; uint pos; public: Item_ref_on_list_position(Item_in_subselect* master, - List<Item> &li, uint num, + st_select_lex *sl, uint num, char *table_name, char *field_name): Item_ref_null_helper(master, 0, table_name, field_name), - list(li), pos(num) {} + select_lex(sl), pos(num) {} bool fix_fields(THD *, struct st_table_list *, Item ** ref); }; @@ -692,7 +710,12 @@ public: class Item_cache: public Item { + table_map used_table_map; public: + Item_cache(): used_table_map(0) {fixed= 1; null_value= 1;} + + void set_used_tables(table_map map) { used_table_map= map; } + virtual bool allocate(uint i) { return 0; }; virtual bool setup(Item *) { return 0; }; virtual void store(Item *)= 0; @@ -703,13 +726,14 @@ public: } enum Type type() const { return CACHE_ITEM; } static Item_cache* get_cache(Item_result type); + table_map used_tables() const { return used_table_map; } }; class Item_cache_int: public Item_cache { longlong value; public: - Item_cache_int() { fixed= 1; null_value= 1; } + Item_cache_int(): Item_cache() {} void store(Item *item) { @@ -726,7 +750,7 @@ class Item_cache_real: public Item_cache { double value; public: - Item_cache_real() { fixed= 1; null_value= 1; } + Item_cache_real(): Item_cache() {} void store(Item *item) { @@ -748,7 +772,7 @@ class Item_cache_str: public Item_cache char buffer[80]; String *value; public: - Item_cache_str() { fixed= 1; null_value= 1; } + Item_cache_str(): Item_cache() { } void store(Item *item); double val(); @@ -763,7 +787,7 @@ class Item_cache_row: public Item_cache Item_cache **values; uint item_count; public: - Item_cache_row(): values(0), item_count(2) { fixed= 1; null_value= 1; } + Item_cache_row(): Item_cache(), values(0), item_count(2) {} /* 'allocate' used only in row transformer, to preallocate space for row |