Commit e93fc8de authored by lenz@mysql.com's avatar lenz@mysql.com

Merge lgrimmer@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/suse80/my/mysql-4.1
parents 08d03fa3 d277db7f
...@@ -235,8 +235,6 @@ String *Item_func_concat::val_str(String *str) ...@@ -235,8 +235,6 @@ String *Item_func_concat::val_str(String *str)
use_as_buff= &tmp_value; use_as_buff= &tmp_value;
for (i=1 ; i < arg_count ; i++) for (i=1 ; i < arg_count ; i++)
{ {
if (args[i]->binary())
set_charset(&my_charset_bin);
if (res->length() == 0) if (res->length() == 0)
{ {
if (!(res=args[i]->val_str(str))) if (!(res=args[i]->val_str(str)))
...@@ -265,7 +263,6 @@ String *Item_func_concat::val_str(String *str) ...@@ -265,7 +263,6 @@ String *Item_func_concat::val_str(String *str)
str->append(*res2); str->append(*res2);
} }
res=str; res=str;
res->set_charset(charset());
} }
else if (res == &tmp_value) else if (res == &tmp_value)
{ {
...@@ -277,7 +274,6 @@ String *Item_func_concat::val_str(String *str) ...@@ -277,7 +274,6 @@ String *Item_func_concat::val_str(String *str)
if (tmp_value.replace(0,0,*res)) if (tmp_value.replace(0,0,*res))
goto null; goto null;
res= &tmp_value; res= &tmp_value;
res->set_charset(charset());
use_as_buff=str; // Put next arg here use_as_buff=str; // Put next arg here
} }
else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() && else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() &&
...@@ -296,7 +292,6 @@ String *Item_func_concat::val_str(String *str) ...@@ -296,7 +292,6 @@ String *Item_func_concat::val_str(String *str)
*res)) *res))
goto null; goto null;
res= &tmp_value; res= &tmp_value;
res->set_charset(charset());
use_as_buff=str; // Put next arg here use_as_buff=str; // Put next arg here
} }
else else
...@@ -306,11 +301,11 @@ String *Item_func_concat::val_str(String *str) ...@@ -306,11 +301,11 @@ String *Item_func_concat::val_str(String *str)
tmp_value.append(*res2)) tmp_value.append(*res2))
goto null; goto null;
res= &tmp_value; res= &tmp_value;
res->set_charset(charset());
use_as_buff=str; use_as_buff=str;
} }
} }
} }
res->set_charset(charset());
return res; return res;
null: null:
...@@ -602,6 +597,7 @@ String *Item_func_concat_ws::val_str(String *str) ...@@ -602,6 +597,7 @@ String *Item_func_concat_ws::val_str(String *str)
use_as_buff=str; use_as_buff=str;
} }
} }
res->set_charset(charset());
return res; return res;
null: null:
...@@ -626,9 +622,18 @@ void Item_func_concat_ws::split_sum_func(Item **ref_pointer_array, ...@@ -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() void Item_func_concat_ws::fix_length_and_dec()
{ {
set_charset(separator->charset(),separator->coercibility);
max_length=separator->max_length*(arg_count-1); max_length=separator->max_length*(arg_count-1);
for (uint i=0 ; i < arg_count ; i++) for (uint i=0 ; i < arg_count ; i++)
{
max_length+=args[i]->max_length; 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) if (max_length > MAX_BLOB_WIDTH)
{ {
max_length=MAX_BLOB_WIDTH; max_length=MAX_BLOB_WIDTH;
...@@ -1587,10 +1592,22 @@ void Item_func_elt::fix_length_and_dec() ...@@ -1587,10 +1592,22 @@ void Item_func_elt::fix_length_and_dec()
{ {
max_length=0; max_length=0;
decimals=0; decimals=0;
for (uint i=1 ; i < arg_count ; i++)
for (uint i=0 ; i < arg_count ; i++)
{ {
set_if_bigger(max_length,args[i]->max_length); set_if_bigger(max_length,args[i]->max_length);
set_if_bigger(decimals,args[i]->decimals); set_if_bigger(decimals,args[i]->decimals);
if (i == 0)
set_charset(args[i]->charset(),args[i]->coercibility);
else
{
if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility))
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name());
break;
}
}
} }
maybe_null=1; // NULL if wrong first arg maybe_null=1; // NULL if wrong first arg
with_sum_func= with_sum_func || item->with_sum_func; with_sum_func= with_sum_func || item->with_sum_func;
...@@ -1651,13 +1668,16 @@ longlong Item_func_elt::val_int() ...@@ -1651,13 +1668,16 @@ longlong Item_func_elt::val_int()
String *Item_func_elt::val_str(String *str) String *Item_func_elt::val_str(String *str)
{ {
uint tmp; uint tmp;
String *res;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count) if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{ {
null_value=1; null_value=1;
return NULL; return NULL;
} }
null_value=0; null_value=0;
return args[tmp-1]->val_str(str); res= args[tmp-1]->val_str(str);
res->set_charset(charset());
return res;
} }
......
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