summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@hfmain.(none)>2007-04-29 13:19:32 +0500
committerunknown <holyfoot/hf@hfmain.(none)>2007-04-29 13:19:32 +0500
commit2031f55751dad44950252ab711cde893b3bce674 (patch)
treeedfad9e83a97b7f6eef66878ef43a7c0cf00d858 /sql/key.cc
parent8f374c8f34221467061feca44fd67898dbb21701 (diff)
parent7eb77da33a7da7c56053164793012f1091048350 (diff)
downloadmariadb-git-2031f55751dad44950252ab711cde893b3bce674.tar.gz
Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into mysql.com:/d2/hf/mrg/mysql-5.1-opt mysql-test/r/alter_table.result: Auto merged mysql-test/r/distinct.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/r/query_cache.result: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged BitKeeper/deleted/.del-ps_6bdb.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysys/my_error.c: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_sum.cc: Auto merged sql/key.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/include/mix1.inc: merging mysql-test/r/group_by.result: SCCS merged mysql-test/r/innodb_mysql.result: merging mysql-test/r/join.result: merging mysql-test/r/subselect.result: merging mysql-test/r/type_datetime.result: SCCS merged mysql-test/r/windows.result: SCCS merged mysql-test/t/group_by.test: SCCS merged mysql-test/t/join.test: merging mysql-test/t/subselect.test: merging mysql-test/t/type_datetime.test: merging mysql-test/t/windows.test: SCCS merged sql/item_timefunc.cc: merging sql/sql_base.cc: SCCS merged storage/innobase/handler/ha_innodb.cc: merging
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 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;