From 8f15bf9d0c0bc1bb8be2218411ae862a4903ae31 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 27 Aug 2014 09:40:52 +0200 Subject: [PATCH] cleanup: remove hidden I_S.VARIABLES and I_S.STATUS tables their only purpose was to distinguish between SHOW and SELECT and there are cleaner ways of doing it. --- mysql-test/r/show_check.result | 12 ++++++------ sql/handler.h | 2 -- sql/sql_parse.cc | 2 -- sql/sql_show.cc | 12 ++++-------- sql/sql_yacc.yy | 4 ++-- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 6d6fd2e43d6..741e34c329e 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -100,20 +100,20 @@ drop table t1; -- after Bug#29394 is implemented. show variables like "wait_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/sql/handler.h b/sql/handler.h index 4ba312963ac..9d411bba5d3 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -748,7 +748,6 @@ enum enum_schema_tables SCH_SESSION_STATUS, SCH_SESSION_VARIABLES, SCH_STATISTICS, - SCH_STATUS, SCH_TABLES, SCH_TABLESPACES, SCH_TABLE_CONSTRAINTS, @@ -758,7 +757,6 @@ enum enum_schema_tables SCH_TRIGGERS, SCH_USER_PRIVILEGES, SCH_USER_STATS, - SCH_VARIABLES, SCH_VIEWS }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 584d6fcbfa2..262301b21da 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2125,8 +2125,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, case SCH_TABLE_STATS: case SCH_INDEX_STATS: case SCH_OPEN_TABLES: - case SCH_VARIABLES: - case SCH_STATUS: case SCH_PROCEDURES: case SCH_CHARSETS: case SCH_ENGINES: diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a5c305f9448..df3c6435f98 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7237,8 +7237,8 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond) enum enum_schema_tables schema_table_idx= get_schema_table_idx(tables->schema_table); enum enum_var_type option_type= OPT_SESSION; - bool upper_case_names= (schema_table_idx != SCH_VARIABLES); - bool sorted_vars= (schema_table_idx == SCH_VARIABLES); + bool upper_case_names= lex->sql_command != SQLCOM_SHOW_VARIABLES; + bool sorted_vars= lex->sql_command == SQLCOM_SHOW_VARIABLES; if (lex->option_type == OPT_GLOBAL || schema_table_idx == SCH_GLOBAL_VARIABLES) @@ -7265,9 +7265,9 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) enum enum_schema_tables schema_table_idx= get_schema_table_idx(tables->schema_table); enum enum_var_type option_type; - bool upper_case_names= (schema_table_idx != SCH_STATUS); + bool upper_case_names= lex->sql_command != SQLCOM_SHOW_STATUS; - if (schema_table_idx == SCH_STATUS) + if (lex->sql_command == SQLCOM_SHOW_STATUS) { option_type= lex->option_type; if (option_type == OPT_GLOBAL) @@ -9186,8 +9186,6 @@ ST_SCHEMA_TABLE schema_tables[]= {"STATISTICS", stat_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0, OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE}, - {"STATUS", variables_fields_info, create_schema_table, fill_status, - make_old_format, 0, 0, -1, 1, 0}, {"TABLES", tables_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0, OPTIMIZE_I_S_TABLE}, @@ -9209,8 +9207,6 @@ ST_SCHEMA_TABLE schema_tables[]= fill_schema_user_privileges, 0, 0, -1, -1, 0, 0}, {"USER_STATISTICS", user_stats_fields_info, create_schema_table, fill_schema_user_stats, make_old_format, 0, -1, -1, 0, 0}, - {"VARIABLES", variables_fields_info, create_schema_table, fill_variables, - make_old_format, 0, 0, -1, 1, 0}, {"VIEWS", view_fields_info, create_schema_table, get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6828139eb27..417110de76a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -12471,7 +12471,7 @@ show_param: LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_STATUS; lex->option_type= $1; - if (prepare_schema_table(thd, lex, 0, SCH_STATUS)) + if (prepare_schema_table(thd, lex, 0, SCH_SESSION_STATUS)) MYSQL_YYABORT; } | opt_full PROCESSLIST_SYM @@ -12481,7 +12481,7 @@ show_param: LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_VARIABLES; lex->option_type= $1; - if (prepare_schema_table(thd, lex, 0, SCH_VARIABLES)) + if (prepare_schema_table(thd, lex, 0, SCH_SESSION_VARIABLES)) MYSQL_YYABORT; } | charset wild_and_where