Commit ec00b92f authored by jimw@mysql.com's avatar jimw@mysql.com

Bug #12792: @@system_time_zone is not SELECTable

Bug #15684: @@version_* are not all SELECTable

  Added the appropriate information as read-only system variables, and
  also removed some special-case handling of @@version along the way.

  @@version_bdb was added, but isn't included in the test because it
  depends on the presence of BDB.
parent b57eb9e1
......@@ -275,7 +275,7 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with
select @@global.timestamp;
ERROR HY000: Variable 'timestamp' is a SESSION variable
set @@version='';
ERROR HY000: Unknown system variable 'version'
ERROR HY000: Variable 'version' is a read only variable
set @@concurrent_insert=1;
ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL
set @@global.sql_auto_is_null=1;
......@@ -384,6 +384,7 @@ select @@sql_max_join_size,@@max_join_size;
set sql_quote_show_create=1;
set sql_safe_updates=1;
set sql_select_limit=1;
set sql_select_limit=default;
set sql_warnings=1;
set global table_cache=100;
set storage_engine=myisam;
......@@ -584,3 +585,11 @@ set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
@@global.character_set_filesystem
binary
select @@system_time_zone;
@@system_time_zone
#
select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
@@version @@version_comment @@version_compile_machine @@version_compile_os
# # # #
End of 5.0 tests
......@@ -169,7 +169,7 @@ set collation_connection=NULL;
set global autocommit=1;
--error 1238
select @@global.timestamp;
--error 1193
--error 1238
set @@version='';
--error 1229
set @@concurrent_insert=1;
......@@ -258,6 +258,8 @@ select @@sql_max_join_size,@@max_join_size;
set sql_quote_show_create=1;
set sql_safe_updates=1;
set sql_select_limit=1;
# reset it, so later tests don't get confused
set sql_select_limit=default;
set sql_warnings=1;
set global table_cache=100;
set storage_engine=myisam;
......@@ -472,4 +474,19 @@ select @@character_set_filesystem;
set @@global.character_set_filesystem=default;
select @@global.character_set_filesystem;
# End of 5.0 tests
#
# Bug #12792: @@system_time_zone is not SELECTable.
#
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@system_time_zone;
#
# Bug #15684: system variables cannot be SELECTed (e.g. @@version_comment)
#
# Don't actually output, since it depends on the system
--replace_column 1 # 2 # 3 # 4 #
select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
--echo End of 5.0 tests
......@@ -4558,12 +4558,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
sys_var *var;
LEX_STRING *base_name, *component_name;
if (component.str == 0 &&
!my_strcasecmp(system_charset_info, name.str, "VERSION"))
return new Item_string(NULL, server_version,
(uint) strlen(server_version),
system_charset_info, DERIVATION_SYSCONST);
if (component.str)
{
base_name= &component;
......
......@@ -377,6 +377,8 @@ sys_var_thd_table_type sys_table_type("table_type",
sys_var_thd_storage_engine sys_storage_engine("storage_engine",
&SV::table_type);
sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm);
sys_var_const_str sys_system_time_zone("system_time_zone",
system_time_zone);
sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size);
sys_var_long_ptr sys_table_lock_wait_timeout("table_lock_wait_timeout",
......@@ -391,6 +393,16 @@ sys_var_thd_ulong sys_tmp_table_size("tmp_table_size",
&SV::tmp_table_size);
sys_var_bool_ptr sys_timed_mutexes("timed_mutexes",
&timed_mutexes);
sys_var_const_str sys_version("version", server_version);
#ifdef HAVE_BERKELEY_DB
sys_var_const_str sys_version_bdb("version_bdb", DB_VERSION_STRING);
#endif
sys_var_const_str sys_version_comment("version_comment",
MYSQL_COMPILATION_COMMENT);
sys_var_const_str sys_version_compile_machine("version_compile_machine",
MACHINE_TYPE);
sys_var_const_str sys_version_compile_os("version_compile_os",
SYSTEM_TYPE);
sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
&SV::net_wait_timeout);
......@@ -546,7 +558,6 @@ sys_var_thd_time_zone sys_time_zone("time_zone");
/* Read only variables */
sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE);
sys_var_readonly sys_have_innodb("have_innodb", OPT_GLOBAL,
SHOW_CHAR, get_have_innodb);
/* Global read-only variable describing server license */
......@@ -698,6 +709,7 @@ sys_var *sys_variables[]=
&sys_sql_notes,
&sys_storage_engine,
&sys_sync_frm,
&sys_system_time_zone,
&sys_table_cache_size,
&sys_table_lock_wait_timeout,
&sys_table_type,
......@@ -710,7 +722,13 @@ sys_var *sys_variables[]=
&sys_trans_alloc_block_size,
&sys_trans_prealloc_size,
&sys_tx_isolation,
&sys_os,
&sys_version,
#ifdef HAVE_BERKELEY_DB
&sys_version_bdb,
#endif
&sys_version_comment,
&sys_version_compile_machine,
&sys_version_compile_os,
#ifdef HAVE_INNOBASE_DB
&sys_innodb_fast_shutdown,
&sys_innodb_max_dirty_pages_pct,
......@@ -1015,13 +1033,14 @@ struct show_var_st init_vars[]= {
{sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS},
{sys_updatable_views_with_limit.name,
(char*) &sys_updatable_views_with_limit,SHOW_SYS},
{"version", server_version, SHOW_CHAR},
{sys_version.name, (char*) &sys_version, SHOW_SYS},
#ifdef HAVE_BERKELEY_DB
{"version_bdb", (char*) DB_VERSION_STRING, SHOW_CHAR},
{sys_version_bdb.name, (char*) &sys_version_bdb, SHOW_SYS},
#endif
{"version_comment", (char*) MYSQL_COMPILATION_COMMENT, SHOW_CHAR},
{"version_compile_machine", (char*) MACHINE_TYPE, SHOW_CHAR},
{sys_os.name, (char*) &sys_os, SHOW_SYS},
{sys_version_comment.name, (char*) &sys_version_comment, SHOW_SYS},
{sys_version_compile_machine.name, (char*) &sys_version_compile_machine,
SHOW_SYS},
{sys_version_compile_os.name, (char*) &sys_version_compile_os, SHOW_SYS},
{sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS},
{NullS, NullS, SHOW_LONG}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment