summaryrefslogtreecommitdiff
path: root/sql/item_sum.h
diff options
context:
space:
mode:
authorserg@serg.mylan <>2004-07-31 22:39:10 +0200
committerserg@serg.mylan <>2004-07-31 22:39:10 +0200
commit22ca5582d005754d3907ce6bc088ba2d9710d1eb (patch)
treecf7939bc79abe785fb770d14f5f7efac88a3349e /sql/item_sum.h
parentebd3745c8cfaae6998f702c74063828b54b0690d (diff)
downloadmariadb-git-22ca5582d005754d3907ce6bc088ba2d9710d1eb.tar.gz
BUG#4393, BUG#4356 - incorrect decimals in fix_length_and_dec() in some functions
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r--sql/item_sum.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 6835b1e8fae..802e3f1ba45 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -234,7 +234,11 @@ public:
class Item_sum_avg :public Item_sum_num
{
- void fix_length_and_dec() { decimals+=4; maybe_null=1; }
+ void fix_length_and_dec()
+ {
+ decimals=min(decimals+4, NOT_FIXED_DEC);
+ maybe_null=1;
+ }
double sum;
ulonglong count;
@@ -276,7 +280,11 @@ class Item_sum_std :public Item_sum_num
double sum;
double sum_sqr;
ulonglong count;
- void fix_length_and_dec() { decimals+=4; maybe_null=1; }
+ void fix_length_and_dec()
+ {
+ decimals=min(decimals+4, NOT_FIXED_DEC);
+ maybe_null=1;
+ }
public:
Item_sum_std(Item *item_par) :Item_sum_num(item_par),count(0) {}