diff options
author | monty@mysql.com <> | 2006-06-20 13:20:32 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2006-06-20 13:20:32 +0300 |
commit | be269e56d2a20b5ec70991eb73c87efa20df7dfd (patch) | |
tree | c7992132df0440e7a225104a6c67e1cbe6cd9133 /sql/sql_prepare.cc | |
parent | 49a3334889a9278859ff9030f193b4289c2870e0 (diff) | |
download | mariadb-git-be269e56d2a20b5ec70991eb73c87efa20df7dfd.tar.gz |
SHOW STATUS does not anymore change local status variables (except com_show_status). Global status variables are still updated.
SHOW STATUS are not anymore put in slow query log because of no index usage.
Implemntation done by removing orig_sql_command and moving logic of SHOW STATUS to mysql_excute_command()
This simplifies code and allows us to remove some if statements all over the code.
Upgraded uc_update_queries[] to sql_command_flags and added more bitmaps to better categorize commands.
This allowed some overall simplifaction when testing sql_command.
Fixes bugs:
Bug#10210: running SHOW STATUS increments counters it shouldn't
Bug#19764: SHOW commands end up in the slow log as table scans
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 078c7e01d5a..ca56c39204b 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1727,22 +1727,17 @@ static bool check_prepared_statement(Prepared_statement *stmt, res= mysql_test_insert_select(stmt, tables); break; - case SQLCOM_SHOW_DATABASES: + /* + Note that we don't need to have cases in this list if they are + marked with CF_STATUS_COMMAND in sql_command_flags + */ case SQLCOM_SHOW_PROCESSLIST: case SQLCOM_SHOW_STORAGE_ENGINES: case SQLCOM_SHOW_PRIVILEGES: case SQLCOM_SHOW_COLUMN_TYPES: - case SQLCOM_SHOW_STATUS: - case SQLCOM_SHOW_VARIABLES: case SQLCOM_SHOW_ENGINE_LOGS: case SQLCOM_SHOW_ENGINE_STATUS: case SQLCOM_SHOW_ENGINE_MUTEX: - case SQLCOM_SHOW_TABLES: - case SQLCOM_SHOW_OPEN_TABLES: - case SQLCOM_SHOW_CHARSETS: - case SQLCOM_SHOW_COLLATIONS: - case SQLCOM_SHOW_FIELDS: - case SQLCOM_SHOW_KEYS: case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_GRANTS: case SQLCOM_DROP_TABLE: @@ -1762,9 +1757,17 @@ static bool check_prepared_statement(Prepared_statement *stmt, break; default: - /* All other statements are not supported yet. */ - my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0)); - goto error; + /* + Trivial check of all status commands. This is easier than having + things in the above case list, as it's less chance for mistakes. + */ + if (!(sql_command_flags[sql_command] & CF_STATUS_COMMAND)) + { + /* All other statements are not supported yet. */ + my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0)); + goto error; + } + break; } if (res == 0) DBUG_RETURN(text_protocol? FALSE : (send_prep_stmt(stmt, 0) || |