summaryrefslogtreecommitdiff
path: root/sql/item_sum.h
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2010-02-01 08:14:12 +0200
committerunknown <sanja@askmonty.org>2010-02-01 08:14:12 +0200
commite5099a2c85468d01d084b1071f724bc20766271d (patch)
tree50e180dfcaa058cefb382d2ab931592cddbd007d /sql/item_sum.h
parentf83113df07d6ef8e8a6d1db8f6dc3bb90fb0652a (diff)
parente9bce6c9d4bde35306b845e22e9b5ada69c4512f (diff)
downloadmariadb-git-e5099a2c85468d01d084b1071f724bc20766271d.tar.gz
merge 5.1->5.2
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r--sql/item_sum.h37
1 files changed, 14 insertions, 23 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h
index d0723fa0ab0..67400ae6fe2 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -329,22 +329,6 @@ public:
virtual void update_field()=0;
virtual bool keep_field_type(void) const { return 0; }
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
- /*
- This method is used for debug purposes to print the name of an
- item to the debug log. The second use of this method is as
- a helper function of print(), where it is applicable.
- To suit both goals it should return a meaningful,
- distinguishable and sintactically correct string. This method
- should not be used for runtime type identification, use enum
- {Sum}Functype and Item_func::functype()/Item_sum::sum_func()
- instead.
-
- NOTE: for Items inherited from Item_sum, func_name() return part of
- function name till first argument (including '(') to make difference in
- names for functions with 'distinct' clause and without 'distinct' and
- also to make printing of items inherited from Item_sum uniform.
- */
- virtual const char *func_name() const= 0;
virtual Item *result_item(Field *field)
{ return new Item_field(field); }
/*
@@ -687,6 +671,7 @@ public:
{
return trace_unsupported_by_check_vcol_func_processor("avg_field");
}
+ const char *func_name() const { DBUG_ASSERT(0); return "avg_field"; }
};
@@ -759,6 +744,7 @@ public:
{
return trace_unsupported_by_check_vcol_func_processor("var_field");
}
+ const char *func_name() const { DBUG_ASSERT(0); return "variance_field"; }
};
@@ -834,6 +820,7 @@ public:
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type () const { return REAL_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
+ const char *func_name() const { DBUG_ASSERT(0); return "std_field"; }
};
/*
@@ -859,14 +846,13 @@ 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
{
protected:
- String value,tmp_value;
- double sum;
- longlong sum_int;
- my_decimal sum_dec;
+ Item_cache *value;
+ Arg_comparator *cmp;
Item_result hybrid_type;
enum_field_types hybrid_field_type;
int cmp_sign;
@@ -874,12 +860,17 @@ protected:
public:
Item_sum_hybrid(Item *item_par,int sign)
- :Item_sum(item_par), sum(0.0), sum_int(0),
+ :Item_sum(item_par), value(0), cmp(0),
hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
cmp_sign(sign), was_values(TRUE)
{ collation.set(&my_charset_bin); }
- Item_sum_hybrid(THD *thd, Item_sum_hybrid *item);
+ Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
+ :Item_sum(thd, item), value(item->value), hybrid_type(item->hybrid_type),
+ hybrid_field_type(item->hybrid_field_type), cmp_sign(item->cmp_sign),
+ was_values(item->was_values)
+ { }
bool fix_fields(THD *, Item **);
+ void setup(Item *item, Item *value_arg);
void clear();
double val_real();
longlong val_int();