mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Simple optimization
This commit is contained in:
parent
81363b194d
commit
6c44563fc5
2 changed files with 11 additions and 6 deletions
13
sql/field.cc
13
sql/field.cc
|
@ -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);
|
||||
}
|
||||
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);
|
||||
if (field_charset->mbmaxlen != 1)
|
||||
{
|
||||
uint char_len= field_length/field_charset->mbmaxlen;
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue