summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/deer.(none)>2006-10-30 09:52:50 +0400
committerunknown <holyfoot/hf@mysql.com/deer.(none)>2006-10-30 09:52:50 +0400
commitf00e6bd75d24e311016cd72449ed678c0172f6e6 (patch)
tree86315d20c86fe768ca64b21051234bd0285454d0 /sql/item_func.cc
parentab133655360a284567b74be79765031493823479 (diff)
downloadmariadb-git-f00e6bd75d24e311016cd72449ed678c0172f6e6.tar.gz
Bug #8663 (cant use bigint as input to CAST)
decimal->ulong conversion fixed to assign max possible ULONG if decimal is bigger Item_func_unsigned now handles DECIMAL parameter separately as we can't rely on decimal::val_int result here. mysql-test/r/type_newdecimal.result: result fixed mysql-test/t/type_newdecimal.test: testcase sql/item_func.cc: DECIMAL_RESULT should be handled separately here as it's always signed. strings/decimal.c: here we assign max possible ULONG if the decimal value is bigger
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a294bbd7a71..38294d52a5b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -964,7 +964,14 @@ longlong Item_func_unsigned::val_int()
longlong value;
int error;
- if (args[0]->cast_to_int_type() != STRING_RESULT)
+ if (args[0]->cast_to_int_type() == DECIMAL_RESULT)
+ {
+ my_decimal tmp, *dec= args[0]->val_decimal(&tmp);
+ if (!(null_value= args[0]->null_value))
+ my_decimal2int(E_DEC_FATAL_ERROR, dec, 1, &value);
+ return value;
+ }
+ else if (args[0]->cast_to_int_type() != STRING_RESULT)
{
value= args[0]->val_int();
null_value= args[0]->null_value;