Commit 8e8c1a47 authored by unknown's avatar unknown

Simple optimization

parent 6fd2435d
......@@ -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)
{
uint a_len, b_len;
if (field_charset->strxfrm_multiply > 1)
{
/*
......@@ -4401,9 +4403,14 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
(const uchar*) b_ptr,
field_length);
}
if (field_charset->mbmaxlen != 1)
{
uint char_len= field_length/field_charset->mbmaxlen;
uint 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);
a_len= my_charpos(field_charset, a_ptr, a_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,
(const uchar*) b_ptr, b_len);
}
......
......@@ -473,9 +473,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
{
if (to->flags & BLOB_FLAG)
{
if (!(from->flags & BLOB_FLAG))
return do_conv_blob;
if (from->charset() != to->charset())
if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset())
return do_conv_blob;
if (from_length != to_length ||
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