Commit 6c44563f authored by monty@mysql.com's avatar monty@mysql.com

Simple optimization

parent 81363b19
...@@ -4390,6 +4390,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)), ...@@ -4390,6 +4390,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
int Field_string::cmp(const char *a_ptr, const char *b_ptr) int Field_string::cmp(const char *a_ptr, const char *b_ptr)
{ {
uint a_len, b_len;
if (field_charset->strxfrm_multiply > 1) if (field_charset->strxfrm_multiply > 1)
{ {
/* /*
...@@ -4401,9 +4403,14 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) ...@@ -4401,9 +4403,14 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
(const uchar*) b_ptr, (const uchar*) b_ptr,
field_length); field_length);
} }
if (field_charset->mbmaxlen != 1)
{
uint char_len= field_length/field_charset->mbmaxlen; uint char_len= field_length/field_charset->mbmaxlen;
uint a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len); a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
uint b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len); b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
}
else
a_len= b_len= field_length;
return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len, return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len,
(const uchar*) b_ptr, b_len); (const uchar*) b_ptr, b_len);
} }
......
...@@ -473,9 +473,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*) ...@@ -473,9 +473,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
{ {
if (to->flags & BLOB_FLAG) if (to->flags & BLOB_FLAG)
{ {
if (!(from->flags & BLOB_FLAG)) if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset())
return do_conv_blob;
if (from->charset() != to->charset())
return do_conv_blob; return do_conv_blob;
if (from_length != to_length || if (from_length != to_length ||
to->table->db_low_byte_first != from->table->db_low_byte_first) to->table->db_low_byte_first != from->table->db_low_byte_first)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment