Commit bfaa1d9a authored by unknown's avatar unknown

filesort.cc, sql_analyse.cc, item_func.cc, item_strfunc.cc, field.cc:

  Unnesessary binary() calls have been removed


sql/field.cc:
  Unnesessary binary() calls have been removed
sql/item_strfunc.cc:
  Unnesessary binary() calls have been removed
sql/item_func.cc:
  Unnesessary binary() calls have been removed
sql/sql_analyse.cc:
  Unnesessary binary() calls have been removed
sql/filesort.cc:
  Unnesessary binary() calls have been removed
parent dd93a799
......@@ -5163,7 +5163,7 @@ void Field_set::sql_type(String &res) const
bool Field::eq_def(Field *field)
{
if (real_type() != field->real_type() || binary() != field->binary() ||
if (real_type() != field->real_type() || charset() != field->charset() ||
pack_length() != field->pack_length())
return 0;
return 1;
......
......@@ -507,8 +507,7 @@ static void make_sortkey(register SORTPARAM *param,
if (res->ptr() != (char*) to)
memcpy(to,res->ptr(),length);
bzero((char *)to+length,diff);
if (!item->binary())
my_tosort(cs, (char*) to,length);
my_tosort(cs, (char*) to,length);
}
break;
}
......@@ -918,6 +917,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
{
reg2 uint length;
THD *thd= current_thd;
CHARSET_INFO *cs;
*multi_byte_charset= 0;
length=0;
......@@ -926,20 +926,17 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
sortorder->need_strxnfrm= 0;
if (sortorder->field)
{
if (sortorder->field->type() == FIELD_TYPE_BLOB)
sortorder->length= thd->variables.max_sort_length;
else
{
sortorder->length=sortorder->field->pack_length();
if (!sortorder->field->binary())
if (use_strnxfrm((cs=sortorder->field->charset())))
{
CHARSET_INFO *cs=sortorder->field->charset();
if (use_strnxfrm(cs))
{
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
}
if (sortorder->field->maybe_null())
......@@ -950,15 +947,11 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
switch ((sortorder->result_type=sortorder->item->result_type())) {
case STRING_RESULT:
sortorder->length=sortorder->item->max_length;
if (!sortorder->item->binary())
{
CHARSET_INFO *cs=sortorder->item->charset();
if (use_strnxfrm(cs))
{
sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
}
if (use_strnxfrm((cs=sortorder->item->charset())))
{
sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
}
break;
case INT_RESULT:
......
......@@ -1024,7 +1024,7 @@ longlong Item_func_char_length::val_int()
return 0; /* purecov: inspected */
}
null_value=0;
return (longlong) (!args[0]->binary()) ? res->numchars() : res->length();
return (longlong) res->numchars();
}
longlong Item_func_coercibility::val_int()
......@@ -1156,7 +1156,7 @@ longlong Item_func_ord::val_int()
null_value=0;
if (!res->length()) return 0;
#ifdef USE_MB
if (use_mb(res->charset()) && !args[0]->binary())
if (use_mb(res->charset()))
{
register const char *str=res->ptr();
register uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length());
......
......@@ -650,7 +650,7 @@ String *Item_func_reverse::val_str(String *str)
ptr = (char *) res->ptr();
end=ptr+res->length();
#ifdef USE_MB
if (use_mb(res->charset()) && !binary())
if (use_mb(res->charset()))
{
String tmpstr;
tmpstr.copy(*res);
......@@ -1015,7 +1015,7 @@ String *Item_func_substr_index::val_str(String *str)
return &empty_string; // Wrong parameters
#ifdef USE_MB
if (use_mb(res->charset()) && !binary())
if (use_mb(res->charset()))
{
const char *ptr=res->ptr();
const char *strend = ptr+res->length();
......@@ -1169,7 +1169,7 @@ String *Item_func_rtrim::val_str(String *str)
{
char chr=(*remove_str)[0];
#ifdef USE_MB
if (use_mb(res->charset()) && !binary())
if (use_mb(res->charset()))
{
while (ptr < end)
{
......@@ -1186,7 +1186,7 @@ String *Item_func_rtrim::val_str(String *str)
{
const char *r_ptr=remove_str->ptr();
#ifdef USE_MB
if (use_mb(res->charset()) && !binary())
if (use_mb(res->charset()))
{
loop:
while (ptr + remove_length < end)
......@@ -1237,7 +1237,7 @@ String *Item_func_trim::val_str(String *str)
while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length))
ptr+=remove_length;
#ifdef USE_MB
if (use_mb(res->charset()) && !binary())
if (use_mb(res->charset()))
{
char *p=ptr;
register uint32 l;
......
......@@ -732,7 +732,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
{
if (must_be_blob)
{
if (item->binary())
if (item->charset() == &my_charset_bin)
answer->append("TINYBLOB", 8);
else
answer->append("TINYTEXT", 8);
......@@ -750,21 +750,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
}
else if (max_length < (1L << 16))
{
if (item->binary())
if (item->charset() == &my_charset_bin)
answer->append("BLOB", 4);
else
answer->append("TEXT", 4);
}
else if (max_length < (1L << 24))
{
if (item->binary())
if (item->charset() == &my_charset_bin)
answer->append("MEDIUMBLOB", 10);
else
answer->append("MEDIUMTEXT", 10);
}
else
{
if (item->binary())
if (item->charset() == &my_charset_bin)
answer->append("LONGBLOB", 8);
else
answer->append("LONGTEXT", 8);
......
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