summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mysql.com>2007-04-16 10:37:50 +0200
committerunknown <serg@sergbook.mysql.com>2007-04-16 10:37:50 +0200
commit7cb8a33b1af33dcd8806ec6021655a39f375d904 (patch)
treedf4c92bcf5668ec88685604378ad6dc60bfcf269 /sql/set_var.h
parent2e73a53e033741b09a652646d9cfa0e76c33e6a1 (diff)
parentadd378761542ade65340b9477ed298e9a1677b10 (diff)
downloadmariadb-git-7cb8a33b1af33dcd8806ec6021655a39f375d904.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.1-wl2936 client/mysql.cc: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/mysql.h: Auto merged mysql-test/r/im_utils.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/ndb_dd_basic.test: Auto merged mysql-test/t/partition_innodb.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/array.c: Auto merged mysys/typelib.c: Auto merged sql/event_queue.cc: Auto merged sql/ha_partition.cc: Auto merged sql/ha_partition.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item_func.cc: Auto merged sql/item_sum.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/set_var.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged storage/example/ha_example.cc: Auto merged storage/federated/ha_federated.cc: Auto merged storage/heap/ha_heap.cc: Auto merged storage/innobase/include/trx0trx.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged storage/ndb/src/mgmsrv/InitConfigFileParser.cpp: Auto merged include/typelib.h: merged mysql-test/mysql-test-run.pl: merged mysql-test/r/flush2.result: merged mysql-test/r/ndb_dd_basic.result: merged mysql-test/r/partition_innodb.result: merged mysql-test/r/ps_1general.result: merged mysql-test/t/ps_1general.test: merged sql/ha_ndbcluster.cc: merged sql/item_create.cc: merged sql/mysqld.cc: merged sql/rpl_utility.h: merged sql/set_var.cc: merged sql/sql_class.cc: merged sql/sql_yacc.yy: merged storage/innobase/handler/ha_innodb.cc: merged storage/innobase/handler/ha_innodb.h: merged
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h391
1 files changed, 203 insertions, 188 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index a3963171192..5ec7eb7ef4a 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -26,6 +26,7 @@
class sys_var;
class set_var;
+class sys_var_pluginvar; /* opaque */
typedef struct system_variables SV;
typedef struct my_locale_st MY_LOCALE;
@@ -37,11 +38,15 @@ typedef void (*sys_after_update_func)(THD *,enum_var_type);
typedef void (*sys_set_default_func)(THD *, enum_var_type);
typedef byte *(*sys_value_ptr_func)(THD *thd);
+struct sys_var_chain
+{
+ sys_var *first;
+ sys_var *last;
+};
+
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() */
@@ -52,13 +57,15 @@ public:
sys_var(const char *name_arg,sys_after_update_func func= NULL)
:name(name_arg), after_update(func)
, no_support_one_shot(1)
- { add_sys_var(); }
+ {}
virtual ~sys_var() {}
- void add_sys_var()
+ void chain_sys_var(sys_var_chain *chain_arg)
{
- next= first;
- first= this;
- sys_vars++;
+ if (chain_arg->last)
+ chain_arg->last->next= this;
+ else
+ chain_arg->first= this;
+ chain_arg->last= this;
}
virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, const TYPELIB *enum_names);
@@ -77,6 +84,7 @@ public:
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
+ virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
};
@@ -105,12 +113,12 @@ class sys_var_long_ptr_global: public sys_var_global
{
public:
ulong *value;
- sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr_arg,
+ sys_var_long_ptr_global(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_arg,
pthread_mutex_t *guard_arg,
sys_after_update_func after_update_arg= NULL)
:sys_var_global(name_arg, after_update_arg, guard_arg),
value(value_ptr_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
@@ -127,7 +135,7 @@ public:
class sys_var_long_ptr :public sys_var_long_ptr_global
{
public:
- sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
+ sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr,
sys_after_update_func after_update_arg= NULL);
};
@@ -136,11 +144,13 @@ class sys_var_ulonglong_ptr :public sys_var
{
public:
ulonglong *value;
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg)
- :sys_var(name_arg),value(value_ptr_arg) {}
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg,
+ sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
+ :sys_var(name_arg),value(value_ptr_arg)
+ { chain_sys_var(chain); }
+ sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
sys_after_update_func func)
- :sys_var(name_arg,func), value(value_ptr_arg) {}
+ :sys_var(name_arg,func), value(value_ptr_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -153,9 +163,9 @@ class sys_var_bool_ptr :public sys_var
{
public:
my_bool *value;
- sys_var_bool_ptr(const char *name_arg, my_bool *value_arg)
+ sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
:sys_var(name_arg),value(value_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
return check_enum(thd, var, &bool_typelib);
@@ -187,14 +197,14 @@ public:
sys_check_func check_func;
sys_update_func update_func;
sys_set_default_func set_default_func;
- sys_var_str(const char *name_arg,
+ sys_var_str(sys_var_chain *chain, const char *name_arg,
sys_check_func check_func_arg,
sys_update_func update_func_arg,
sys_set_default_func set_default_func_arg,
char *value_arg)
:sys_var(name_arg), value(value_arg), check_func(check_func_arg),
update_func(update_func_arg),set_default_func(set_default_func_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var)
{
@@ -219,9 +229,9 @@ class sys_var_const_str :public sys_var
{
public:
char *value; // Pointer to const value
- sys_var_const_str(const char *name_arg, const char *value_arg)
+ sys_var_const_str(sys_var_chain *chain, const char *name_arg, const char *value_arg)
:sys_var(name_arg),value((char*) value_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
return 1;
@@ -248,9 +258,9 @@ class sys_var_const_str_ptr :public sys_var
{
public:
char **value; // Pointer to const value
- sys_var_const_str_ptr(const char *name_arg, char **value_arg)
+ sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
:sys_var(name_arg),value(value_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
return 1;
@@ -278,10 +288,10 @@ class sys_var_enum :public sys_var
uint *value;
TYPELIB *enum_names;
public:
- sys_var_enum(const char *name_arg, uint *value_arg,
+ sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
return check_enum(thd, var, enum_names);
@@ -296,7 +306,8 @@ public:
class sys_var_thd :public sys_var
{
public:
- sys_var_thd(const char *name_arg, sys_after_update_func func= NULL)
+ sys_var_thd(const char *name_arg,
+ sys_after_update_func func= NULL)
:sys_var(name_arg,func)
{}
bool check_type(enum_var_type type) { return 0; }
@@ -312,13 +323,13 @@ 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_ulong(sys_var_chain *chain, const char *name_arg, ulong SV::*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,
+ { chain_sys_var(chain); }
+ sys_var_thd_ulong(sys_var_chain *chain, const char *name_arg, ulong SV::*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)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
@@ -331,13 +342,15 @@ class sys_var_thd_ha_rows :public sys_var_thd
{
public:
ha_rows SV::*offset;
- sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
+ sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg,
+ ha_rows SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
- {}
- sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
+ { chain_sys_var(chain); }
+ sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg,
+ ha_rows SV::*offset_arg,
sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg)
- {}
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
@@ -350,14 +363,16 @@ class sys_var_thd_ulonglong :public sys_var_thd
public:
ulonglong SV::*offset;
bool only_global;
- sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg)
+ sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
+ ulonglong SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
- {}
- sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg,
+ { chain_sys_var(chain); }
+ sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
+ ulonglong SV::*offset_arg,
sys_after_update_func func, bool only_global_arg)
:sys_var_thd(name_arg, func), offset(offset_arg),
only_global(only_global_arg)
- {}
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -377,13 +392,13 @@ class sys_var_thd_bool :public sys_var_thd
{
public:
my_bool SV::*offset;
- sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg)
+ sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
- {}
- sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg,
+ { chain_sys_var(chain); }
+ sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg,
sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg)
- {}
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
@@ -403,23 +418,23 @@ protected:
TYPELIB *enum_names;
sys_check_func check_func;
public:
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ sys_var_thd_enum(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib)
:sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib),
check_func(0)
- {}
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ { chain_sys_var(chain); }
+ sys_var_thd_enum(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib,
sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(0)
- {}
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ { chain_sys_var(chain); }
+ sys_var_thd_enum(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib, sys_after_update_func func,
sys_check_func check)
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(check)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
int ret= 0;
@@ -440,8 +455,9 @@ extern void fix_sql_mode_var(THD *thd, enum_var_type type);
class sys_var_thd_sql_mode :public sys_var_thd_enum
{
public:
- sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib,
+ sys_var_thd_sql_mode(sys_var_chain *chain, const char *name_arg,
+ ulong SV::*offset_arg)
+ :sys_var_thd_enum(chain, name_arg, offset_arg, &sql_mode_typelib,
fix_sql_mode_var)
{}
bool check(THD *thd, set_var *var)
@@ -458,11 +474,12 @@ public:
class sys_var_thd_storage_engine :public sys_var_thd
{
protected:
- handlerton *SV::*offset;
+ plugin_ref SV::*offset;
public:
- sys_var_thd_storage_engine(const char *name_arg, handlerton *SV::*offset_arg)
+ sys_var_thd_storage_engine(sys_var_chain *chain, const char *name_arg,
+ plugin_ref SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
@@ -477,8 +494,9 @@ public:
class sys_var_thd_table_type :public sys_var_thd_storage_engine
{
public:
- sys_var_thd_table_type(const char *name_arg, handlerton *SV::*offset_arg)
- :sys_var_thd_storage_engine(name_arg, offset_arg)
+ sys_var_thd_table_type(sys_var_chain *chain, const char *name_arg,
+ plugin_ref SV::*offset_arg)
+ :sys_var_thd_storage_engine(chain, name_arg, offset_arg)
{}
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
@@ -492,12 +510,12 @@ class sys_var_thd_bit :public sys_var_thd
public:
ulonglong bit_flag;
bool reverse;
- sys_var_thd_bit(const char *name_arg,
+ sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
sys_check_func c_func, sys_update_func u_func,
ulonglong bit, bool reverse_arg=0)
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
bit_flag(bit), reverse(reverse_arg)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
bool check_update_type(Item_result type) { return 0; }
@@ -509,7 +527,9 @@ public:
class sys_var_thd_dbug :public sys_var_thd
{
public:
- sys_var_thd_dbug(const char *name_arg) :sys_var_thd(name_arg) {}
+ sys_var_thd_dbug(sys_var_chain *chain, const char *name_arg)
+ :sys_var_thd(name_arg)
+ { chain_sys_var(chain); }
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; }
@@ -525,7 +545,9 @@ public:
class sys_var_timestamp :public sys_var
{
public:
- sys_var_timestamp(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_timestamp(sys_var_chain *chain, const char *name_arg)
+ :sys_var(name_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
@@ -538,7 +560,9 @@ public:
class sys_var_last_insert_id :public sys_var
{
public:
- sys_var_last_insert_id(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_last_insert_id(sys_var_chain *chain, const char *name_arg)
+ :sys_var(name_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -549,7 +573,9 @@ public:
class sys_var_insert_id :public sys_var
{
public:
- sys_var_insert_id(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_insert_id(sys_var_chain *chain, const char *name_arg)
+ :sys_var(name_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -557,33 +583,12 @@ public:
};
-#ifdef HAVE_REPLICATION
-class sys_var_slave_skip_counter :public sys_var
-{
-public:
- sys_var_slave_skip_counter(const char *name_arg) :sys_var(name_arg) {}
- bool check(THD *thd, set_var *var);
- bool update(THD *thd, set_var *var);
- bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
- /*
- We can't retrieve the value of this, so we don't have to define
- show_type() or value_ptr()
- */
-};
-
-class sys_var_sync_binlog_period :public sys_var_long_ptr
-{
-public:
- sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr_arg)
- :sys_var_long_ptr(name_arg,value_ptr_arg) {}
- bool update(THD *thd, set_var *var);
-};
-#endif
-
class sys_var_rand_seed1 :public sys_var
{
public:
- sys_var_rand_seed1(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_rand_seed1(sys_var_chain *chain, const char *name_arg)
+ :sys_var(name_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
};
@@ -591,7 +596,9 @@ public:
class sys_var_rand_seed2 :public sys_var
{
public:
- sys_var_rand_seed2(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_rand_seed2(sys_var_chain *chain, const char *name_arg)
+ :sys_var(name_arg)
+ { chain_sys_var(chain); }
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
};
@@ -600,7 +607,8 @@ public:
class sys_var_collation :public sys_var_thd
{
public:
- sys_var_collation(const char *name_arg) :sys_var_thd(name_arg)
+ sys_var_collation(const char *name_arg)
+ :sys_var_thd(name_arg)
{
no_support_one_shot= 0;
}
@@ -618,10 +626,9 @@ class sys_var_character_set :public sys_var_thd
{
public:
bool nullable;
- sys_var_character_set(const char *name_arg) :
- sys_var_thd(name_arg)
+ sys_var_character_set(const char *name_arg, bool is_nullable= 0) :
+ sys_var_thd(name_arg), nullable(is_nullable)
{
- nullable= 0;
/*
In fact only almost all variables derived from sys_var_character_set
support ONE_SHOT; character_set_results doesn't. But that's good enough.
@@ -641,83 +648,47 @@ public:
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
};
-class sys_var_character_set_filesystem :public sys_var_character_set
-{
-public:
- sys_var_character_set_filesystem(const char *name_arg) :
- sys_var_character_set(name_arg) {}
- void set_default(THD *thd, enum_var_type type);
- CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
-};
-
-class sys_var_character_set_client :public sys_var_character_set
-{
-public:
- sys_var_character_set_client(const char *name_arg) :
- sys_var_character_set(name_arg) {}
- void set_default(THD *thd, enum_var_type type);
- CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
-};
-class sys_var_character_set_results :public sys_var_character_set
+class sys_var_character_set_sv :public sys_var_character_set
{
+ CHARSET_INFO *SV::*offset;
+ CHARSET_INFO **global_default;
public:
- sys_var_character_set_results(const char *name_arg) :
- sys_var_character_set(name_arg)
- { nullable= 1; }
+ sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
+ CHARSET_INFO *SV::*offset_arg,
+ CHARSET_INFO **global_default_arg,
+ bool is_nullable= 0)
+ : sys_var_character_set(name_arg, is_nullable),
+ offset(offset_arg), global_default(global_default_arg)
+ { chain_sys_var(chain); }
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
-class sys_var_character_set_server :public sys_var_character_set
-{
-public:
- sys_var_character_set_server(const char *name_arg) :
- sys_var_character_set(name_arg) {}
- void set_default(THD *thd, enum_var_type type);
- CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
-};
class sys_var_character_set_database :public sys_var_character_set
{
public:
- sys_var_character_set_database(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_database(sys_var_chain *chain, const char *name_arg) :
+ sys_var_character_set(name_arg)
+ { chain_sys_var(chain); }
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
-class sys_var_character_set_connection :public sys_var_character_set
+class sys_var_collation_sv :public sys_var_collation
{
+ CHARSET_INFO *SV::*offset;
+ CHARSET_INFO **global_default;
public:
- sys_var_character_set_connection(const char *name_arg) :
- sys_var_character_set(name_arg) {}
- void set_default(THD *thd, enum_var_type type);
- CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
-};
-
-class sys_var_collation_connection :public sys_var_collation
-{
-public:
- sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
- bool update(THD *thd, set_var *var);
- void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
-};
-
-class sys_var_collation_server :public sys_var_collation
-{
-public:
- sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
- bool update(THD *thd, set_var *var);
- void set_default(THD *thd, enum_var_type type);
- byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
-};
-
-class sys_var_collation_database :public sys_var_collation
-{
-public:
- sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
+ sys_var_collation_sv(sys_var_chain *chain, const char *name_arg,
+ CHARSET_INFO *SV::*offset_arg,
+ CHARSET_INFO **global_default_arg)
+ :sys_var_collation(name_arg),
+ offset(offset_arg), global_default(global_default_arg)
+ {
+ chain_sys_var(chain);
+ }
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
@@ -729,9 +700,10 @@ class sys_var_key_cache_param :public sys_var
protected:
size_t offset;
public:
- sys_var_key_cache_param(const char *name_arg, size_t offset_arg)
+ sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg,
+ size_t offset_arg)
:sys_var(name_arg), offset(offset_arg)
- {}
+ { chain_sys_var(chain); }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; }
bool is_struct() { return 1; }
@@ -741,8 +713,9 @@ public:
class sys_var_key_buffer_size :public sys_var_key_cache_param
{
public:
- sys_var_key_buffer_size(const char *name_arg)
- :sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size))
+ sys_var_key_buffer_size(sys_var_chain *chain, const char *name_arg)
+ :sys_var_key_cache_param(chain, name_arg,
+ offsetof(KEY_CACHE, param_buff_size))
{}
bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -752,8 +725,8 @@ public:
class sys_var_key_cache_long :public sys_var_key_cache_param
{
public:
- sys_var_key_cache_long(const char *name_arg, size_t offset_arg)
- :sys_var_key_cache_param(name_arg, offset_arg)
+ sys_var_key_cache_long(sys_var_chain *chain, const char *name_arg, size_t offset_arg)
+ :sys_var_key_cache_param(chain, name_arg, offset_arg)
{}
bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_LONG; }
@@ -765,12 +738,12 @@ class sys_var_thd_date_time_format :public sys_var_thd
DATE_TIME_FORMAT *SV::*offset;
timestamp_type date_time_type;
public:
- sys_var_thd_date_time_format(const char *name_arg,
+ sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
DATE_TIME_FORMAT *SV::*offset_arg,
timestamp_type date_time_type_arg)
:sys_var_thd(name_arg), offset(offset_arg),
date_time_type(date_time_type_arg)
- {}
+ { chain_sys_var(chain); }
SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
@@ -789,8 +762,9 @@ class sys_var_log_state :public sys_var_bool_ptr
{
uint log_type;
public:
- sys_var_log_state(const char *name_arg, my_bool *value_arg, uint log_type_arg)
- :sys_var_bool_ptr(name_arg, value_arg), log_type(log_type_arg) {}
+ sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg,
+ uint log_type_arg)
+ :sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
};
@@ -801,10 +775,10 @@ class sys_var_log_output :public sys_var
ulong *value;
TYPELIB *enum_names;
public:
- sys_var_log_output(const char *name_arg, ulong *value_arg,
+ sys_var_log_output(sys_var_chain *chain, const char *name_arg, ulong *value_arg,
TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
- {}
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var)
{
return check_set(thd, var, enum_names);
@@ -825,12 +799,12 @@ public:
enum_var_type var_type;
SHOW_TYPE show_type_value;
sys_value_ptr_func value_ptr_func;
- sys_var_readonly(const char *name_arg, enum_var_type type,
+ sys_var_readonly(sys_var_chain *chain, const char *name_arg, enum_var_type type,
SHOW_TYPE show_type_arg,
sys_value_ptr_func value_ptr_func_arg)
:sys_var(name_arg), var_type(type),
show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
- {}
+ { chain_sys_var(chain); }
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 != var_type; }
@@ -844,19 +818,17 @@ public:
};
-class sys_var_have_variable: public sys_var
+class sys_var_have_option: public sys_var
{
- SHOW_COMP_OPTION *have_variable;
-
+protected:
+ virtual SHOW_COMP_OPTION get_option() = 0;
public:
- sys_var_have_variable(const char *variable_name,
- SHOW_COMP_OPTION *have_variable_arg):
- sys_var(variable_name),
- have_variable(have_variable_arg)
- { }
+ sys_var_have_option(sys_var_chain *chain, const char *variable_name):
+ sys_var(variable_name)
+ { chain_sys_var(chain); }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
- return (byte*) show_comp_option_name[*have_variable];
+ return (byte*) show_comp_option_name[get_option()];
}
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
@@ -867,13 +839,47 @@ public:
};
+class sys_var_have_variable: public sys_var_have_option
+{
+ SHOW_COMP_OPTION *have_variable;
+
+public:
+ sys_var_have_variable(sys_var_chain *chain, const char *variable_name,
+ SHOW_COMP_OPTION *have_variable_arg):
+ sys_var_have_option(chain, variable_name),
+ have_variable(have_variable_arg)
+ { }
+ SHOW_COMP_OPTION get_option() { return *have_variable; }
+};
+
+
+class sys_var_have_plugin: public sys_var_have_option
+{
+ const char *plugin_name_str;
+ const uint plugin_name_len;
+ const int plugin_type;
+
+public:
+ sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
+ const char *plugin_name_str_arg, uint plugin_name_len_arg,
+ int plugin_type_arg):
+ sys_var_have_option(chain, variable_name),
+ plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
+ plugin_type(plugin_type_arg)
+ { }
+ /* the following method is declared in sql_plugin.cc */
+ SHOW_COMP_OPTION get_option();
+};
+
+
class sys_var_thd_time_zone :public sys_var_thd
{
public:
- sys_var_thd_time_zone(const char *name_arg):
+ sys_var_thd_time_zone(sys_var_chain *chain, const char *name_arg):
sys_var_thd(name_arg)
{
no_support_one_shot= 0;
+ chain_sys_var(chain);
}
bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; }
@@ -891,8 +897,9 @@ public:
class sys_var_max_user_conn : public sys_var_thd
{
public:
- sys_var_max_user_conn(const char *name_arg):
- sys_var_thd(name_arg) {}
+ sys_var_max_user_conn(sys_var_chain *chain, const char *name_arg):
+ sys_var_thd(name_arg)
+ { chain_sys_var(chain); }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
bool check_default(enum_var_type type)
@@ -908,8 +915,9 @@ class sys_var_trust_routine_creators :public sys_var_bool_ptr
{
/* We need a derived class only to have a warn_deprecated() */
public:
- sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) :
- sys_var_bool_ptr(name_arg, value_arg) {};
+ sys_var_trust_routine_creators(sys_var_chain *chain, const char *name_arg,
+ my_bool *value_arg) :
+ sys_var_bool_ptr(chain, name_arg, value_arg) {};
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
@@ -923,8 +931,9 @@ public:
class sys_var_opt_readonly :public sys_var_bool_ptr
{
public:
- sys_var_opt_readonly(const char *name_arg, my_bool *value_arg) :
- sys_var_bool_ptr(name_arg, value_arg) {};
+ sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg,
+ my_bool *value_arg) :
+ sys_var_bool_ptr(chain, name_arg, value_arg) {};
~sys_var_opt_readonly() {};
bool update(THD *thd, set_var *var);
};
@@ -933,12 +942,13 @@ public:
class sys_var_thd_lc_time_names :public sys_var_thd
{
public:
- sys_var_thd_lc_time_names(const char *name_arg):
- sys_var_thd(name_arg)
+ sys_var_thd_lc_time_names(sys_var_chain *chain, const char *name_arg):
+ sys_var_thd(name_arg)
{
#if MYSQL_VERSION_ID < 50000
no_support_one_shot= 0;
#endif
+ chain_sys_var(chain);
}
bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; }
@@ -957,8 +967,8 @@ class sys_var_event_scheduler :public sys_var_long_ptr
{
/* We need a derived class only to have a warn_deprecated() */
public:
- sys_var_event_scheduler(const char *name_arg) :
- sys_var_long_ptr(name_arg, NULL, NULL) {};
+ sys_var_event_scheduler(sys_var_chain *chain, const char *name_arg) :
+ sys_var_long_ptr(chain, name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
SHOW_TYPE show_type() { return SHOW_CHAR; }
@@ -974,8 +984,9 @@ extern void fix_binlog_format_after_update(THD *thd, enum_var_type type);
class sys_var_thd_binlog_format :public sys_var_thd_enum
{
public:
- sys_var_thd_binlog_format(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd_enum(name_arg, offset_arg,
+ sys_var_thd_binlog_format(sys_var_chain *chain, const char *name_arg,
+ ulong SV::*offset_arg)
+ :sys_var_thd_enum(chain, name_arg, offset_arg,
&binlog_format_typelib
, fix_binlog_format_after_update
)
@@ -1013,7 +1024,7 @@ public:
CHARSET_INFO *charset;
ulong ulong_value;
ulonglong ulonglong_value;
- handlerton *hton;
+ plugin_ref plugin;
DATE_TIME_FORMAT *date_time_format;
Time_zone *time_zone;
MY_LOCALE *locale_value;
@@ -1142,9 +1153,13 @@ struct sys_var_with_base
Prototypes for helper functions
*/
-void set_var_init();
+int set_var_init();
void set_var_free();
-sys_var *find_sys_var(const char *str, uint length=0);
+int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
+SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
+int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
+int mysql_del_sys_var_chain(sys_var *chain);
+sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
bool not_all_support_one_shot(List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);