summaryrefslogtreecommitdiff
path: root/sql/item_sum.h
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-07-31 22:39:10 +0200
committerunknown <serg@serg.mylan>2004-07-31 22:39:10 +0200
commit9ca47d047e5164515eac6fcae05ae9450cb94213 (patch)
treecf7939bc79abe785fb770d14f5f7efac88a3349e /sql/item_sum.h
parent42ed0103c8cac51d84c9fdf339058a85667cd19a (diff)
downloadmariadb-git-9ca47d047e5164515eac6fcae05ae9450cb94213.tar.gz
BUG#4393, BUG#4356 - incorrect decimals in fix_length_and_dec() in some functions
mysql-test/mysql-test-run.sh: report failed test name mysql-test/r/func_math.result: test results fixed
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) {}