diff options
author | evgen@sunlight.local <> | 2006-08-22 17:37:41 +0400 |
---|---|---|
committer | evgen@sunlight.local <> | 2006-08-22 17:37:41 +0400 |
commit | f17a536e097fdfe982cf5ccf8102d24199061593 (patch) | |
tree | c314e2e59971f43503941c43503c52cd6a91e4a1 /sql/item_func.h | |
parent | 07a1ed651fb28946ace14bb8ee44b0107c09cf3c (diff) | |
download | mariadb-git-f17a536e097fdfe982cf5ccf8102d24199061593.tar.gz |
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was
used.
Sorting by RAND() uses a temporary table in order to get a correct results.
User defined variable was set during filling the temporary table and later
on it is substituted for its value from the temporary table. Due to this
it contains the last value stored in the temporary table.
Now if the result_field is set for the Item_func_set_user_var object it
updates variable from the result_field value when being sent to a client.
The Item_func_set_user_var::check() now accepts a use_result_field
parameter. Depending on its value the result_field or the args[0] is used
to get current value.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 30b62f3642d..09429accbad 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -54,7 +54,7 @@ public: SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN, NOT_FUNC, NOT_ALL_FUNC, NOW_FUNC, TRIG_COND_FUNC, - GUSERVAR_FUNC, COLLATE_FUNC, + SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC }; enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL, OPTIMIZE_EQUAL }; @@ -1167,13 +1167,15 @@ public: Item_func_set_user_var(LEX_STRING a,Item *b) :Item_func(b), cached_result_type(INT_RESULT), name(a) {} + enum Functype functype() const { return SUSERVAR_FUNC; } double val_real(); longlong val_int(); String *val_str(String *str); my_decimal *val_decimal(my_decimal *); bool update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0); - bool check(); + bool send(Protocol *protocol, String *str_arg); + bool check(bool use_result_field); bool update(); enum Item_result result_type () const { return cached_result_type; } bool fix_fields(THD *thd, Item **ref); |