summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-03-27 01:07:09 +0100
committerunknown <guilhem@mysql.com>2004-03-27 01:07:09 +0100
commitec4a9dc983843032aa2a73f1c61d728dc36a3b08 (patch)
tree4a804c1e3f99185976ad3d15e10f6f2b147886a7 /sql/set_var.h
parent266d36196dc92babd1e934b35573b957d89de56d (diff)
downloadmariadb-git-ec4a9dc983843032aa2a73f1c61d728dc36a3b08.tar.gz
A previous changeset by me today about SQL_LOG_BIN had the problem
that it tested the privilege in ::update() whereas it should be in ::check() (see email from Serg, subject "Re: bk commit - 4.1 tree (guilhem:1.1706)"). So I add instead a check_func function to sys_var_thd_bit. I do the same addition to sys_var_thd_ulong, to unify handling of PSEUDO_THREAD_ID with the one of SQL_LOG_BIN. So class sys_var_pseudo_thread_id is not needed anymore, removing it. mysql-test/r/rpl_temporary.result: result update mysql-test/t/rpl_temporary.test: tests after new way of fixing; verify that when second variable assignment is refused then first is not done. sql/set_var.cc: a check_func (check_log_update) when setting SQL_LOG_BIN, and one when setting PSEUDO_THREAD_ID. Removing class sys_var_pseudo_thread_id. Updates for new prototypes of constructor in sys_var_thd_bit and sys_var_thd_ulong. sql/set_var.h: Adding check_func to sys_var_thd_bit. Adding check_func to sys_var_thd_ulong, so class sys_var_pseudo_thread_id is not needed anymore, removing it.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h32
1 files changed, 12 insertions, 20 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index dc5b1bf927f..fbc03af714c 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -231,30 +231,23 @@ public:
class sys_var_thd_ulong :public sys_var_thd
{
+ sys_check_func check_func;
public:
ulong SV::*offset;
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd(name_arg), offset(offset_arg)
+ :sys_var_thd(name_arg), check_func(0), offset(offset_arg)
{}
sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg,
- sys_after_update_func func)
- :sys_var_thd(name_arg,func), offset(offset_arg)
+ sys_check_func c_func, sys_after_update_func au_func)
+ :sys_var_thd(name_arg,au_func), check_func(c_func), offset(offset_arg)
{}
+ bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE type() { return SHOW_LONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
-class sys_var_pseudo_thread_id :public sys_var_thd_ulong
-{
-public:
- sys_var_pseudo_thread_id(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd_ulong(name_arg, offset_arg)
- {}
- bool check(THD *thd, set_var *var);
-};
-
class sys_var_thd_ha_rows :public sys_var_thd
{
@@ -402,19 +395,18 @@ public:
class sys_var_thd_bit :public sys_var_thd
{
+ sys_check_func check_func;
sys_update_func update_func;
public:
ulong bit_flag;
bool reverse;
- sys_var_thd_bit(const char *name_arg, sys_update_func func, ulong bit,
- bool reverse_arg=0)
- :sys_var_thd(name_arg), update_func(func), bit_flag(bit),
- reverse(reverse_arg)
+ sys_var_thd_bit(const char *name_arg,
+ sys_check_func c_func, sys_update_func u_func,
+ ulong bit, bool reverse_arg=0)
+ :sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
+ bit_flag(bit), reverse(reverse_arg)
{}
- bool check(THD *thd, set_var *var)
- {
- return check_enum(thd, var, &bool_typelib);
- }
+ bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
bool check_update_type(Item_result type) { return 0; }
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }