diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-01-16 23:00:21 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-01-16 23:29:48 +0100 |
commit | 444587d8a3c4b91421cd4cfd7bda2e3f4d1aebe4 (patch) | |
tree | 2da20b69c9345c8b66b66863b743511bd59c4759 /sql/field.cc | |
parent | 5e7593add405f07ac6a7d755ae1349fb1d2eafd4 (diff) | |
download | mariadb-git-444587d8a3c4b91421cd4cfd7bda2e3f4d1aebe4.tar.gz |
BIT field woes
* get_rec_bits() was always reading two bytes, even if the
bit field contained only of one byte
* In various places the code used field->pack_length() bytes
starting from field->ptr, while it should be field->pack_length_in_rec()
* Field_bit::key_cmp and Field_bit::cmp_max passed field_length as
an argument to memcmp(), but field_length is the number of bits!
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index 08ba437fa30..5b111ab5e03 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1758,7 +1758,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) { uint store_length; copy->str= ptr; - copy->length= pack_length(); + copy->length= pack_length_in_rec(); copy->field= this; if (flags & BLOB_FLAG) { @@ -8422,7 +8422,7 @@ int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len) if ((flag= (int) (bits_a - bits_b))) return flag; } - return memcmp(a, b, field_length); + return memcmp(a, b, bytes_in_rec); } @@ -8437,7 +8437,7 @@ int Field_bit::key_cmp(const uchar *str, uint length) str++; length--; } - return memcmp(ptr, str, length); + return memcmp(ptr, str, bytes_in_rec); } |