diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2008-11-21 15:21:50 +0100 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2008-11-21 15:21:50 +0100 |
commit | 33b194c36ec28528fd349dd17412848de2f1171c (patch) | |
tree | 68cba4897925b9395dd0bfe53b5b95a777d78637 /sql/item_func.h | |
parent | 8d96bcda72df224f7a656cbcc1535a027bada75f (diff) | |
parent | 1d521f6c20881997c9162bd11cadcbc77d20520b (diff) | |
download | mariadb-git-33b194c36ec28528fd349dd17412848de2f1171c.tar.gz |
Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, or mysql-test/t/*myisam*.
However there were three new tests mysql-test/suite/parts/t/partition*myisam.test, of which I make here
copies for Maria.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 80d4f58ad8a..5f791f495b9 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -55,7 +55,7 @@ public: NOW_FUNC, TRIG_COND_FUNC, SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC, - NEG_FUNC }; + NEG_FUNC, GSYSVAR_FUNC }; enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL, OPTIMIZE_EQUAL }; enum Type type() const { return FUNC_ITEM; } @@ -1294,6 +1294,17 @@ class Item_func_set_user_var :public Item_func { enum Item_result cached_result_type; user_var_entry *entry; + /* + The entry_thd variable is used: + 1) to skip unnecessary updates of the entry field (see above); + 2) to reset the entry field that was initialized in the other thread + (for example, an item tree of a trigger that updates user variables + may be shared between several connections, and the entry_thd field + prevents updates of one connection user variables from a concurrent + connection calling the same trigger that initially updated some + user variable it the first connection context). + */ + THD *entry_thd; char buffer[MAX_FIELD_WIDTH]; String value; my_decimal decimal_buff; @@ -1309,7 +1320,8 @@ class Item_func_set_user_var :public Item_func public: LEX_STRING name; // keep it public Item_func_set_user_var(LEX_STRING a,Item *b) - :Item_func(b), cached_result_type(INT_RESULT), name(a) + :Item_func(b), cached_result_type(INT_RESULT), + entry(NULL), entry_thd(NULL), name(a) {} enum Functype functype() const { return SUSERVAR_FUNC; } double val_real(); @@ -1340,6 +1352,7 @@ public: } void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); } bool register_field_in_read_map(uchar *arg); + bool set_entry(THD *thd, bool create_if_not_exists); }; @@ -1413,24 +1426,36 @@ public: /* A system variable */ +#define GET_SYS_VAR_CACHE_LONG 1 +#define GET_SYS_VAR_CACHE_DOUBLE 2 +#define GET_SYS_VAR_CACHE_STRING 4 + class Item_func_get_system_var :public Item_func { sys_var *var; - enum_var_type var_type; + enum_var_type var_type, orig_var_type; LEX_STRING component; + longlong cached_llval; + double cached_dval; + String cached_strval; + my_bool cached_null_value; + query_id_t used_query_id; + uchar cache_present; + public: Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg, LEX_STRING *component_arg, const char *name_arg, size_t name_len_arg); - bool fix_fields(THD *thd, Item **ref); - /* - Stubs for pure virtual methods. Should never be called: this - item is always substituted with a constant in fix_fields(). - */ - double val_real() { DBUG_ASSERT(0); return 0.0; } - longlong val_int() { DBUG_ASSERT(0); return 0; } - String* val_str(String*) { DBUG_ASSERT(0); return 0; } - void fix_length_and_dec() { DBUG_ASSERT(0); } + enum Functype functype() const { return GSYSVAR_FUNC; } + void fix_length_and_dec(); + void print(String *str, enum_query_type query_type); + bool const_item() const { return true; } + table_map used_tables() const { return 0; } + enum Item_result result_type() const; + enum_field_types field_type() const; + double val_real(); + longlong val_int(); + String* val_str(String*); /* TODO: fix to support views */ const char *func_name() const { return "get_system_var"; } /** @@ -1442,6 +1467,9 @@ public: @return true if the variable is written to the binlog, false otherwise. */ bool is_written_to_binlog(); + bool eq(const Item *item, bool binary_cmp) const; + + void cleanup(); }; |