mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
fix key_copy to use from_record argument data
key_copy is supposed to take field values from the from_record argument, but it was mostly ignoring it and instead relying on the caller to set field->ptr pointers accordingly. Inconsistently, it was checking the null bitmap in the from_record, not at the field->null_ptr. Now key_copy correctly takes all field values from the from_record.
This commit is contained in:
committed by
Sergei Golubchik
parent
7f9b3ea951
commit
db6f02bb98
@@ -141,12 +141,13 @@ void key_copy(uchar *to_key, const uchar *from_record, const KEY *key_info,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
auto *from_ptr= key_part->field->ptr_in_record(from_record);
|
||||
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= MY_MIN(key_length, key_part->length);
|
||||
uint bytes= key_part->field->get_key_image(to_key, length,
|
||||
uint bytes= key_part->field->get_key_image(to_key, length, from_ptr,
|
||||
key_info->flags & HA_SPATIAL ? Field::itMBR : Field::itRAW);
|
||||
if (with_zerofill && bytes < length)
|
||||
bzero((char*) to_key + bytes, length - bytes);
|
||||
@@ -157,7 +158,7 @@ void key_copy(uchar *to_key, const uchar *from_record, const KEY *key_info,
|
||||
length= MY_MIN(key_length, key_part->length);
|
||||
Field *field= key_part->field;
|
||||
CHARSET_INFO *cs= field->charset();
|
||||
uint bytes= field->get_key_image(to_key, length, Field::itRAW);
|
||||
uint bytes= field->get_key_image(to_key, length, from_ptr, Field::itRAW);
|
||||
if (bytes < length)
|
||||
cs->fill((char*) to_key + bytes, length - bytes, ' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user