diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-12 14:30:34 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-12 14:30:34 +0300 |
commit | f09f1c7c7da344d0078b2c13edc9249c4c61c6b9 (patch) | |
tree | 1b707c9edf2d159102019147a5dbca390e1aac83 /sql/item_strfunc.h | |
parent | f34be1893892745b5b1a7a099eab4ad8e9ac8641 (diff) | |
parent | 4c81cef75d7871e2c77d6723813ac328c34603b5 (diff) | |
download | mariadb-git-f09f1c7c7da344d0078b2c13edc9249c4c61c6b9.tar.gz |
Merge with dynamic column code
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index e8d0384482d..1958d3edfc6 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -890,3 +890,71 @@ public: } }; + +class Item_func_dyncol_create: public Item_str_func +{ +protected: + DYNCALL_CREATE_DEF *defs; + DYNAMIC_COLUMN_VALUE *vals; + uint *nums; + void prepare_arguments(); + void cleanup_arguments(); + void print_arguments(String *str, enum_query_type query_type); +public: + Item_func_dyncol_create(List<Item> &args, DYNCALL_CREATE_DEF *dfs); + bool fix_fields(THD *thd, Item **ref); + void fix_length_and_dec(); + const char *func_name() const{ return "column_create"; } + String *val_str(String *); + virtual void print(String *str, enum_query_type query_type); +}; + + +class Item_func_dyncol_add: public Item_func_dyncol_create +{ +public: + Item_func_dyncol_add(List<Item> &args, DYNCALL_CREATE_DEF *dfs) + :Item_func_dyncol_create(args, dfs) + {} + const char *func_name() const{ return "column_add"; } + String *val_str(String *); + virtual void print(String *str, enum_query_type query_type); +}; + + +/* + The following functions is always called from an Item_cast function +*/ + +class Item_dyncol_get: public Item_str_func +{ +public: + Item_dyncol_get(Item *str, Item *num) + :Item_str_func(str, num) + { + max_length= MAX_DYNAMIC_COLUMN_LENGTH; + } + void fix_length_and_dec() + { maybe_null= 1; } + /* Mark that collation can change between calls */ + bool dynamic_result() { return 1; } + + const char *func_name() const { return "column_get"; } + String *val_str(String *); + longlong val_int(); + double val_real(); + my_decimal *val_decimal(my_decimal *); + bool get_dyn_value(DYNAMIC_COLUMN_VALUE *val, String *tmp); + bool get_date(MYSQL_TIME *ltime,uint fuzzydate); + void print(String *str, enum_query_type query_type); +}; + + +class Item_func_dyncol_list: public Item_str_func +{ +public: + Item_func_dyncol_list(Item *str) :Item_str_func(str) {}; + void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; }; + const char *func_name() const{ return "column_list"; } + String *val_str(String *); +}; |