Commit d7e308c6 authored by unknown's avatar unknown

turn Item_func_set_user_var

 ::native_val, ::native_val_int and native_val_str into inline

parent de6a1085
......@@ -1899,38 +1899,6 @@ void Item_func_set_user_var::update_hash(void *ptr, uint length,
return;
}
double Item_func_set_user_var::native_val()
{
double value=args[0]->val();
update_hash((void*) &value,sizeof(value), REAL_RESULT);
return value;
}
longlong Item_func_set_user_var::native_val_int()
{
longlong value=args[0]->val_int();
update_hash((void*) &value,sizeof(longlong),INT_RESULT);
return value;
}
String *Item_func_set_user_var::native_val_str(String *str)
{
char buffer[MAX_FIELD_WIDTH];
String *res=args[0]->val_str(str);
if (!res) // Null value
update_hash((void*) 0,0,STRING_RESULT);
else
update_hash(res->c_ptr(),res->length()+1,STRING_RESULT);
return res;
}
String *Item_func_set_user_var::native_val_str()
{
char buffer[MAX_FIELD_WIDTH];
String tmp(buffer,sizeof(buffer));
return native_val_str(&tmp);
}
bool
Item_func_set_user_var::update()
{
......
......@@ -889,10 +889,37 @@ class Item_func_set_user_var :public Item_func
LEX_STRING name;
user_var_entry *entry;
double native_val();
longlong native_val_int();
String *native_val_str(String *str);
String *native_val_str();
double native_val()
{
double value=args[0]->val();
update_hash((void*) &value,sizeof(value), REAL_RESULT);
return value;
}
longlong native_val_int()
{
longlong value=args[0]->val_int();
update_hash((void*) &value,sizeof(longlong),INT_RESULT);
return value;
}
String *native_val_str(String *str)
{
char buffer[MAX_FIELD_WIDTH];
String *res=args[0]->val_str(str);
if (!res) // Null value
update_hash((void*) 0,0,STRING_RESULT);
else
update_hash(res->c_ptr(),res->length()+1,STRING_RESULT);
return res;
}
String *native_val_str()
{
char buffer[MAX_FIELD_WIDTH];
String tmp(buffer,sizeof(buffer));
return native_val_str(&tmp);
}
public:
Item_func_set_user_var(LEX_STRING a,Item *b): Item_func(b), name(a) {}
......
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