summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2007-04-28 20:01:01 +0400
committerunknown <kaa@polly.local>2007-04-28 20:01:01 +0400
commit38090df9b566da89942f8a90fe71a3fac31efb9d (patch)
treeb924ace3abe3cc30cdcc61b16cf06ad656fd2ad8 /sql/item_func.h
parenta491b2c116411d4c15aae04f3b0023cf92e97804 (diff)
downloadmariadb-git-38090df9b566da89942f8a90fe71a3fac31efb9d.tar.gz
Fix for bug #24912 "problems with bigint in abs() ceiling() round() truncate() mod()" and a number of related problems:
- unsigned flag was not handled correctly for a number of mathematical funcions, which led to incorrect results - passing large values as the number of decimals to ROUND() resulted in incorrect results and even server crashes in some cases - reverted the fix and the testcase for bug #10083 as it violates the manual - fixed some testcases which relied on broken ROUND() behavior mysql-test/r/func_math.result: - Removed the testcase for bug #10083 (not a bug according to the manual) - Changed the testcase for bug #9837 to expect a correct ROUND() behavior - Added testcases for bug #24912 and all related bugs found mysql-test/r/type_newdecimal.result: Fixed a truncate() testcase which relied on broken behavior mysql-test/t/func_math.test: - Removed the testcase for bug #10083 (not a bug according to the manual) - Changed the testcase for bug #9837 to expect a correct ROUND() behavior - Added testcases for bug #24912 and all related bugs found sql/item_func.cc: Various changes to fix bug #24912 and all related bugs found: - honor unsigned_flag in various Item_* functions - correctly handle out-of-range numbers of decimals in Item_func_round::fix_length_and_dec() - changed the argument specifying the number of decimals in my_double_round() from int to longlong, added a new argument to pass the 'unsigned flag' - changed my_double_round() to correctly handle large values passed as the 'number of decimals' argument - added a my_double_round() analog for BIGINT UNSIGNED arguments (my_unsigned_round()) - fixed Item_func_round()::int_op() to not overflow even when the result is within integer range - fixed a bug Item_founc_round()::decimal_op() which resulted in crash when a large number of decimals was passed to my_decimal_round() sql/item_func.h: Various fixed to correctly handle unsigned values. sql/item_strfunc.cc: Changed the call to my_double_round() to match the new declaration. sql/mysql_priv.h: Changed the declaration for my_double_round() to be able pass arbitrary integers as number of decimals (both signed and unsigned)
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index 68591f9c6f5..237a173212e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -278,7 +278,7 @@ public:
{ max_length= 21; }
Item_int_func(List<Item> &list) :Item_func(list) { max_length= 21; }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
+ double val_real();
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() {}
@@ -303,12 +303,6 @@ class Item_func_signed :public Item_int_func
public:
Item_func_signed(Item *a) :Item_int_func(a) {}
const char *func_name() const { return "cast_as_signed"; }
- double val_real()
- {
- double tmp= args[0]->val_real();
- null_value= args[0]->null_value;
- return tmp;
- }
longlong val_int();
longlong val_int_from_str(int *error);
void fix_length_and_dec()