diff options
author | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2007-01-18 09:39:47 +0400 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2007-01-18 09:39:47 +0400 |
commit | 2ca87ae30cb5a6edb629be35f8585e860acb11aa (patch) | |
tree | a9198331c9962c279bc2fc4b05565d29c98fa1b8 /sql | |
parent | be820c11d045345aaefea21ead49cfac60b1c31c (diff) | |
parent | 0ce02f6d98b5eb94797a935e06fa89f37a241b52 (diff) | |
download | mariadb-git-2ca87ae30cb5a6edb629be35f8585e860acb11aa.tar.gz |
Merge mysql.com:/usr/home/ram/work/bug22533/my41-bug22533
into mysql.com:/usr/home/ram/work/bug22533/my50-bug22533
mysql-test/r/select.result:
resolve skipped
mysql-test/t/range.test:
merging
mysql-test/t/select.test:
merging
sql/item.cc:
merging
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index d181edb4ecd..e5a888842ac 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4460,18 +4460,31 @@ my_decimal *Item_hex_string::val_decimal(my_decimal *decimal_value) int Item_hex_string::save_in_field(Field *field, bool no_conversions) { - int error; field->set_notnull(); if (field->result_type() == STRING_RESULT) + return field->store(str_value.ptr(), str_value.length(), + collation.collation); + + ulonglong nr; + uint32 length= str_value.length(); + if (length > 8) { - error=field->store(str_value.ptr(),str_value.length(),collation.collation); + nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX; + goto warn; } - else + nr= (ulonglong) val_int(); + if ((length == 8) && !(field->flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX)) { - longlong nr=val_int(); - error=field->store(nr, TRUE); // Assume hex numbers are unsigned + nr= LONGLONG_MAX; + goto warn; } - return error; + return field->store((longlong) nr); + +warn: + if (!field->store((longlong) nr)) + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, + 1); + return 1; } |