Commit 396328d5 authored by unknown's avatar unknown

item_strfunc.cc:

  Fixed that concat() didn't set character set in val_str
  concat_ws() now honors coercibility


sql/item_strfunc.cc:
  Fixed that concat() didn't set character set in val_str
  concat_ws() now honors coercibility
parent 8848bb89
......@@ -235,8 +235,6 @@ String *Item_func_concat::val_str(String *str)
use_as_buff= &tmp_value;
for (i=1 ; i < arg_count ; i++)
{
if (args[i]->binary())
set_charset(&my_charset_bin);
if (res->length() == 0)
{
if (!(res=args[i]->val_str(str)))
......@@ -265,7 +263,6 @@ String *Item_func_concat::val_str(String *str)
str->append(*res2);
}
res=str;
res->set_charset(charset());
}
else if (res == &tmp_value)
{
......@@ -277,7 +274,6 @@ String *Item_func_concat::val_str(String *str)
if (tmp_value.replace(0,0,*res))
goto null;
res= &tmp_value;
res->set_charset(charset());
use_as_buff=str; // Put next arg here
}
else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() &&
......@@ -296,7 +292,6 @@ String *Item_func_concat::val_str(String *str)
*res))
goto null;
res= &tmp_value;
res->set_charset(charset());
use_as_buff=str; // Put next arg here
}
else
......@@ -306,11 +301,11 @@ String *Item_func_concat::val_str(String *str)
tmp_value.append(*res2))
goto null;
res= &tmp_value;
res->set_charset(charset());
use_as_buff=str;
}
}
}
res->set_charset(charset());
return res;
null:
......@@ -602,6 +597,7 @@ String *Item_func_concat_ws::val_str(String *str)
use_as_buff=str;
}
}
res->set_charset(charset());
return res;
null:
......@@ -626,9 +622,18 @@ void Item_func_concat_ws::split_sum_func(Item **ref_pointer_array,
void Item_func_concat_ws::fix_length_and_dec()
{
set_charset(separator->charset(),separator->coercibility);
max_length=separator->max_length*(arg_count-1);
for (uint i=0 ; i < arg_count ; i++)
{
max_length+=args[i]->max_length;
if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility))
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name());
break;
}
}
if (max_length > MAX_BLOB_WIDTH)
{
max_length=MAX_BLOB_WIDTH;
......
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