diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2008-11-20 08:51:48 +0100 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2008-11-20 08:51:48 +0100 |
commit | e5ae4e2392077508248637981d3276bae8a26e72 (patch) | |
tree | 59c64214e33797199c32b6cd187781eef4dcd755 /sql/set_var.h | |
parent | 36c4b37b16f5f44c97aae330856b742fa708b85f (diff) | |
download | mariadb-git-e5ae4e2392077508248637981d3276bae8a26e72.tar.gz |
A fix for Bug#22891 "session level max_allowed_packet can be
set but is ignored".
This patch makes @@session.max_allowed_packed and
@@session.net_buffer_length read-only as suggested in the bug
report. The user will have to use SET GLOBAL (and reconnect)
to alter the session values of these variables.
The error string ER_VARIABLE_IS_READONLY is introduced.
Tests are modified accordingly.
sql/set_var.cc:
The class sys_var_thd_ulong_session_readonly is introduced as
a specialization of sys_var_thd_ulong implementing 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.
sql/set_var.h:
The class sys_var_thd_ulong_session_readonly is introduced as
a specialization of sys_var_thd_ulong implementing 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.
sql/share/errmsg.txt:
New error ER_VARIABLE_IS_READONLY.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r-- | sql/set_var.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/set_var.h b/sql/set_var.h index 9681c955a98..ab819694e09 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1024,6 +1024,29 @@ public: }; +/** + * @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(sys_var_chain *chain_arg, + const char *name_arg, ulong SV::*offset_arg, + sys_check_func c_func= NULL, + sys_after_update_func au_func= NULL, + Binlog_status_enum bl_status_arg= NOT_IN_BINLOG): + sys_var_thd_ulong(chain_arg, name_arg, offset_arg, c_func, au_func, bl_status_arg) + { } + bool check(THD *thd, set_var *var); + bool check_default(enum_var_type type) + { + return type != OPT_GLOBAL || !option_limits; + } +}; + + class sys_var_microseconds :public sys_var_thd { ulonglong SV::*offset; |