diff options
author | serg@serg.mylan <> | 2004-07-31 22:39:10 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2004-07-31 22:39:10 +0200 |
commit | 22ca5582d005754d3907ce6bc088ba2d9710d1eb (patch) | |
tree | cf7939bc79abe785fb770d14f5f7efac88a3349e /sql/item_sum.h | |
parent | ebd3745c8cfaae6998f702c74063828b54b0690d (diff) | |
download | mariadb-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.h | 12 |
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) {} |