diff options
author | Ingo Struewing <ingo.struewing@sun.com> | 2008-11-22 00:22:21 +0100 |
---|---|---|
committer | Ingo Struewing <ingo.struewing@sun.com> | 2008-11-22 00:22:21 +0100 |
commit | f92c5731453fd73077bb4a8034a5c351d89f091f (patch) | |
tree | a8e411aa264d817a003cdcf4cbcd4eae74aab63b /sql/item_func.cc | |
parent | 75a6be98e06587190472106b582723944b76426b (diff) | |
download | mariadb-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/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index e117adc3cd0..edcb9776a2b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4855,6 +4855,7 @@ void Item_func_get_system_var::fix_length_and_dec() max_length= MAX_BLOB_WIDTH; decimals=NOT_FIXED_DEC; break; + case SHOW_BOOL: case SHOW_MY_BOOL: unsigned_flag= FALSE; max_length= 1; @@ -4882,6 +4883,7 @@ enum Item_result Item_func_get_system_var::result_type() const { switch (var->show_type()) { + case SHOW_BOOL: case SHOW_MY_BOOL: case SHOW_INT: case SHOW_LONG: @@ -4904,6 +4906,7 @@ enum_field_types Item_func_get_system_var::field_type() const { switch (var->show_type()) { + case SHOW_BOOL: case SHOW_MY_BOOL: case SHOW_INT: case SHOW_LONG: @@ -4922,6 +4925,10 @@ enum_field_types Item_func_get_system_var::field_type() const } +/* + Uses var, var_type, component, cache_present, used_query_id, thd, + cached_llval, null_value, cached_null_value +*/ #define get_sys_var_safe(type) \ do { \ type value; \ @@ -4975,6 +4982,7 @@ longlong Item_func_get_system_var::val_int() case SHOW_LONG: get_sys_var_safe (ulong); case SHOW_LONGLONG: get_sys_var_safe (longlong); case SHOW_HA_ROWS: get_sys_var_safe (ha_rows); + case SHOW_BOOL: get_sys_var_safe (bool); case SHOW_MY_BOOL: get_sys_var_safe (my_bool); case SHOW_DOUBLE: { @@ -5072,6 +5080,7 @@ String* Item_func_get_system_var::val_str(String* str) case SHOW_LONG: case SHOW_LONGLONG: case SHOW_HA_ROWS: + case SHOW_BOOL: case SHOW_MY_BOOL: str->set (val_int(), collation.collation); break; @@ -5164,6 +5173,7 @@ double Item_func_get_system_var::val_real() case SHOW_LONG: case SHOW_LONGLONG: case SHOW_HA_ROWS: + case SHOW_BOOL: case SHOW_MY_BOOL: cached_dval= (double) val_int(); cache_present|= GET_SYS_VAR_CACHE_DOUBLE; |