Commit 27c67fbf authored by hf@deer.(none)'s avatar hf@deer.(none)

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

parent 10c81fb5
......@@ -1539,37 +1539,46 @@ void Item_func_elt::update_used_tables()
double Item_func_elt::val()
{
uint tmp;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
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;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
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;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
{
null_value=1;
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
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