summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-13 14:18:46 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-13 14:18:46 +0300
commit4bf81165e45eb13c0be0042773a0fcbafdf3803b (patch)
tree024356d2458230c53fe64c589693908e101816ac /sql
parent45a87c685b1378d3840df3e391134afb01dead6f (diff)
downloadmariadb-git-4bf81165e45eb13c0be0042773a0fcbafdf3803b.tar.gz
Bug #55615 and bug #55564
An user assignment variable expression that's evaluated in a logical expression context (Item::val_bool()) can be pre-calculated in a temporary table for GROUP BY. However when the expression value is used after the temp table creation it was re-evaluated instead of being read from the temp table due to a missing val_bool_result() method. Fixed by implementing the method.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/item_func.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1b13297c951..eecdc801512 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4263,6 +4263,14 @@ longlong Item_func_set_user_var::val_int_result()
return entry->val_int(&null_value);
}
+bool Item_func_set_user_var::val_bool_result()
+{
+ DBUG_ASSERT(fixed == 1);
+ check(TRUE);
+ update(); // Store expression
+ return entry->val_int(&null_value) != 0;
+}
+
String *Item_func_set_user_var::str_result(String *str)
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_func.h b/sql/item_func.h
index 71168c64e4b..256348eee08 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1353,6 +1353,7 @@ public:
my_decimal *val_decimal(my_decimal *);
double val_result();
longlong val_int_result();
+ bool val_bool_result();
String *str_result(String *str);
my_decimal *val_decimal_result(my_decimal *);
bool is_null_result();