summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-07-16 03:29:13 +0400
committerunknown <konstantin@mysql.com>2005-07-16 03:29:13 +0400
commite83e10533194cca56596226e5c2c08c7bb6d5b9a (patch)
tree7b2a374b6d05a129d4b7e3e16593f7244bdccf90 /sql/item_func.h
parent0f41fb4234c58d9f17385c8f77fe02aa6a1f5b96 (diff)
downloadmariadb-git-e83e10533194cca56596226e5c2c08c7bb6d5b9a.tar.gz
A fix and a test case for Bug#9359 "Prepared statements take snapshot
of system vars at PREPARE time": implement a special Item to handle system variables. This item substitutes itself with a basic constant containing variable value at fix_fields. mysql-test/r/ps.result: - test results fixed (Bug#9359). mysql-test/t/ps.test: - add a test case for Bug#9359 "Prepared statements take snapshot of system vars at PREPARE time" sql/item_func.cc: - implement Item_func_get_system_var: we should not evaluate system variables in the parser, but instead should create an item which is evaluated to a constant at execute. - remove an unused function sql/item_func.h: Add a new item, Item_func_get_system_var sql/mysql_priv.h: Move necessary declarations to make set_var.h objects visible in item_func.h sql/set_var.cc: - we should not print to network from get_system_var: if it's called from prepared statement prepare, we get packets out of order when using the binary protocol. Instead report the error to be sent to the user later. This is a backport from 5.0. sql/set_var.h: - declaration of enum_var_type moved to mysql_priv.h
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index 6b6e5d4b8ec..5e36f9863bb 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -988,6 +988,29 @@ public:
};
+/* A system variable */
+
+class Item_func_get_system_var :public Item_func
+{
+ sys_var *var;
+ enum_var_type var_type;
+ LEX_STRING component;
+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, TABLE_LIST *tables, Item **ref);
+ /*
+ Stubs for pure virtual methods. Should never be called: this
+ item is always substituted with a constant in fix_fields().
+ */
+ double val() { 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); }
+};
+
+
class Item_func_inet_aton : public Item_int_func
{
public: