summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-07-15 18:11:49 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-07-15 18:11:49 +0500
commitdb9b5f333e47754e170733202e9b76937ba9902d (patch)
tree7ce88c6d21fe3f85bfbfdd3ce0f2b7197259b54d /sql/item_strfunc.cc
parent4b3eecf46b640b3601527ea59d819ddaec5820f8 (diff)
downloadmariadb-git-db9b5f333e47754e170733202e9b76937ba9902d.tar.gz
ELT passes the first argument in args[0] instead of having a separate Item.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc44
1 files changed, 8 insertions, 36 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b25619d0bb1..4e35e90b429 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1660,81 +1660,53 @@ void Item_func_elt::fix_length_and_dec()
max_length=0;
decimals=0;
- if (agg_arg_collations(collation, args, arg_count))
+ if (agg_arg_collations(collation, args+1, arg_count-1))
return;
- for (uint i=0 ; i < arg_count ; i++)
+ for (uint i=1 ; i < arg_count ; i++)
{
set_if_bigger(max_length,args[i]->max_length);
set_if_bigger(decimals,args[i]->decimals);
}
maybe_null=1; // NULL if wrong first arg
- with_sum_func= with_sum_func || item->with_sum_func;
- used_tables_cache|=item->used_tables();
- const_item_cache&=item->const_item();
-}
-
-
-void Item_func_elt::split_sum_func(Item **ref_pointer_array,
- List<Item> &fields)
-{
- if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)
- item->split_sum_func(ref_pointer_array, fields);
- else if (item->used_tables() || item->type() == SUM_FUNC_ITEM)
- {
- uint el= fields.elements;
- fields.push_front(item);
- ref_pointer_array[el]= item;
- item= new Item_ref(ref_pointer_array + el, 0, item->name);
- }
- Item_str_func::split_sum_func(ref_pointer_array, fields);
-}
-
-
-void Item_func_elt::update_used_tables()
-{
- Item_func::update_used_tables();
- item->update_used_tables();
- used_tables_cache|=item->used_tables();
- const_item_cache&=item->const_item();
}
double Item_func_elt::val()
{
uint tmp;
- if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
+ if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
{
null_value=1;
return 0.0;
}
null_value=0;
- return args[tmp-1]->val();
+ return args[tmp]->val();
}
longlong Item_func_elt::val_int()
{
uint tmp;
- if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
+ if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
{
null_value=1;
return 0;
}
null_value=0;
- return args[tmp-1]->val_int();
+ return args[tmp]->val_int();
}
String *Item_func_elt::val_str(String *str)
{
uint tmp;
String *res;
- if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
+ if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
{
null_value=1;
return NULL;
}
null_value=0;
- res= args[tmp-1]->val_str(str);
+ res= args[tmp]->val_str(str);
res->set_charset(charset());
return res;
}