diff options
author | unknown <jimw@mysql.com> | 2006-04-04 17:54:58 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2006-04-04 17:54:58 -0700 |
commit | b3b626c31cb6f09cc89e633f500a066af6ef2fb5 (patch) | |
tree | 470f8546a50589e9c092da9005875129175816e0 /sql/key.cc | |
parent | bfa21dd1520b2f718a1f1aa8c6256f62c91cfff8 (diff) | |
download | mariadb-git-b3b626c31cb6f09cc89e633f500a066af6ef2fb5.tar.gz |
Bug #13601: Wrong int type for bit
The wrong value was being reported as the field_length for BIT
fields, resulting in confusion for at least Connector/J. The
field_length is now always the number of bits in the field, as
it should be.
mysql-test/r/type_bit.result:
Add new results
mysql-test/r/type_bit_innodb.result:
Add new results
mysql-test/t/type_bit.test:
Add new regression test
mysql-test/t/type_bit_innodb.test:
Add new regression test
sql/field.cc:
Fix Field_bit->field_length to actually report the display width, and
store the bytes stored in the rec in the new bytes_in_rec member.
sql/field.h:
Fix Field_bit::field_length to store the correct value, adding
Field_bit::bytes_in_rec to remember the number of bytes used for
storing the value. Remove Field_bit_as_char::create_length, as it
is now redundant.
sql/ha_ndbcluster.cc:
Handle field_length of Field_bit actually being the display width (# of bits).
sql/key.cc:
Fix inappropriate use of field->field_length for BIT field.
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/key.cc b/sql/key.cc index 9d86095f33e..75161e4f616 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -192,7 +192,8 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, Field_bit *field= (Field_bit *) (key_part->field); if (field->bit_len) { - uchar bits= *(from_key + key_part->length - field->field_length -1); + uchar bits= *(from_key + key_part->length - + field->pack_length_in_rec() - 1); set_rec_bits(bits, to_record + key_part->null_offset + (key_part->null_bit == 128), field->bit_ofs, field->bit_len); |