summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorStaale Smedseng <staale.smedseng@sun.com>2009-06-19 11:27:19 +0200
committerStaale Smedseng <staale.smedseng@sun.com>2009-06-19 11:27:19 +0200
commit37d2019d1756d630d48ab23ca41f7c595862c7f4 (patch)
tree5e93e031147ed30778696a93de12bcf06f5d00f2 /sql/set_var.h
parent544147417a567c2a40e8cf01e25c7785e26887a1 (diff)
downloadmariadb-git-37d2019d1756d630d48ab23ca41f7c595862c7f4.tar.gz
Bug #32223 SETting max_allowed_packet variable
Inconsistent behavior of session variable max_allowed_packet (and net_buffer_length); only assignment to the global variable has any effect, without this being obvious to the user. The patch for Bug#22891 is backported to 5.0, making the two session variables read-only. As this is a backport to GA software, the error used when trying to assign to the read- only variable is ER_UNKNOWN_ERROR. The error message is the same as in 5.1+. mysql-test/t/variables.test: Tests are changed to account for the new semantics, and assignment to the read-only variables is added to test the emission of the correct error message. sql/set_var.cc: Both max_allowed_packet and net_buffer_length are changed to be of type sys_var_thd_ulong_session_readonly. ER_UNKNOWN_ERROR is used to indicate an attempt to assign to an instance of a read-only variable. sql/set_var.h: Class sys_var_thd_ulong_session_readonly is added.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index f43d3b75cee..5fb883e8b86 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -873,6 +873,28 @@ public:
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
+
+/**
+ * @brief This is a specialization of sys_var_thd_ulong that implements a
+ read-only session variable. The class overrides check() and check_default()
+ to achieve the read-only property for the session part of the variable.
+ */
+class sys_var_thd_ulong_session_readonly : public sys_var_thd_ulong
+{
+public:
+ sys_var_thd_ulong_session_readonly(const char *name_arg, ulong SV::*offset_arg,
+ sys_check_func c_func= NULL,
+ sys_after_update_func au_func= NULL):
+ sys_var_thd_ulong(name_arg, offset_arg, c_func, au_func)
+ { }
+ bool check(THD *thd, set_var *var);
+ bool check_default(enum_var_type type)
+ {
+ return type != OPT_GLOBAL || !option_limits;
+ }
+};
+
+
class sys_var_trust_routine_creators :public sys_var_bool_ptr
{
/* We need a derived class only to have a warn_deprecated() */