summaryrefslogtreecommitdiff
path: root/sql/item_sum.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-30 16:04:24 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-30 16:04:24 +0400
commitcb2c799bd064a6204b35d102efb5409decc2cb5b (patch)
treeb56762bab860a6d146896700d17f2baf53a15d4f /sql/item_sum.h
parentcc9cfecab78bde9376e4406bf24506e92fdaaeac (diff)
downloadmariadb-git-cb2c799bd064a6204b35d102efb5409decc2cb5b.tar.gz
MDEV-8860 Wrong result for WHERE 2016 < SOME (SELECT CAST(time_column AS DATETIME) FROM t1)
MDEV-8875 Wrong metadata for MAX(CAST(time_column AS DATETIME))
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r--sql/item_sum.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 01a580d03cb..2cf6c7fbe39 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1027,26 +1027,26 @@ class Item_sum_std :public Item_sum_variance
// This class is a string or number function depending on num_func
class Arg_comparator;
class Item_cache;
-class Item_sum_hybrid :public Item_sum
+class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
{
protected:
Item_cache *value, *arg_cache;
Arg_comparator *cmp;
- Item_result hybrid_type;
- enum_field_types hybrid_field_type;
int cmp_sign;
bool was_values; // Set if we have found at least one row (for max/min only)
bool was_null_value;
public:
Item_sum_hybrid(THD *thd, Item *item_par,int sign):
- Item_sum(thd, item_par), value(0), arg_cache(0), cmp(0),
- hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
+ Item_sum(thd, item_par),
+ Type_handler_hybrid_field_type(MYSQL_TYPE_LONGLONG),
+ value(0), arg_cache(0), cmp(0),
cmp_sign(sign), was_values(TRUE)
{ collation.set(&my_charset_bin); }
Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
- :Item_sum(thd, item), value(item->value), arg_cache(0),
- hybrid_type(item->hybrid_type), hybrid_field_type(item->hybrid_field_type),
+ :Item_sum(thd, item),
+ Type_handler_hybrid_field_type(item),
+ value(item->value), arg_cache(0),
cmp_sign(item->cmp_sign), was_values(item->was_values)
{ }
bool fix_fields(THD *, Item **);
@@ -1058,8 +1058,12 @@ protected:
void reset_field();
String *val_str(String *);
bool keep_field_type(void) const { return 1; }
- enum Item_result result_type () const { return hybrid_type; }
- enum enum_field_types field_type() const { return hybrid_field_type; }
+ enum Item_result result_type () const
+ { return Type_handler_hybrid_field_type::result_type(); }
+ enum Item_result cmp_type () const
+ { return Type_handler_hybrid_field_type::cmp_type(); }
+ enum enum_field_types field_type() const
+ { return Type_handler_hybrid_field_type::field_type(); }
void update_field();
void min_max_update_str_field();
void min_max_update_real_field();