diff options
author | unknown <evgen@moonbone.local> | 2007-05-08 15:54:49 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-05-08 15:54:49 +0400 |
commit | 58a2274187f394cc1ccd9b331356069bfe05af2a (patch) | |
tree | c21fe5ea88d116da87702aa338dee3c533148c18 /sql/item_cmpfunc.h | |
parent | 4fbd484ed5e7010559639b0607532259719c9c11 (diff) | |
parent | be5ff3e2ba4ddf32241348de6184be0172d34a37 (diff) | |
download | mariadb-git-58a2274187f394cc1ccd9b331356069bfe05af2a.tar.gz |
Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
mysql-test/r/func_in.result:
Auto merged
mysql-test/r/insert_update.result:
Auto merged
mysql-test/r/type_datetime.result:
Auto merged
mysql-test/t/insert_update.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/handler.cc:
Manual merge
sql/item_cmpfunc.cc:
Manual merge
sql/item_cmpfunc.h:
Manual merge
sql/item_func.h:
Manual merge
sql/sql_class.h:
Manual merge
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 132 |
1 files changed, 106 insertions, 26 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7aede7d2954..2f45fcfb23b 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -798,6 +798,7 @@ public: class in_longlong :public in_vector { +protected: /* Here we declare a temporary variable (tmp) of the same type as the elements of this vector. tmp is used in finding if a given value is in @@ -832,6 +833,30 @@ public: friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); }; + +/* + Class to represent a vector of constant DATE/DATETIME values. + Values are obtained with help of the get_datetime_value() function. + If the left item is a constant one then its value is cached in the + lval_cache variable. +*/ +class in_datetime :public in_longlong +{ +public: + THD *thd; + /* An item used to issue warnings. */ + Item *warn_item; + /* Cache for the left item. */ + Item *lval_cache; + + in_datetime(Item *warn_item_arg, uint elements) + :in_longlong(elements), thd(current_thd), warn_item(warn_item_arg), + lval_cache(0) {}; + void set(uint pos,Item *item); + byte *get_value(Item *item); + friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); +}; + class in_double :public in_vector { double tmp; @@ -964,6 +989,30 @@ public: cmp_item *make_same(); }; +/* + Compare items in the DATETIME context. + Values are obtained with help of the get_datetime_value() function. + If the left item is a constant one then its value is cached in the + lval_cache variable. +*/ +class cmp_item_datetime :public cmp_item +{ + ulonglong value; +public: + THD *thd; + /* Item used for issuing warnings. */ + Item *warn_item; + /* Cache for the left item. */ + Item *lval_cache; + + cmp_item_datetime(Item *warn_item_arg) + :thd(current_thd), warn_item(warn_item_arg), lval_cache(0) {} + void store_value(Item *item); + int cmp(Item *arg); + int compare(cmp_item *ci); + cmp_item *make_same(); +}; + class cmp_item_real :public cmp_item { double value; @@ -998,32 +1047,6 @@ public: }; -class cmp_item_row :public cmp_item -{ - cmp_item **comparators; - uint n; -public: - cmp_item_row(): comparators(0), n(0) {} - ~cmp_item_row(); - void store_value(Item *item); - int cmp(Item *arg); - int compare(cmp_item *arg); - cmp_item *make_same(); - void store_value_by_template(cmp_item *tmpl, Item *); -}; - - -class in_row :public in_vector -{ - cmp_item_row tmp; -public: - in_row(uint elements, Item *); - ~in_row(); - void set(uint pos,Item *item); - byte *get_value(Item *item); - Item_result result_type() { return ROW_RESULT; } -}; - /* cmp_item for optimized IN with row (right part string, which never be changed) @@ -1202,6 +1225,63 @@ public: bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; +class cmp_item_row :public cmp_item +{ + cmp_item **comparators; + uint n; +public: + cmp_item_row(): comparators(0), n(0) {} + ~cmp_item_row(); + void store_value(Item *item); + inline void alloc_comparators(); + int cmp(Item *arg); + int compare(cmp_item *arg); + cmp_item *make_same(); + void store_value_by_template(cmp_item *tmpl, Item *); + friend void Item_func_in::fix_length_and_dec(); +}; + + +class in_row :public in_vector +{ + cmp_item_row tmp; +public: + in_row(uint elements, Item *); + ~in_row(); + void set(uint pos,Item *item); + byte *get_value(Item *item); + friend void Item_func_in::fix_length_and_dec(); + Item_resul result_type() { return ROW_RESULT; }; +}; + +class cmp_item_row :public cmp_item +{ + cmp_item **comparators; + uint n; +public: + cmp_item_row(): comparators(0), n(0) {} + ~cmp_item_row(); + void store_value(Item *item); + inline void alloc_comparators(); + int cmp(Item *arg); + int compare(cmp_item *arg); + cmp_item *make_same(); + void store_value_by_template(cmp_item *tmpl, Item *); + friend void Item_func_in::fix_length_and_dec(); +}; + + +class in_row :public in_vector +{ + cmp_item_row tmp; +public: + in_row(uint elements, Item *); + ~in_row(); + void set(uint pos,Item *item); + byte *get_value(Item *item); + friend void Item_func_in::fix_length_and_dec(); +}; + /* Functions used by where clause */ class Item_func_isnull :public Item_bool_func |