mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
BUG#47776, Fixed character set handling, used wrong length, eventually also found that didn't need to convert to my_strnxfrm-format for column list partitioned tables, also column list partitioned tables can use multi-byte character sets in partition fields as well as where strxfrm multiplies the number of bytes in the string
This commit is contained in:
@@ -1404,15 +1404,21 @@ static void set_up_partition_func_pointers(partition_info *part_info)
|
||||
if (part_info->is_sub_partitioned())
|
||||
{
|
||||
DBUG_ASSERT(part_info->get_part_partition_id);
|
||||
part_info->get_part_partition_id_charset=
|
||||
part_info->get_part_partition_id;
|
||||
part_info->get_part_partition_id= get_part_id_charset_func_part;
|
||||
if (!part_info->column_list)
|
||||
{
|
||||
part_info->get_part_partition_id=
|
||||
part_info->get_part_partition_id_charset;
|
||||
part_info->get_part_partition_id= get_part_id_charset_func_part;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(part_info->get_partition_id);
|
||||
part_info->get_part_partition_id_charset= part_info->get_partition_id;
|
||||
part_info->get_partition_id= get_part_id_charset_func_part;
|
||||
if (!part_info->column_list)
|
||||
{
|
||||
part_info->get_part_partition_id_charset= part_info->get_partition_id;
|
||||
part_info->get_part_partition_id= get_part_id_charset_func_part;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (part_info->subpart_charset_field_array)
|
||||
@@ -1715,7 +1721,8 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
||||
}
|
||||
if (((part_info->part_type != HASH_PARTITION ||
|
||||
part_info->list_of_part_fields == FALSE) &&
|
||||
check_part_func_fields(part_info->part_field_array, TRUE)) ||
|
||||
(!part_info->column_list &&
|
||||
check_part_func_fields(part_info->part_field_array, TRUE))) ||
|
||||
(part_info->list_of_part_fields == FALSE &&
|
||||
part_info->is_sub_partitioned() &&
|
||||
check_part_func_fields(part_info->subpart_field_array, TRUE)))
|
||||
@@ -2603,7 +2610,8 @@ static void copy_to_part_field_buffers(Field **ptr,
|
||||
if (!field->maybe_null() || !field->is_null())
|
||||
{
|
||||
CHARSET_INFO *cs= ((Field_str*)field)->charset();
|
||||
uint len= field->pack_length();
|
||||
uint max_len= field->pack_length();
|
||||
uint data_len= field->data_length();
|
||||
uchar *field_buf= *field_bufs;
|
||||
/*
|
||||
We only use the field buffer for VARCHAR and CHAR strings
|
||||
@@ -2615,17 +2623,17 @@ static void copy_to_part_field_buffers(Field **ptr,
|
||||
if (field->type() == MYSQL_TYPE_VARCHAR)
|
||||
{
|
||||
uint len_bytes= ((Field_varstring*)field)->length_bytes;
|
||||
my_strnxfrm(cs, field_buf + len_bytes, (len - len_bytes),
|
||||
field->ptr + len_bytes, field->field_length);
|
||||
my_strnxfrm(cs, field_buf + len_bytes, max_len,
|
||||
field->ptr + len_bytes, data_len);
|
||||
if (len_bytes == 1)
|
||||
*field_buf= (uchar) field->field_length;
|
||||
*field_buf= (uchar) data_len;
|
||||
else
|
||||
int2store(field_buf, field->field_length);
|
||||
int2store(field_buf, data_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
my_strnxfrm(cs, field_buf, len,
|
||||
field->ptr, field->field_length);
|
||||
my_strnxfrm(cs, field_buf, max_len,
|
||||
field->ptr, max_len);
|
||||
}
|
||||
field->ptr= field_buf;
|
||||
}
|
||||
|
Reference in New Issue
Block a user