diff options
-rw-r--r-- | include/mysql/plugin.h | 4 | ||||
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/plugin_encryption_key_management.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h.pp | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 335 | ||||
-rw-r--r-- | sql/sql_show.cc | 8 |
8 files changed, 185 insertions, 182 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 4a27527b565..6a4e5448fa9 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -190,12 +190,12 @@ enum enum_var_type struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; #define SHOW_VAR_FUNC_BUFF_SIZE (256 * sizeof(void*)) -typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, enum enum_var_type); /* diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 65406219dc8..8a04186ff77 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -231,10 +231,10 @@ enum enum_var_type }; struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; -typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, enum enum_var_type); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index ad694730330..8fbd7cd38c2 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -231,10 +231,10 @@ enum enum_var_type }; struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; -typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, enum enum_var_type); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_encryption_key_management.h.pp b/include/mysql/plugin_encryption_key_management.h.pp index c32cba045ec..fc162e143c6 100644 --- a/include/mysql/plugin_encryption_key_management.h.pp +++ b/include/mysql/plugin_encryption_key_management.h.pp @@ -231,10 +231,10 @@ enum enum_var_type }; struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; -typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, enum enum_var_type); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 71045c170d6..16374df7936 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -231,10 +231,10 @@ enum enum_var_type }; struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; -typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, enum enum_var_type); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index ac685de3615..2902a368985 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -231,10 +231,10 @@ enum enum_var_type }; struct st_mysql_show_var { const char *name; - char *value; + void *value; enum enum_mysql_show_type type; }; -typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *, enum enum_var_type); +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, enum enum_var_type); struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2e6d88ef0a4..b97742d01ee 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3712,163 +3712,166 @@ static bool init_global_datetime_format(timestamp_type format_type, return false; } +#define COM_STATUS(X) (void*) offsetof(STATUS_VAR, X), SHOW_LONG_STATUS +#define STMT_STATUS(X) COM_STATUS(com_stat[(uint) X]) + SHOW_VAR com_status_vars[]= { - {"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS}, - {"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS}, - {"alter_db_upgrade", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB_UPGRADE]), SHOW_LONG_STATUS}, - {"alter_event", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_EVENT]), SHOW_LONG_STATUS}, - {"alter_function", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_FUNCTION]), SHOW_LONG_STATUS}, - {"alter_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_PROCEDURE]), SHOW_LONG_STATUS}, - {"alter_server", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_SERVER]), SHOW_LONG_STATUS}, - {"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS}, - {"alter_tablespace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLESPACE]), SHOW_LONG_STATUS}, - {"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS}, - {"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS}, - {"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS}, - {"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS}, - {"call_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CALL]), SHOW_LONG_STATUS}, - {"change_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS}, - {"change_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS}, - {"check", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECK]), SHOW_LONG_STATUS}, - {"checksum", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS}, - {"commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMMIT]), SHOW_LONG_STATUS}, - {"compound_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMPOUND]), SHOW_LONG_STATUS}, - {"create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS}, - {"create_event", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_EVENT]), SHOW_LONG_STATUS}, - {"create_function", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_SPFUNCTION]), SHOW_LONG_STATUS}, - {"create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS}, - {"create_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_PROCEDURE]), SHOW_LONG_STATUS}, - {"create_role", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_ROLE]), SHOW_LONG_STATUS}, - {"create_server", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_SERVER]), SHOW_LONG_STATUS}, - {"create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS}, - {"create_trigger", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TRIGGER]), SHOW_LONG_STATUS}, - {"create_udf", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_FUNCTION]), SHOW_LONG_STATUS}, - {"create_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_USER]), SHOW_LONG_STATUS}, - {"create_view", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_VIEW]), SHOW_LONG_STATUS}, - {"dealloc_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DEALLOCATE_PREPARE]), SHOW_LONG_STATUS}, - {"delete", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE]), SHOW_LONG_STATUS}, - {"delete_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE_MULTI]), SHOW_LONG_STATUS}, - {"do", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DO]), SHOW_LONG_STATUS}, - {"drop_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_DB]), SHOW_LONG_STATUS}, - {"drop_event", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_EVENT]), SHOW_LONG_STATUS}, - {"drop_function", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_FUNCTION]), SHOW_LONG_STATUS}, - {"drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS}, - {"drop_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_PROCEDURE]), SHOW_LONG_STATUS}, - {"drop_role", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_ROLE]), SHOW_LONG_STATUS}, - {"drop_server", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_SERVER]), SHOW_LONG_STATUS}, - {"drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS}, - {"drop_trigger", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TRIGGER]), SHOW_LONG_STATUS}, - {"drop_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_USER]), SHOW_LONG_STATUS}, - {"drop_view", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_VIEW]), SHOW_LONG_STATUS}, - {"empty_query", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS}, - {"execute_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EXECUTE]), SHOW_LONG_STATUS}, - {"flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS}, - {"get_diagnostics", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_GET_DIAGNOSTICS]), SHOW_LONG_STATUS}, - {"grant", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_GRANT]), SHOW_LONG_STATUS}, - {"grant_role", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_GRANT_ROLE]), SHOW_LONG_STATUS}, - {"ha_close", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HA_CLOSE]), SHOW_LONG_STATUS}, - {"ha_open", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HA_OPEN]), SHOW_LONG_STATUS}, - {"ha_read", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HA_READ]), SHOW_LONG_STATUS}, - {"help", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_HELP]), SHOW_LONG_STATUS}, - {"insert", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT]), SHOW_LONG_STATUS}, - {"insert_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS}, - {"install_plugin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSTALL_PLUGIN]), SHOW_LONG_STATUS}, - {"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_KILL]), SHOW_LONG_STATUS}, - {"load", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS}, - {"lock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS}, - {"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS}, - {"preload_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PRELOAD_KEYS]), SHOW_LONG_STATUS}, - {"prepare_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PREPARE]), SHOW_LONG_STATUS}, - {"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS}, - {"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS}, - {"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS}, - {"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS}, - {"rename_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_USER]), SHOW_LONG_STATUS}, - {"repair", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPAIR]), SHOW_LONG_STATUS}, - {"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS}, - {"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS}, - {"reset", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS}, - {"resignal", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESIGNAL]), SHOW_LONG_STATUS}, - {"revoke", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE]), SHOW_LONG_STATUS}, - {"revoke_all", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE_ALL]), SHOW_LONG_STATUS}, - {"revoke_role", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE_ROLE]), SHOW_LONG_STATUS}, - {"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS}, - {"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS}, - {"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS}, - {"select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS}, - {"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS}, - {"show_authors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_AUTHORS]), SHOW_LONG_STATUS}, - {"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS}, - {"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS}, - {"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS}, - {"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS}, - {"show_contributors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS}, - {"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS}, - {"show_create_event", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_EVENT]), SHOW_LONG_STATUS}, - {"show_create_func", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_FUNC]), SHOW_LONG_STATUS}, - {"show_create_proc", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_PROC]), SHOW_LONG_STATUS}, - {"show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS}, - {"show_create_trigger", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_TRIGGER]), SHOW_LONG_STATUS}, - {"show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS}, - {"show_engine_logs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_LOGS]), SHOW_LONG_STATUS}, - {"show_engine_mutex", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_MUTEX]), SHOW_LONG_STATUS}, - {"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS}, - {"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS}, - {"show_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EVENTS]), SHOW_LONG_STATUS}, - {"show_explain", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EXPLAIN]), SHOW_LONG_STATUS}, - {"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS}, + {"admin_commands", COM_STATUS(com_other)}, + {"alter_db", STMT_STATUS(SQLCOM_ALTER_DB)}, + {"alter_db_upgrade", STMT_STATUS(SQLCOM_ALTER_DB_UPGRADE)}, + {"alter_event", STMT_STATUS(SQLCOM_ALTER_EVENT)}, + {"alter_function", STMT_STATUS(SQLCOM_ALTER_FUNCTION)}, + {"alter_procedure", STMT_STATUS(SQLCOM_ALTER_PROCEDURE)}, + {"alter_server", STMT_STATUS(SQLCOM_ALTER_SERVER)}, + {"alter_table", STMT_STATUS(SQLCOM_ALTER_TABLE)}, + {"alter_tablespace", STMT_STATUS(SQLCOM_ALTER_TABLESPACE)}, + {"analyze", STMT_STATUS(SQLCOM_ANALYZE)}, + {"assign_to_keycache", STMT_STATUS(SQLCOM_ASSIGN_TO_KEYCACHE)}, + {"begin", STMT_STATUS(SQLCOM_BEGIN)}, + {"binlog", STMT_STATUS(SQLCOM_BINLOG_BASE64_EVENT)}, + {"call_procedure", STMT_STATUS(SQLCOM_CALL)}, + {"change_db", STMT_STATUS(SQLCOM_CHANGE_DB)}, + {"change_master", STMT_STATUS(SQLCOM_CHANGE_MASTER)}, + {"check", STMT_STATUS(SQLCOM_CHECK)}, + {"checksum", STMT_STATUS(SQLCOM_CHECKSUM)}, + {"commit", STMT_STATUS(SQLCOM_COMMIT)}, + {"compound_sql", STMT_STATUS(SQLCOM_COMPOUND)}, + {"create_db", STMT_STATUS(SQLCOM_CREATE_DB)}, + {"create_event", STMT_STATUS(SQLCOM_CREATE_EVENT)}, + {"create_function", STMT_STATUS(SQLCOM_CREATE_SPFUNCTION)}, + {"create_index", STMT_STATUS(SQLCOM_CREATE_INDEX)}, + {"create_procedure", STMT_STATUS(SQLCOM_CREATE_PROCEDURE)}, + {"create_role", STMT_STATUS(SQLCOM_CREATE_ROLE)}, + {"create_server", STMT_STATUS(SQLCOM_CREATE_SERVER)}, + {"create_table", STMT_STATUS(SQLCOM_CREATE_TABLE)}, + {"create_trigger", STMT_STATUS(SQLCOM_CREATE_TRIGGER)}, + {"create_udf", STMT_STATUS(SQLCOM_CREATE_FUNCTION)}, + {"create_user", STMT_STATUS(SQLCOM_CREATE_USER)}, + {"create_view", STMT_STATUS(SQLCOM_CREATE_VIEW)}, + {"dealloc_sql", STMT_STATUS(SQLCOM_DEALLOCATE_PREPARE)}, + {"delete", STMT_STATUS(SQLCOM_DELETE)}, + {"delete_multi", STMT_STATUS(SQLCOM_DELETE_MULTI)}, + {"do", STMT_STATUS(SQLCOM_DO)}, + {"drop_db", STMT_STATUS(SQLCOM_DROP_DB)}, + {"drop_event", STMT_STATUS(SQLCOM_DROP_EVENT)}, + {"drop_function", STMT_STATUS(SQLCOM_DROP_FUNCTION)}, + {"drop_index", STMT_STATUS(SQLCOM_DROP_INDEX)}, + {"drop_procedure", STMT_STATUS(SQLCOM_DROP_PROCEDURE)}, + {"drop_role", STMT_STATUS(SQLCOM_DROP_ROLE)}, + {"drop_server", STMT_STATUS(SQLCOM_DROP_SERVER)}, + {"drop_table", STMT_STATUS(SQLCOM_DROP_TABLE)}, + {"drop_trigger", STMT_STATUS(SQLCOM_DROP_TRIGGER)}, + {"drop_user", STMT_STATUS(SQLCOM_DROP_USER)}, + {"drop_view", STMT_STATUS(SQLCOM_DROP_VIEW)}, + {"empty_query", STMT_STATUS(SQLCOM_EMPTY_QUERY)}, + {"execute_sql", STMT_STATUS(SQLCOM_EXECUTE)}, + {"flush", STMT_STATUS(SQLCOM_FLUSH)}, + {"get_diagnostics", STMT_STATUS(SQLCOM_GET_DIAGNOSTICS)}, + {"grant", STMT_STATUS(SQLCOM_GRANT)}, + {"grant_role", STMT_STATUS(SQLCOM_GRANT_ROLE)}, + {"ha_close", STMT_STATUS(SQLCOM_HA_CLOSE)}, + {"ha_open", STMT_STATUS(SQLCOM_HA_OPEN)}, + {"ha_read", STMT_STATUS(SQLCOM_HA_READ)}, + {"help", STMT_STATUS(SQLCOM_HELP)}, + {"insert", STMT_STATUS(SQLCOM_INSERT)}, + {"insert_select", STMT_STATUS(SQLCOM_INSERT_SELECT)}, + {"install_plugin", STMT_STATUS(SQLCOM_INSTALL_PLUGIN)}, + {"kill", STMT_STATUS(SQLCOM_KILL)}, + {"load", STMT_STATUS(SQLCOM_LOAD)}, + {"lock_tables", STMT_STATUS(SQLCOM_LOCK_TABLES)}, + {"optimize", STMT_STATUS(SQLCOM_OPTIMIZE)}, + {"preload_keys", STMT_STATUS(SQLCOM_PRELOAD_KEYS)}, + {"prepare_sql", STMT_STATUS(SQLCOM_PREPARE)}, + {"purge", STMT_STATUS(SQLCOM_PURGE)}, + {"purge_before_date", STMT_STATUS(SQLCOM_PURGE_BEFORE)}, + {"release_savepoint", STMT_STATUS(SQLCOM_RELEASE_SAVEPOINT)}, + {"rename_table", STMT_STATUS(SQLCOM_RENAME_TABLE)}, + {"rename_user", STMT_STATUS(SQLCOM_RENAME_USER)}, + {"repair", STMT_STATUS(SQLCOM_REPAIR)}, + {"replace", STMT_STATUS(SQLCOM_REPLACE)}, + {"replace_select", STMT_STATUS(SQLCOM_REPLACE_SELECT)}, + {"reset", STMT_STATUS(SQLCOM_RESET)}, + {"resignal", STMT_STATUS(SQLCOM_RESIGNAL)}, + {"revoke", STMT_STATUS(SQLCOM_REVOKE)}, + {"revoke_all", STMT_STATUS(SQLCOM_REVOKE_ALL)}, + {"revoke_role", STMT_STATUS(SQLCOM_REVOKE_ROLE)}, + {"rollback", STMT_STATUS(SQLCOM_ROLLBACK)}, + {"rollback_to_savepoint",STMT_STATUS(SQLCOM_ROLLBACK_TO_SAVEPOINT)}, + {"savepoint", STMT_STATUS(SQLCOM_SAVEPOINT)}, + {"select", STMT_STATUS(SQLCOM_SELECT)}, + {"set_option", STMT_STATUS(SQLCOM_SET_OPTION)}, + {"show_authors", STMT_STATUS(SQLCOM_SHOW_AUTHORS)}, + {"show_binlog_events", STMT_STATUS(SQLCOM_SHOW_BINLOG_EVENTS)}, + {"show_binlogs", STMT_STATUS(SQLCOM_SHOW_BINLOGS)}, + {"show_charsets", STMT_STATUS(SQLCOM_SHOW_CHARSETS)}, + {"show_collations", STMT_STATUS(SQLCOM_SHOW_COLLATIONS)}, + {"show_contributors", STMT_STATUS(SQLCOM_SHOW_CONTRIBUTORS)}, + {"show_create_db", STMT_STATUS(SQLCOM_SHOW_CREATE_DB)}, + {"show_create_event", STMT_STATUS(SQLCOM_SHOW_CREATE_EVENT)}, + {"show_create_func", STMT_STATUS(SQLCOM_SHOW_CREATE_FUNC)}, + {"show_create_proc", STMT_STATUS(SQLCOM_SHOW_CREATE_PROC)}, + {"show_create_table", STMT_STATUS(SQLCOM_SHOW_CREATE)}, + {"show_create_trigger", STMT_STATUS(SQLCOM_SHOW_CREATE_TRIGGER)}, + {"show_databases", STMT_STATUS(SQLCOM_SHOW_DATABASES)}, + {"show_engine_logs", STMT_STATUS(SQLCOM_SHOW_ENGINE_LOGS)}, + {"show_engine_mutex", STMT_STATUS(SQLCOM_SHOW_ENGINE_MUTEX)}, + {"show_engine_status", STMT_STATUS(SQLCOM_SHOW_ENGINE_STATUS)}, + {"show_errors", STMT_STATUS(SQLCOM_SHOW_ERRORS)}, + {"show_events", STMT_STATUS(SQLCOM_SHOW_EVENTS)}, + {"show_explain", STMT_STATUS(SQLCOM_SHOW_EXPLAIN)}, + {"show_fields", STMT_STATUS(SQLCOM_SHOW_FIELDS)}, #ifndef DBUG_OFF - {"show_function_code", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FUNC_CODE]), SHOW_LONG_STATUS}, -#endif - {"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS}, - {"show_generic", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GENERIC]), SHOW_LONG_STATUS}, - {"show_grants", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS}, - {"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS}, - {"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS}, - {"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS}, - {"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS}, - {"show_privileges", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PRIVILEGES]), SHOW_LONG_STATUS}, + {"show_function_code", STMT_STATUS(SQLCOM_SHOW_FUNC_CODE)}, +#endif + {"show_function_status", STMT_STATUS(SQLCOM_SHOW_STATUS_FUNC)}, + {"show_generic", STMT_STATUS(SQLCOM_SHOW_GENERIC)}, + {"show_grants", STMT_STATUS(SQLCOM_SHOW_GRANTS)}, + {"show_keys", STMT_STATUS(SQLCOM_SHOW_KEYS)}, + {"show_master_status", STMT_STATUS(SQLCOM_SHOW_MASTER_STAT)}, + {"show_open_tables", STMT_STATUS(SQLCOM_SHOW_OPEN_TABLES)}, + {"show_plugins", STMT_STATUS(SQLCOM_SHOW_PLUGINS)}, + {"show_privileges", STMT_STATUS(SQLCOM_SHOW_PRIVILEGES)}, #ifndef DBUG_OFF - {"show_procedure_code", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROC_CODE]), SHOW_LONG_STATUS}, -#endif - {"show_procedure_status",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_PROC]), SHOW_LONG_STATUS}, - {"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS}, - {"show_profile", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILE]), SHOW_LONG_STATUS}, - {"show_profiles", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILES]), SHOW_LONG_STATUS}, - {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS}, - {"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS}, - {"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS}, - {"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS}, - {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS}, - {"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS}, - {"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS}, - {"show_triggers", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TRIGGERS]), SHOW_LONG_STATUS}, - {"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS}, - {"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, - {"shutdown", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHUTDOWN]), SHOW_LONG_STATUS}, - {"signal", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SIGNAL]), SHOW_LONG_STATUS}, - {"start_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_START]), SHOW_LONG_STATUS}, - {"start_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS}, - {"stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS}, - {"stmt_execute", (char*) offsetof(STATUS_VAR, com_stmt_execute), SHOW_LONG_STATUS}, - {"stmt_fetch", (char*) offsetof(STATUS_VAR, com_stmt_fetch), SHOW_LONG_STATUS}, - {"stmt_prepare", (char*) offsetof(STATUS_VAR, com_stmt_prepare), SHOW_LONG_STATUS}, - {"stmt_reprepare", (char*) offsetof(STATUS_VAR, com_stmt_reprepare), SHOW_LONG_STATUS}, - {"stmt_reset", (char*) offsetof(STATUS_VAR, com_stmt_reset), SHOW_LONG_STATUS}, - {"stmt_send_long_data", (char*) offsetof(STATUS_VAR, com_stmt_send_long_data), SHOW_LONG_STATUS}, - {"stop_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_STOP]), SHOW_LONG_STATUS}, - {"stop_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS}, - {"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS}, - {"uninstall_plugin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNINSTALL_PLUGIN]), SHOW_LONG_STATUS}, - {"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS}, - {"update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS}, - {"update_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS}, - {"xa_commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_COMMIT]),SHOW_LONG_STATUS}, - {"xa_end", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_END]),SHOW_LONG_STATUS}, - {"xa_prepare", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_PREPARE]),SHOW_LONG_STATUS}, - {"xa_recover", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_RECOVER]),SHOW_LONG_STATUS}, - {"xa_rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_ROLLBACK]),SHOW_LONG_STATUS}, - {"xa_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_START]),SHOW_LONG_STATUS}, + {"show_procedure_code", STMT_STATUS(SQLCOM_SHOW_PROC_CODE)}, +#endif + {"show_procedure_status",STMT_STATUS(SQLCOM_SHOW_STATUS_PROC)}, + {"show_processlist", STMT_STATUS(SQLCOM_SHOW_PROCESSLIST)}, + {"show_profile", STMT_STATUS(SQLCOM_SHOW_PROFILE)}, + {"show_profiles", STMT_STATUS(SQLCOM_SHOW_PROFILES)}, + {"show_relaylog_events", STMT_STATUS(SQLCOM_SHOW_RELAYLOG_EVENTS)}, + {"show_slave_hosts", STMT_STATUS(SQLCOM_SHOW_SLAVE_HOSTS)}, + {"show_slave_status", STMT_STATUS(SQLCOM_SHOW_SLAVE_STAT)}, + {"show_status", STMT_STATUS(SQLCOM_SHOW_STATUS)}, + {"show_storage_engines", STMT_STATUS(SQLCOM_SHOW_STORAGE_ENGINES)}, + {"show_table_status", STMT_STATUS(SQLCOM_SHOW_TABLE_STATUS)}, + {"show_tables", STMT_STATUS(SQLCOM_SHOW_TABLES)}, + {"show_triggers", STMT_STATUS(SQLCOM_SHOW_TRIGGERS)}, + {"show_variables", STMT_STATUS(SQLCOM_SHOW_VARIABLES)}, + {"show_warnings", STMT_STATUS(SQLCOM_SHOW_WARNS)}, + {"shutdown", STMT_STATUS(SQLCOM_SHUTDOWN)}, + {"signal", STMT_STATUS(SQLCOM_SIGNAL)}, + {"start_all_slaves", STMT_STATUS(SQLCOM_SLAVE_ALL_START)}, + {"start_slave", STMT_STATUS(SQLCOM_SLAVE_START)}, + {"stmt_close", COM_STATUS(com_stmt_close)}, + {"stmt_execute", COM_STATUS(com_stmt_execute)}, + {"stmt_fetch", COM_STATUS(com_stmt_fetch)}, + {"stmt_prepare", COM_STATUS(com_stmt_prepare)}, + {"stmt_reprepare", COM_STATUS(com_stmt_reprepare)}, + {"stmt_reset", COM_STATUS(com_stmt_reset)}, + {"stmt_send_long_data", COM_STATUS(com_stmt_send_long_data)}, + {"stop_all_slaves", STMT_STATUS(SQLCOM_SLAVE_ALL_STOP)}, + {"stop_slave", STMT_STATUS(SQLCOM_SLAVE_STOP)}, + {"truncate", STMT_STATUS(SQLCOM_TRUNCATE)}, + {"uninstall_plugin", STMT_STATUS(SQLCOM_UNINSTALL_PLUGIN)}, + {"unlock_tables", STMT_STATUS(SQLCOM_UNLOCK_TABLES)}, + {"update", STMT_STATUS(SQLCOM_UPDATE)}, + {"update_multi", STMT_STATUS(SQLCOM_UPDATE_MULTI)}, + {"xa_commit", STMT_STATUS(SQLCOM_XA_COMMIT)}, + {"xa_end", STMT_STATUS(SQLCOM_XA_END)}, + {"xa_prepare", STMT_STATUS(SQLCOM_XA_PREPARE)}, + {"xa_recover", STMT_STATUS(SQLCOM_XA_RECOVER)}, + {"xa_rollback", STMT_STATUS(SQLCOM_XA_ROLLBACK)}, + {"xa_start", STMT_STATUS(SQLCOM_XA_START)}, {NullS, NullS, SHOW_LONG} }; @@ -3885,11 +3888,11 @@ PSI_statement_info com_statement_info[(uint) COM_END + 1]; */ void init_sql_statement_info() { - char *first_com= (char*) offsetof(STATUS_VAR, com_stat[0]); - char *last_com= (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]); - int record_size= (char*) offsetof(STATUS_VAR, com_stat[1]) - - (char*) offsetof(STATUS_VAR, com_stat[0]); - char *ptr; + size_t first_com= offsetof(STATUS_VAR, com_stat[0]); + size_t last_com= offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]); + int record_size= offsetof(STATUS_VAR, com_stat[1]) + - offsetof(STATUS_VAR, com_stat[0]); + size_t ptr; uint i; uint com_index; @@ -3903,7 +3906,7 @@ void init_sql_statement_info() SHOW_VAR *var= &com_status_vars[0]; while (var->name != NULL) { - ptr= var->value; + ptr= (size_t)(var->value); if ((first_com <= ptr) && (ptr <= last_com)) { com_index= ((int)(ptr - first_com))/record_size; @@ -5330,11 +5333,11 @@ LEX_STRING sql_statement_names[(uint) SQLCOM_END + 1]; static void init_sql_statement_names() { - char *first_com= (char*) offsetof(STATUS_VAR, com_stat[0]); - char *last_com= (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]); - int record_size= (char*) offsetof(STATUS_VAR, com_stat[1]) - - (char*) offsetof(STATUS_VAR, com_stat[0]); - char *ptr; + size_t first_com= offsetof(STATUS_VAR, com_stat[0]); + size_t last_com= offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_END]); + int record_size= offsetof(STATUS_VAR, com_stat[1]) + - offsetof(STATUS_VAR, com_stat[0]); + size_t ptr; uint i; uint com_index; @@ -5344,7 +5347,7 @@ static void init_sql_statement_names() SHOW_VAR *var= &com_status_vars[0]; while (var->name != NULL) { - ptr= var->value; + ptr= (size_t)(var->value); if ((first_com <= ptr) && (ptr <= last_com)) { com_index= ((int)(ptr - first_com))/record_size; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 20c40472d57..d3648378cc6 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3132,15 +3132,15 @@ static bool show_status_array(THD *thd, const char *wild, name_buffer, wild))) && (!cond || cond->val_int())) { - char *value=var->value; + void *value=var->value; const char *pos, *end; // We assign a lot of const's if (show_type == SHOW_SYS) { - sys_var *var= ((sys_var *) value); + sys_var *var= (sys_var *) value; show_type= var->show_type(); mysql_mutex_lock(&LOCK_global_system_variables); - value= (char*) var->value_ptr(thd, scope, &null_lex_str); + value= var->value_ptr(thd, scope, &null_lex_str); charset= var->charset(thd); } @@ -3200,7 +3200,7 @@ static bool show_status_array(THD *thd, const char *wild, } case SHOW_CHAR: { - if (!(pos= value)) + if (!(pos= (char*)value)) pos= ""; end= strend(pos); break; |