summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 05:31:53 +0500
committerunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 05:31:53 +0500
commit2503382629312a2a2a311e2c198530d457c5ea6c (patch)
tree6fd60570b8a3798aa8af118d54ac53cd22f1f3a4 /sql/key.cc
parent3f169678479be890f6813f16615d413247b3e779 (diff)
parent98c0da4ed5dd8cbfc8450675e2c008b829367318 (diff)
downloadmariadb-git-2503382629312a2a2a311e2c198530d457c5ea6c.tar.gz
Merge gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt
into gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt-13191
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/key.cc b/sql/key.cc
index 7ddd40de2c9..d57d1570da7 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -89,20 +89,21 @@ void key_copy(byte *key,TABLE *table,uint idx,uint 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-=2;
- ((Field_blob*) key_part->field)->get_ptr(&pos);
- length=min(key_length,key_part->length);
- set_if_smaller(blob_length,length);
- int2store(key,(uint) blob_length);
- key+=2; // Skip length info
- memcpy(key,pos,blob_length);
+ key_length-= HA_KEY_BLOB_LENGTH;
+ length= min(key_length, key_part->length);
+ key_part->field->get_key_image((char *) key, length,
+ key_part->field->charset(),
+ Field::itRAW);
+ key+= HA_KEY_BLOB_LENGTH;
}
else
{
- length=min(key_length,key_part->length);
- memcpy(key,table->record[0]+key_part->offset,(size_t) length);
+ length= min(key_length, key_part->length);
+ Field *field= key_part->field;
+ CHARSET_INFO *cs= field->charset();
+ uint bytes= field->get_key_image(key, length, cs, Field::itRAW);
+ if (bytes < length)
+ cs->cset->fill(cs, key + bytes, length - bytes, ' ');
}
key+=length;
key_length-=length;