diff options
author | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2007-01-18 17:10:00 +0400 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2007-01-18 17:10:00 +0400 |
commit | 445760d8458b0f5629015fb12179af87abeb6a4f (patch) | |
tree | cbe729d91bbe26620386d19aebf2958fa4e2ffae /sql | |
parent | 0a8ed58a7b3e5e1c42792f439e0314ed89252622 (diff) | |
parent | 356d156343cd343134578aa3dd8abc2b38969d8c (diff) | |
download | mariadb-git-445760d8458b0f5629015fb12179af87abeb6a4f.tar.gz |
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into mysql.com:/usr/home/ram/work/bug22533/my50-bug22533
mysql-test/r/type_bit.result:
Auto merged
mysql-test/t/select.test:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 2 | ||||
-rw-r--r-- | sql/item.cc | 25 |
2 files changed, 21 insertions, 6 deletions
diff --git a/sql/field.cc b/sql/field.cc index 32b2631d071..efe608b7bdd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8037,6 +8037,7 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7), bytes_in_rec(len_arg / 8) { + flags|= UNSIGNED_FLAG; /* Ensure that Field::eq() can distinguish between two different bit fields. (two bit fields that are not null, may have same ptr and null_ptr) @@ -8276,6 +8277,7 @@ Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg, : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0, 0, unireg_check_arg, field_name_arg, table_arg) { + flags|= UNSIGNED_FLAG; bit_len= 0; bytes_in_rec= (len_arg + 7) / 8; } diff --git a/sql/item.cc b/sql/item.cc index cc653a7db14..d73be7206d6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4553,18 +4553,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, TRUE); // Assume hex numbers are unsigned + +warn: + if (!field->store((longlong) nr, TRUE)) + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, + 1); + return 1; } |