summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-07-31 12:50:24 +0300
committerGeorgi Kodinov <kgeorge@mysql.com>2008-07-31 12:50:24 +0300
commita3cd2e2dab67a8d4abbd3c13e2455296a3304c56 (patch)
tree2e7e23931eb91a7bab8ab8e7eb00c76c31801859 /sql/item_cmpfunc.cc
parent686ced5367e6c76ecc8d874a5c8b2137b45e769a (diff)
parentb19155258e5e9ae40735c71234277dfc05092ec4 (diff)
downloadmariadb-git-a3cd2e2dab67a8d4abbd3c13e2455296a3304c56.tar.gz
merged 34159 and 37662 5.0-bugteam->5.1-bugteam
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 28e55eef5bd..c76bbececef 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2163,8 +2163,11 @@ Item_func_ifnull::fix_length_and_dec()
uint Item_func_ifnull::decimal_precision() const
{
- int max_int_part=max(args[0]->decimal_int_part(),args[1]->decimal_int_part());
- return min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
+ int arg0_int_part= args[0]->decimal_int_part();
+ int arg1_int_part= args[1]->decimal_int_part();
+ int max_int_part= max(arg0_int_part, arg1_int_part);
+ int precision= max_int_part + decimals;
+ return min(precision, DECIMAL_MAX_PRECISION);
}
@@ -2345,8 +2348,9 @@ Item_func_if::fix_length_and_dec()
uint Item_func_if::decimal_precision() const
{
- int precision=(max(args[1]->decimal_int_part(),args[2]->decimal_int_part())+
- decimals);
+ int arg1_prec= args[1]->decimal_int_part();
+ int arg2_prec= args[2]->decimal_int_part();
+ int precision=max(arg1_prec,arg2_prec) + decimals;
return min(precision, DECIMAL_MAX_PRECISION);
}