diff options
author | unknown <ram@gw.mysql.r18.ru> | 2004-12-17 18:06:05 +0400 |
---|---|---|
committer | unknown <ram@gw.mysql.r18.ru> | 2004-12-17 18:06:05 +0400 |
commit | d7285006cfcd93b13ec9c0f886ec542d7365fbfd (patch) | |
tree | 2e6c553f1097aea129caca8a5d200ff4f446a230 /sql/key.cc | |
parent | eaec00b19b0dfe26bbe4297edfea04e277af27ed (diff) | |
download | mariadb-git-d7285006cfcd93b13ec9c0f886ec542d7365fbfd.tar.gz |
bit type
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/key.cc b/sql/key.cc index dfd924f1dc7..fe35638608d 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -102,6 +102,19 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) key_part->null_bit); key_length--; } + if (key_part->type == HA_KEYTYPE_BIT) + { + Field_bit *field= (Field_bit *) (key_part->field); + if (field->bit_len) + { + uchar bits= get_rec_bits((uchar*) from_record + + key_part->null_offset + + (key_part->null_bit == 128), + field->bit_ofs, field->bit_len); + *to_key++= bits; + key_length--; + } + } if (key_part->key_part_flag & HA_BLOB_PART) { char *pos; @@ -170,6 +183,23 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, to_record[key_part->null_offset]&= ~key_part->null_bit; key_length--; } + if (key_part->type == HA_KEYTYPE_BIT) + { + Field_bit *field= (Field_bit *) (key_part->field); + if (field->bit_len) + { + uchar bits= *(from_key + key_part->length - field->field_length -1); + set_rec_bits(bits, to_record + key_part->null_offset + + (key_part->null_bit == 128), + field->bit_ofs, field->bit_len); + } + else + { + clr_rec_bits(to_record + key_part->null_offset + + (key_part->null_bit == 128), + field->bit_ofs, field->bit_len); + } + } if (key_part->key_part_flag & HA_BLOB_PART) { uint blob_length= uint2korr(from_key); |