summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2003-10-01 12:00:08 -0400
committerunknown <vva@eagle.mysql.r18.ru>2003-10-01 12:00:08 -0400
commitd7e308c667ebeacde05cc5f8e921ebd16f474634 (patch)
treebf89495a979929bf4091a59ed265b2a89efe9492 /sql/item_func.h
parentde6a1085eb101d9a091a1d437c1ff4e75eb5e8a0 (diff)
downloadmariadb-git-d7e308c667ebeacde05cc5f8e921ebd16f474634.tar.gz
turn Item_func_set_user_var
::native_val, ::native_val_int and native_val_str into inline
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index 4dada28f87b..ffc587c3cf3 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -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) {}