summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 08:51:51 +0500
committerunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 08:51:51 +0500
commitedfa3dcf71666039dea6a950e193418fb6ae5d59 (patch)
tree716bb6f72f6ec362ee4d4566af7a7c6b30351dc9 /sql/key.cc
parentcecc04953be1743566ff7ed76b03d9b25c67697d (diff)
parent2503382629312a2a2a311e2c198530d457c5ea6c (diff)
downloadmariadb-git-edfa3dcf71666039dea6a950e193418fb6ae5d59.tar.gz
Merge gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt
into gshchepa.loc:/home/uchum/work/bk-trees/mysql-5.0-opt-13191 mysql-test/r/innodb_mysql.result: SCCS merged mysql-test/t/innodb_mysql.test: SCCS merged sql/field.cc: Merge with 4.1, fix of bug #13191. sql/field.h: Merge with 4.1, fix of bug #13191. sql/key.cc: Merge with 4.1, fix of bug #13191.
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/sql/key.cc b/sql/key.cc
index 921f3daa201..4c75fcae74a 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -119,29 +119,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(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(to_key, length, Field::itRAW);
+ if (bytes < length)
+ cs->cset->fill(cs, to_key + bytes, length - bytes, ' ');
}
to_key+= length;
key_length-= length;