diff options
author | holyfoot/hf@hfmain.(none) <> | 2007-04-29 13:19:32 +0500 |
---|---|---|
committer | holyfoot/hf@hfmain.(none) <> | 2007-04-29 13:19:32 +0500 |
commit | 2fcebef31fbde737d9a7154b842bbd2c5efbaa92 (patch) | |
tree | edfad9e83a97b7f6eef66878ef43a7c0cf00d858 /sql/key.cc | |
parent | 29970f1e0d909b209b5f99b0bca2193e67cd707e (diff) | |
parent | 90864c2874917bca8794b71981c57263368b573a (diff) | |
download | mariadb-git-2fcebef31fbde737d9a7154b842bbd2c5efbaa92.tar.gz |
Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into mysql.com:/d2/hf/mrg/mysql-5.1-opt
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/sql/key.cc b/sql/key.cc index faa7bf1f04b..19861cee134 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -139,29 +139,22 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) key_length--; } } - if (key_part->key_part_flag & HA_BLOB_PART) - { - char *pos; - ulong blob_length= ((Field_blob*) key_part->field)->get_length(); - key_length-= HA_KEY_BLOB_LENGTH; - ((Field_blob*) key_part->field)->get_ptr(&pos); - length=min(key_length, key_part->length); - set_if_smaller(blob_length, length); - int2store(to_key, (uint) blob_length); - to_key+= HA_KEY_BLOB_LENGTH; // Skip length info - memcpy(to_key, pos, blob_length); - } - else if (key_part->key_part_flag & HA_VAR_LENGTH_PART) + if (key_part->key_part_flag & HA_BLOB_PART || + key_part->key_part_flag & HA_VAR_LENGTH_PART) { key_length-= HA_KEY_BLOB_LENGTH; length= min(key_length, key_part->length); - key_part->field->get_key_image((char *) to_key, length, Field::itRAW); + key_part->field->get_key_image((char*) to_key, length, Field::itRAW); to_key+= HA_KEY_BLOB_LENGTH; } else { length= min(key_length, key_part->length); - memcpy(to_key, from_record + key_part->offset, (size_t) length); + Field *field= key_part->field; + CHARSET_INFO *cs= field->charset(); + uint bytes= field->get_key_image((char*) to_key, length, Field::itRAW); + if (bytes < length) + cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' '); } to_key+= length; key_length-= length; |