summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorunknown <ramil@poseidon.ndb.mysql.com>2005-11-06 01:36:40 +0100
committerunknown <ramil@poseidon.ndb.mysql.com>2005-11-06 01:36:40 +0100
commitd090acf3203b4bf1756f051e00eac909c9572aa4 (patch)
tree1707a2584dbcc072b0ee59d90c6ce1371a192fe4 /sql/set_var.h
parentcf02f52cc098dce1135ec75fbc40fa03eb90088b (diff)
downloadmariadb-git-d090acf3203b4bf1756f051e00eac909c9572aa4.tar.gz
1. sys_variables[] array is removed.
2. All have_xxx variables are now selectable. sql/set_var.cc: 1. sys_have_xxx variables added. 2. Removed sys_var *sys_variables[] array as we don't need it any more. 3. void set_var_init() changed to use sys_var_xxx chain insted of sys_variables[] array. sql/set_var.h: 1. add_sys_var() method added to the sys_var class. It's called from constructors to chain all successor objects. The first one is stored in the 'static sys_var *first'. The total number of variables is in the 'static uint sys_vars'. Each sys_var successor object has the 'sys_var *next' pointer to the next one in the chain. 2. sys_var_have_variable class introduced to make all have_xxx variables selectable. sql/sql_lex.cc: trg_new_row_fake_var(0, 0) replaced with '(sys_var*) 0x01' as we don't want to have such fake variables in the sys_var_xxx chain. sql/sql_lex.h: Proper use of the changed trg_new_row_fake_var. sql/sql_yacc.yy: Proper use of the changed trg_new_row_fake_var.
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index c9566afed65..c1d91bb1973 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd);
class sys_var
{
public:
+ static sys_var *first;
+ static uint sys_vars;
+ sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */
const char *name;
@@ -48,12 +51,18 @@ public:
sys_var(const char *name_arg)
:name(name_arg), after_update(0)
, no_support_one_shot(1)
- {}
+ { add_sys_var(); }
sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg), after_update(func)
, no_support_one_shot(1)
- {}
+ { add_sys_var(); }
virtual ~sys_var() {}
+ void add_sys_var()
+ {
+ next= first;
+ first= this;
+ sys_vars++;
+ }
virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
@@ -701,6 +710,30 @@ public:
bool is_readonly() const { return 1; }
};
+
+class sys_var_have_variable: public sys_var
+{
+ SHOW_COMP_OPTION *have_variable;
+
+public:
+ sys_var_have_variable(const char *variable_name,
+ SHOW_COMP_OPTION *have_variable_arg):
+ sys_var(variable_name),
+ have_variable(have_variable_arg)
+ { }
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ {
+ return (byte*) show_comp_option_name[*have_variable];
+ }
+ bool update(THD *thd, set_var *var) { return 1; }
+ bool check_default(enum_var_type type) { return 1; }
+ bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
+ bool check_update_type(Item_result type) { return 1; }
+ SHOW_TYPE type() { return SHOW_CHAR; }
+ bool is_readonly() const { return 1; }
+};
+
+
class sys_var_thd_time_zone :public sys_var_thd
{
public: