mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
turn Item_func_set_user_var
::native_val, ::native_val_int and native_val_str into inline
This commit is contained in:
parent
de6a1085eb
commit
d7e308c667
2 changed files with 31 additions and 36 deletions
|
@ -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) {}
|
||||
|
|
Loading…
Reference in a new issue