summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorunknown <mikael@dator3.(none)>2007-04-20 18:35:16 +0200
committerunknown <mikael@dator3.(none)>2007-04-20 18:35:16 +0200
commit2a2b1ea8258a151f2420e8b6226b3fad629956ad (patch)
tree83f54976d02e37311f895d3581ca830cc130e0fb /sql/sql_partition.cc
parent61aaff4a01647d11dae851afda810cee07e99d1d (diff)
downloadmariadb-git-2a2b1ea8258a151f2420e8b6226b3fad629956ad.tar.gz
BUG#18198
Added new test cases, fixed bugs in relation to those mysql-test/r/partition_charset.result: New test case mysql-test/r/partition_list.result: New test case mysql-test/t/partition_list.test: New test case sql/partition_info.cc: Missing initialisation sql/sql_partition.cc: key_restore made use of field->ptr in VARCHAR fields and when used with REPLACE it caused the key_restore to become against table->record[0] when buf pointed to table->record[1]
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 86068cc5c0d..c02beee350c 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -3315,13 +3315,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf,
uint32 part_id;
DBUG_ENTER("get_sub_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
+ {
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
part_id= part_info->get_subpartition_id(part_info);
+ }
else
{
Field **part_field_array= part_info->subpart_field_array;
set_field_ptr(part_field_array, buf, rec0);
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
part_id= part_info->get_subpartition_id(part_info);
set_field_ptr(part_field_array, rec0, buf);
}
@@ -3358,14 +3361,17 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
longlong func_value;
DBUG_ENTER("get_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
+ {
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_part_partition_id(part_info, part_id,
&func_value);
+ }
else
{
Field **part_field_array= part_info->part_field_array;
set_field_ptr(part_field_array, buf, rec0);
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_part_partition_id(part_info, part_id,
&func_value);
set_field_ptr(part_field_array, rec0, buf);
@@ -3405,14 +3411,17 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf,
longlong func_value;
DBUG_ENTER("get_full_part_id_from_key");
- key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
+ {
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value);
+ }
else
{
Field **part_field_array= part_info->full_part_field_array;
set_field_ptr(part_field_array, buf, rec0);
+ key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value);
set_field_ptr(part_field_array, rec0, buf);