diff options
author | unknown <mattiasj@witty.ndb.mysql.com> | 2008-02-07 15:09:59 +0100 |
---|---|---|
committer | unknown <mattiasj@witty.ndb.mysql.com> | 2008-02-07 15:09:59 +0100 |
commit | 1c0bd60db4e6810e4ac11f2626ab97063f205477 (patch) | |
tree | ee64f23daaa021257a0b2c1b18a69f3c2e92c1cb /sql/key.cc | |
parent | 629b355b4a2bc051e538244410edc1e3d0933a65 (diff) | |
download | mariadb-git-1c0bd60db4e6810e4ac11f2626ab97063f205477.tar.gz |
Bug#34358: Cannot find specified bit row in partitioned table
Problem was incorrect data length in the key_restore function
resulting in overwriting the search key.
Solution, remove one byte in length if uneven bits are used.
mysql-test/r/partition_datatype.result:
Bug#34358: Cannot find specified bit row
Updated result file
mysql-test/t/partition_datatype.test:
Bug#34358: Cannot find specified bit row
Updated test file
(corrected a few errors and added a test case for the bug)
sql/key.cc:
Bug34358: error in key_restore for bit fields with uneven bits
When uneven bits exist, it has special treatment for the uneven bits
but does use the same byte again when copying the rest of
the key_part.
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/key.cc b/sql/key.cc index 7f075674ab6..47e5c5ebdd7 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -168,6 +168,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, } for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++) { + uchar used_uneven_bits= 0; if (key_part->null_bit) { if (*from_key++) @@ -186,6 +187,8 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, set_rec_bits(bits, to_record + key_part->null_offset + (key_part->null_bit == 128), field->bit_ofs, field->bit_len); + /* we have now used the byte with 'uneven' bits */ + used_uneven_bits= 1; } } if (key_part->key_part_flag & HA_BLOB_PART) @@ -222,7 +225,9 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, else { length= min(key_length, key_part->length); - memcpy(to_record + key_part->offset, from_key, (size_t) length); + /* skip the byte with 'uneven' bits, if used */ + memcpy(to_record + key_part->offset, from_key + used_uneven_bits + , (size_t) length - used_uneven_bits); } from_key+= length; key_length-= length; |