mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
This commit is contained in:
commit
c9458e1646
1 changed files with 17 additions and 2 deletions
|
@ -1587,10 +1587,22 @@ void Item_func_elt::fix_length_and_dec()
|
|||
{
|
||||
max_length=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(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
|
||||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
|
@ -1651,13 +1663,16 @@ longlong Item_func_elt::val_int()
|
|||
String *Item_func_elt::val_str(String *str)
|
||||
{
|
||||
uint tmp;
|
||||
String *res;
|
||||
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
|
||||
{
|
||||
null_value=1;
|
||||
return NULL;
|
||||
}
|
||||
null_value=0;
|
||||
return args[tmp-1]->val_str(str);
|
||||
res= args[tmp-1]->val_str(str);
|
||||
res->set_charset(charset());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue