diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-11 17:42:50 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-11 17:42:50 +0500 |
commit | 563b1297bbeef6f162513be314676d0d2c39b4a9 (patch) | |
tree | d3fc9744bccf2a94ad294d208a2ca21689634954 /sql/item_func.cc | |
parent | 361905687e473a71083c5d3c69f3b939943cce7c (diff) | |
parent | 82b7c54338a3465790e4e64a647e82b9d7ea59b6 (diff) | |
download | mariadb-git-563b1297bbeef6f162513be314676d0d2c39b4a9.tar.gz |
Merge bk@192.168.21.1:mysql-5.0-opt
into mysql.com:/home/hf/work/27957/my50-27957
sql/item_func.cc:
Auto merged
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 7a31b564502..75412d6b129 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1050,9 +1050,32 @@ longlong Item_decimal_typecast::val_int() my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec) { my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf); + bool sign; if ((null_value= args[0]->null_value)) return NULL; my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec); + sign= dec->sign(); + if (unsigned_flag) + { + if (sign) + { + my_decimal_set_zero(dec); + goto err; + } + } + if (max_length - 2 - decimals < (uint) my_decimal_intg(dec)) + { + max_my_decimal(dec, max_length - 2, decimals); + dec->sign(sign); + goto err; + } + return dec; + +err: + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_WARN_DATA_OUT_OF_RANGE, + ER(ER_WARN_DATA_OUT_OF_RANGE), + name, 1); return dec; } |