summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
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 16f3e51d615..1994f6bf1a5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2098,8 +2098,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);
}
@@ -2281,8 +2284,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);
}