diff options
author | Alexander Barkov <bar@mnogosearch.org> | 2013-09-10 10:08:11 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mnogosearch.org> | 2013-09-10 10:08:11 +0400 |
commit | 8b5da9f73b4af8e5a11fdddc402da822d3df8d93 (patch) | |
tree | f798f6c91602a458e9fa36544e2cf6c3b2a6e0cc /sql/item_cmpfunc.h | |
parent | 42f56557f59705aeec83a54f02399b04d52e9eea (diff) | |
parent | c2b38529a9ca2ea09dfa73186d9350a0d6dcd6ac (diff) | |
download | mariadb-git-8b5da9f73b4af8e5a11fdddc402da822d3df8d93.tar.gz |
Merge from 5.3
pending merges:
Alexander Barkov 2013-09-09 MDEV-4863 COALESCE(time_or_datetime) returns...
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 251d06499bf..fc66b985925 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -734,24 +734,19 @@ public: }; -class Item_func_coalesce :public Item_func_numhybrid +class Item_func_coalesce :public Item_func_hybrid_field_type { -protected: - enum_field_types cached_field_type; - Item_func_coalesce(Item *a, Item *b) :Item_func_numhybrid(a, b) {} public: - Item_func_coalesce(List<Item> &list) :Item_func_numhybrid(list) {} + Item_func_coalesce(Item *a, Item *b) :Item_func_hybrid_field_type(a, b) {} + Item_func_coalesce(List<Item> &list) :Item_func_hybrid_field_type(list) {} double real_op(); longlong int_op(); String *str_op(String *); my_decimal *decimal_op(my_decimal *); + bool date_op(MYSQL_TIME *ltime,uint fuzzydate); void fix_length_and_dec(); - void find_num_type() {} - enum Item_result result_type () const { return hybrid_type; } const char *func_name() const { return "coalesce"; } table_map not_null_tables() const { return 0; } - enum_field_types field_type() const { return cached_field_type; } - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); }; @@ -765,7 +760,7 @@ public: longlong int_op(); String *str_op(String *str); my_decimal *decimal_op(my_decimal *); - enum_field_types field_type() const; + bool date_op(MYSQL_TIME *ltime,uint fuzzydate); void fix_length_and_dec(); void update_used_tables() { @@ -778,20 +773,17 @@ public: }; -class Item_func_if :public Item_func +class Item_func_if :public Item_func_hybrid_field_type { - enum Item_result cached_result_type; - enum_field_types cached_field_type; public: Item_func_if(Item *a,Item *b,Item *c) - :Item_func(a,b,c), cached_result_type(INT_RESULT) + :Item_func_hybrid_field_type(a,b,c) {} - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - enum Item_result result_type () const { return cached_result_type; } - enum_field_types field_type() const { return cached_field_type; } + bool date_op(MYSQL_TIME *ltime, uint fuzzydate); + longlong int_op(); + double real_op(); + my_decimal *decimal_op(my_decimal *); + String *str_op(String *); bool fix_fields(THD *, Item **); void fix_length_and_dec(); void update_used_tables() @@ -1228,21 +1220,20 @@ public: function and only comparators for there result types are used. */ -class Item_func_case :public Item_func +class Item_func_case :public Item_func_hybrid_field_type { int first_expr_num, else_expr_num; - enum Item_result cached_result_type, left_result_type; + enum Item_result left_result_type; String tmp_value; uint ncases; Item_result cmp_type; DTCollation cmp_collation; - enum_field_types cached_field_type; cmp_item *cmp_items[6]; /* For all result types */ cmp_item *case_item; public: Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg) - :Item_func(), first_expr_num(-1), else_expr_num(-1), - cached_result_type(INT_RESULT), left_result_type(INT_RESULT), case_item(0) + :Item_func_hybrid_field_type(), first_expr_num(-1), else_expr_num(-1), + left_result_type(INT_RESULT), case_item(0) { ncases= list.elements; if (first_expr_arg) @@ -1258,10 +1249,11 @@ public: set_arguments(list); bzero(&cmp_items, sizeof(cmp_items)); } - double val_real(); - longlong val_int(); - String *val_str(String *); - my_decimal *val_decimal(my_decimal *); + double real_op(); + longlong int_op(); + String *str_op(String *); + my_decimal *decimal_op(my_decimal *); + bool date_op(MYSQL_TIME *ltime, uint fuzzydate); bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec(); void update_used_tables() @@ -1272,8 +1264,6 @@ public: } uint decimal_precision() const; table_map not_null_tables() const { return 0; } - enum Item_result result_type () const { return cached_result_type; } - enum_field_types field_type() const { return cached_field_type; } const char *func_name() const { return "case"; } virtual void print(String *str, enum_query_type query_type); Item *find_item(String *str); |