Commit 3e897bc3 authored by unknown's avatar unknown

Fix for bug #666 (Nice number, yeah?)


sql/item_strfunc.cc:
  Item_func_elt::valXXX() functions don't expect NULL argument if it is 
  not the first one.
parent 332334e8
......@@ -1539,37 +1539,46 @@ void Item_func_elt::update_used_tables()
double Item_func_elt::val()
{
uint tmp;
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
return 0.0;
}
double result= args[tmp-1]->val();
if (args[tmp-1]->is_null())
return 0.0;
null_value=0;
return args[tmp-1]->val();
return result;
}
longlong Item_func_elt::val_int()
{
uint tmp;
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
return 0;
}
int result= args[tmp-1]->val_int();
if (args[tmp-1]->is_null())
return 0;
null_value=0;
return args[tmp-1]->val_int();
return result;
}
String *Item_func_elt::val_str(String *str)
{
uint tmp;
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
return NULL;
}
String *result= args[tmp-1]->val_str(str);
if (args[tmp-1]->is_null())
return NULL;
null_value=0;
return args[tmp-1]->val_str(str);
return result;
}
......
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