summaryrefslogtreecommitdiff
path: root/sql/set_var.h
diff options
context:
space:
mode:
authorIngo Struewing <ingo.struewing@sun.com>2008-11-22 00:22:21 +0100
committerIngo Struewing <ingo.struewing@sun.com>2008-11-22 00:22:21 +0100
commitf92c5731453fd73077bb4a8034a5c351d89f091f (patch)
treea8e411aa264d817a003cdcf4cbcd4eae74aab63b /sql/set_var.h
parent75a6be98e06587190472106b582723944b76426b (diff)
downloadmariadb-git-f92c5731453fd73077bb4a8034a5c351d89f091f.tar.gz
Bug#28234 - global/session scope - documentation vs implementation
Several system variables did not behave like system variables should do. When trying to SET them or use them in SELECT, they were reported as "unknown system variable". But they appeared in SHOW VARIABLES. This has been fixed by removing the "fixed_vars" array of variables and integrating the variables into the normal system variables chain. All of these variables do now behave as read-only global-only variables. Trying to SET them tells they are read-only, trying to SELECT the session value tells they are global only. Selecting the global value works. It delivers the same value as SHOW VARIABLES. mysql-test/r/variables-notembedded.result: Bug#28234 - global/session scope - documentation vs implementation New test result. mysql-test/r/variables.result: Bug#28234 - global/session scope - documentation vs implementation New test result. mysql-test/t/variables-notembedded.test: Bug#28234 - global/session scope - documentation vs implementation Added a test for each moved variable that is not present in an embedded server. mysql-test/t/variables.test: Bug#28234 - global/session scope - documentation vs implementation Added a test for each moved variable that is also present in an embedded server. sql/item_func.cc: Bug#28234 - global/session scope - documentation vs implementation Added SHOW_BOOL to some Item_func_get_system_var methods. sql/set_var.cc: Bug#28234 - global/session scope - documentation vs implementation Moved all variables from the "fixed_vars" array into the normal system variables chain by using the new variable class sys_var_const. Removed the fixed_show_vars array and its initialization in enumerate_sys_vars(). Removed mysql_append_static_vars(), which added fixed_vars arrays to the fixed_show_vars array. sql/set_var.h: Bug#28234 - global/session scope - documentation vs implementation Added the new system variable class sys_var_const. Removed declaration of mysql_append_static_vars(). sql/slave.cc: Bug#28234 - global/session scope - documentation vs implementation Moved the definition of show_slave_skip_errors() from sql_repl.cc to here and renamed it to print_slave_skip_errors(). Changed print_slave_skip_errors() to create a static buffer with a printable version of the error numbers set. Added a call of print_slave_skip_errors() to init_slave_skip_errors(). sql/slave.h: Bug#28234 - global/session scope - documentation vs implementation Added declaration of slave_skip_error_names. sql/sql_repl.cc: Bug#28234 - global/session scope - documentation vs implementation Moved all variables from the "fixed_vars" array into the normal system variables chain by using the new variable class sys_var_const. Moved the definition of show_slave_skip_errors() to slave.cc and modified it to compute the string once at server initialization only. Removed the call to mysql_append_static_vars().
Diffstat (limited to 'sql/set_var.h')
-rw-r--r--sql/set_var.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/set_var.h b/sql/set_var.h
index ab819694e09..6b62d62706e 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -929,6 +929,34 @@ public:
};
+/**
+ Global-only, read-only variable. E.g. command line option.
+*/
+
+class sys_var_const: public sys_var
+{
+public:
+ enum_var_type var_type;
+ SHOW_TYPE show_type_value;
+ uchar *ptr;
+ sys_var_const(sys_var_chain *chain, const char *name_arg, enum_var_type type,
+ SHOW_TYPE show_type_arg, uchar *ptr_arg)
+ :sys_var(name_arg), var_type(type),
+ show_type_value(show_type_arg), ptr(ptr_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; }
+ bool check_update_type(Item_result type) { return 1; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ {
+ return ptr;
+ }
+ SHOW_TYPE show_type() { return show_type_value; }
+ bool is_readonly() const { return 1; }
+};
+
+
class sys_var_have_option: public sys_var
{
protected:
@@ -1317,7 +1345,6 @@ struct sys_var_with_base
int set_var_init();
void set_var_free();
-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);