diff options
author | pem@mysql.com <> | 2003-11-19 15:19:46 +0100 |
---|---|---|
committer | pem@mysql.com <> | 2003-11-19 15:19:46 +0100 |
commit | 28a2c6a96b0e6383ab47494dc9f67653d24a01f3 (patch) | |
tree | e3ba11d4938f6675c5c72ee69cc88980a81ad705 /sql/item_func.h | |
parent | 8e1584d79e792545c6f726eb94655f457968aaf8 (diff) | |
parent | c4871b240da54a5a808ee30ede7c1ec751119763 (diff) | |
download | mariadb-git-28a2c6a96b0e6383ab47494dc9f67653d24a01f3.tar.gz |
Merging 4.1->5.0.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 6b43ebaccbe..d3cfaf63b5a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -47,7 +47,8 @@ public: SP_CONTAINS_FUNC,SP_OVERLAPS_FUNC, SP_STARTPOINT,SP_ENDPOINT,SP_EXTERIORRING, SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN, - NOT_FUNC, NOT_ALL_FUNC}; + NOT_FUNC, NOT_ALL_FUNC, + GUSERVAR_FUNC}; enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL }; enum Type type() const { return FUNC_ITEM; } virtual enum Functype functype() const { return UNKNOWN_FUNC; } @@ -946,6 +947,8 @@ class Item_func_get_user_var :public Item_func public: Item_func_get_user_var(LEX_STRING a): Item_func(), name(a) {} + enum Functype functype() const { return GUSERVAR_FUNC; } + LEX_STRING get_name() { return name; } double val(); longlong val_int(); String *val_str(String* str); @@ -1058,3 +1061,69 @@ enum Cast_target ITEM_CAST_BINARY, ITEM_CAST_SIGNED_INT, ITEM_CAST_UNSIGNED_INT, ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME, ITEM_CAST_CHAR }; + + +/* + * + * Stored FUNCTIONs + * + */ + +class sp_head; + +class Item_func_sp :public Item_func +{ +private: + LEX_STRING m_name; + mutable sp_head *m_sp; + + int execute(Item **itp); + +public: + + Item_func_sp(LEX_STRING name) + :Item_func(), m_name(name), m_sp(NULL) + {} + + Item_func_sp(LEX_STRING name, List<Item> &list) + :Item_func(list), m_name(name), m_sp(NULL) + {} + + virtual ~Item_func_sp() + {} + + const char *func_name() const + { + return m_name.str; + } + + enum enum_field_types field_type() const; + + Item_result result_type() const; + + longlong val_int() + { + return (longlong)Item_func_sp::val(); + } + + double val() + { + Item *it; + + if (execute(&it)) + return 0.0; + return it->val(); + } + + String *val_str(String *str) + { + Item *it; + + if (execute(&it)) + return NULL; + return it->val_str(str); + } + + void fix_length_and_dec(); + +}; |