diff options
author | unknown <bell@sanja.is.com.ua> | 2003-01-25 02:25:52 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-01-25 02:25:52 +0200 |
commit | d94eecbb92305f366983d938f3de586a7832a3c3 (patch) | |
tree | 043b4b5b889f0d8173b87b17f3de8dc3fbbb1dd2 /sql/item.h | |
parent | 950c44fbc8dde2cb1c18ce99c98a9861da30933e (diff) | |
download | mariadb-git-d94eecbb92305f366983d938f3de586a7832a3c3.tar.gz |
fixed subselects with temporary tables (SCRUM)
fixed memory leacks
mysql-test/r/subselect.result:
some changes in subselect tests
mysql-test/t/subselect.test:
some changes in subselect tests
sql/item.cc:
some item made copyable
methods for creating copy of item list
tmp_table_field() splited
sql/item.h:
some item made copyable
methods for creating copy of item list
tmp_table_field() splited
sql/item_cmpfunc.cc:
changed references creation
sql/item_cmpfunc.h:
changed references creation
sql/item_func.cc:
some item made copyable
methods for creating copy of item list
changed references creation
sql/item_func.h:
some item made copyable
methods for creating copy of item list
changed references creation
tmp_table_field() splited
sql/item_subselect.cc:
changed references creation
sql/item_sum.cc:
some item made copyable
methods for creating copy of item list
sql/item_sum.h:
some item made copyable
methods for creating copy of item list
sql/item_timefunc.h:
tmp_table_field() splited
sql/item_uniq.h:
some item made copyable
methods for creating copy of item list
sql/mysql_priv.h:
fixed subselects with temporary tables
sql/sql_base.cc:
fixed subselects with temporary tables
sql/sql_class.h:
fixed subselects with temporary tables
sql/sql_delete.cc:
fixed subselects with temporary tables
sql/sql_derived.cc:
fixed subselects with temporary tables
sql/sql_do.cc:
fixed subselects with temporary tables
sql/sql_insert.cc:
fixed subselects with temporary tables
sql/sql_lex.cc:
fixed subselects with temporary tables
sql/sql_lex.h:
fixed subselects with temporary tables
sql/sql_list.h:
fixed subselects with temporary tables
sql/sql_load.cc:
fixed subselects with temporary tables
sql/sql_olap.cc:
fixed subselects with temporary tables
sql/sql_parse.cc:
fixed subselects with temporary tables
sql/sql_prepare.cc:
fixed subselects with temporary tables
sql/sql_select.cc:
fixed subselects with temporary tables
sql/sql_select.h:
fixed subselects with temporary tables
sql/sql_table.cc:
fixed subselects with temporary tables
sql/sql_union.cc:
fixed subselects with temporary tables
sql/sql_update.cc:
fixed subselects with temporary tables
sql/sql_yacc.yy:
fixed subselects with temporary tables
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/sql/item.h b/sql/item.h index 4dff0591c09..900315a3bf6 100644 --- a/sql/item.h +++ b/sql/item.h @@ -50,6 +50,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); @@ -67,7 +69,8 @@ public: virtual longlong val_int()=0; virtual String *val_str(String*)=0; virtual void make_field(Send_field *field)=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(); } @@ -82,12 +85,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 ; } @@ -159,11 +164,14 @@ public: const char *table_name; const char *field_name; st_select_lex *depended_from; + Item_ident(const char *db_name_par,const char *table_name_par, const char *field_name_par) :db_name(db_name_par),table_name(table_name_par), field_name(field_name_par), depended_from(0) { name = (char*) field_name_par; } + // copy constructor used by Item_field & Item_ref + Item_ident(Item_ident &item); const char *full_name() const; }; @@ -179,6 +187,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; @@ -202,10 +212,12 @@ public: { return field->result_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(); }; @@ -448,8 +460,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; }; @@ -463,6 +480,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); } |