diff options
-rw-r--r-- | mysql-test/main/thread_pool_info.result | 2 | ||||
-rw-r--r-- | plugin/disks/information_schema_disks.cc | 25 | ||||
-rw-r--r-- | plugin/feedback/feedback.cc | 6 | ||||
-rw-r--r-- | plugin/locale_info/locale_info.cc | 28 | ||||
-rw-r--r-- | plugin/metadata_lock_info/metadata_lock_info.cc | 29 | ||||
-rw-r--r-- | plugin/qc_info/qc_info.cc | 59 | ||||
-rw-r--r-- | plugin/query_response_time/plugin.cc | 15 | ||||
-rw-r--r-- | plugin/user_variables/user_variables.cc | 18 | ||||
-rw-r--r-- | plugin/userstat/client_stats.cc | 58 | ||||
-rw-r--r-- | plugin/userstat/index_stats.cc | 16 | ||||
-rw-r--r-- | plugin/userstat/table_stats.cc | 18 | ||||
-rw-r--r-- | plugin/userstat/user_stats.cc | 58 | ||||
-rw-r--r-- | plugin/wsrep_info/plugin.cc | 43 | ||||
-rw-r--r-- | sql/opt_trace.cc | 21 | ||||
-rw-r--r-- | sql/set_var.cc | 2 | ||||
-rw-r--r-- | sql/sql_basic_types.h | 2 | ||||
-rw-r--r-- | sql/sql_i_s.h | 318 | ||||
-rw-r--r-- | sql/sql_profile.cc | 44 | ||||
-rw-r--r-- | sql/sql_profile.h | 3 | ||||
-rw-r--r-- | sql/sql_show.cc | 1186 | ||||
-rw-r--r-- | sql/sql_show.h | 2 | ||||
-rw-r--r-- | sql/table.h | 81 | ||||
-rw-r--r-- | sql/thread_pool_info.cc | 87 |
23 files changed, 1143 insertions, 978 deletions
diff --git a/mysql-test/main/thread_pool_info.result b/mysql-test/main/thread_pool_info.result index 05cb8de5bb9..802e2f3a7ec 100644 --- a/mysql-test/main/thread_pool_info.result +++ b/mysql-test/main/thread_pool_info.result @@ -31,7 +31,7 @@ Field Type Null Key Default Extra GROUP_ID int(6) NO 0 POSITION int(6) NO 0 PRIORITY int(1) NO 0 -CONNECTION_ID bigint(19) NO 0 +CONNECTION_ID bigint(19) unsigned NO 0 QUEUEING_TIME_MICROSECONDS bigint(19) NO 0 DESC INFORMATION_SCHEMA.THREAD_POOL_STATS; Field Type Null Key Default Extra diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc index 5bd7e0e46b7..844f69d18b6 100644 --- a/plugin/disks/information_schema_disks.cc +++ b/plugin/disks/information_schema_disks.cc @@ -19,25 +19,28 @@ #include <sys/types.h> #include <mntent.h> #include <sql_class.h> -#include <table.h> +#include <sql_i_s.h> bool schema_table_store_record(THD *thd, TABLE *table); -namespace -{ struct st_mysql_information_schema disks_table_info = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; + +namespace Show { + ST_FIELD_INFO disks_table_fields[]= { - { "Disk", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 }, - { "Path", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 }, - { "Total", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Total amount available - { "Used", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount of space used - { "Available", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount available to users other than root. - { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 } + Column("Disk", Varchar(PATH_MAX), NOT_NULL), + Column("Path", Varchar(PATH_MAX), NOT_NULL), + Column("Total", SLong(32), NOT_NULL), // Total amount available + Column("Used", SLong(32), NOT_NULL), // Amount of space used + Column("Available", SLong(32), NOT_NULL), // Amount available to users other than root. + CEnd() }; + + int disks_table_add_row(THD* pThd, TABLE* pTable, const char* zDisk, @@ -130,7 +133,7 @@ int disks_table_init(void *ptr) return 0; } -} +} // namespace Show extern "C" { @@ -143,7 +146,7 @@ maria_declare_plugin(disks) "Johan Wikman", /* author */ "Disk space information", /* description */ PLUGIN_LICENSE_GPL, /* license type */ - disks_table_init, /* init function */ + Show::disks_table_init, /* init function */ NULL, /* deinit function */ 0x0100, /* version = 1.0 */ NULL, /* no status variables */ diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index 48e3d21f6fe..b8e6feb3807 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -67,9 +67,9 @@ ST_SCHEMA_TABLE *i_s_feedback; ///< table descriptor for our I_S table */ static ST_FIELD_INFO feedback_fields[] = { - {"VARIABLE_NAME", 255, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0} + Show::Column("VARIABLE_NAME", Show::Varchar(255), NOT_NULL), + Show::Column("VARIABLE_VALUE", Show::Varchar(1024), NOT_NULL), + Show::CEnd() }; static COND * const OOM= (COND*)1; diff --git a/plugin/locale_info/locale_info.cc b/plugin/locale_info/locale_info.cc index e444b4fade0..2685552d4ae 100644 --- a/plugin/locale_info/locale_info.cc +++ b/plugin/locale_info/locale_info.cc @@ -28,27 +28,31 @@ #include <my_global.h> #include <sql_class.h> // THD -#include <table.h> // ST_SCHEMA_TABLE +#include <sql_i_s.h> // ST_SCHEMA_TABLE #include <mysql/plugin.h> #include <m_ctype.h> #include "sql_locale.h" -bool schema_table_store_record(THD *thd, TABLE *table); static MY_LOCALE **locale_list; +namespace Show { + /* LOCALES */ static ST_FIELD_INFO locale_info_locale_fields_info[]= { - {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", 0}, - {"NAME", 255, MYSQL_TYPE_STRING, 0, 0, "Name", 0}, - {"DESCRIPTION", 255, MYSQL_TYPE_STRING, 0, 0, "Description", 0}, - {"MAX_MONTH_NAME_LENGTH", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"MAX_DAY_NAME_LENGTH", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"DECIMAL_POINT", 2, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"THOUSAND_SEP", 2, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"ERROR_MESSAGE_LANGUAGE", 64, MYSQL_TYPE_STRING, 0, 0, "Error_Message_Language", 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("ID", SLonglong(4), NOT_NULL, "Id"), + Column("NAME", Varchar(255), NOT_NULL, "Name"), + Column("DESCRIPTION", Varchar(255), NOT_NULL, "Description"), + Column("MAX_MONTH_NAME_LENGTH", SLonglong(4), NOT_NULL), + Column("MAX_DAY_NAME_LENGTH", SLonglong(4), NOT_NULL), + Column("DECIMAL_POINT", Varchar(2), NOT_NULL), + Column("THOUSAND_SEP", Varchar(2), NOT_NULL), + Column("ERROR_MESSAGE_LANGUAGE", Varchar(64), NOT_NULL, "Error_Message_Language"), + CEnd() }; + +} // namespace Show + static int locale_info_fill_table_locale(THD* thd, TABLE_LIST* tables, COND* cond) { TABLE *table= tables->table; @@ -84,7 +88,7 @@ static int locale_info_fill_table_locale(THD* thd, TABLE_LIST* tables, COND* con static int locale_info_plugin_init_locales(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= locale_info_locale_fields_info; + schema->fields_info= Show::locale_info_locale_fields_info; schema->fill_table= locale_info_fill_table_locale; #if defined(_WIN64) diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index a4c1d8ef205..46c31ca3a96 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -18,7 +18,7 @@ #include "mysql_version.h" #include "mysql/plugin.h" #include "sql_class.h" -#include "sql_show.h" +#include "sql_i_s.h" static const LEX_STRING metadata_lock_info_lock_name[] = { { C_STRING_WITH_LEN("Backup lock") }, @@ -32,23 +32,22 @@ static const LEX_STRING metadata_lock_info_lock_name[] = { { C_STRING_WITH_LEN("User lock") }, }; +namespace Show { + static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] = { - {"THREAD_ID", 20, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_UNSIGNED, "thread_id", SKIP_OPEN_TABLE}, - {"LOCK_MODE", 24, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "lock_mode", SKIP_OPEN_TABLE}, - {"LOCK_DURATION", 30, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "lock_duration", SKIP_OPEN_TABLE}, - {"LOCK_TYPE", 33, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "lock_type", SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", 64, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "table_schema", SKIP_OPEN_TABLE}, - {"TABLE_NAME", 64, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, "table_name", SKIP_OPEN_TABLE}, - {NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0} + Column("THREAD_ID", ULonglong(20), NOT_NULL, "thread_id"), + Column("LOCK_MODE", Varchar(24), NULLABLE, "lock_mode"), + Column("LOCK_DURATION", Varchar(30), NULLABLE, "lock_duration"), + Column("LOCK_TYPE", Varchar(33), NULLABLE, "lock_type"), + Column("TABLE_SCHEMA", Name(), NULLABLE, "table_schema"), + Column("TABLE_NAME", Name(), NULLABLE, "table_name"), + CEnd() }; +} // namespace Show + + struct st_i_s_metadata_param { THD *thd; @@ -110,7 +109,7 @@ static int i_s_metadata_lock_info_init( ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p; DBUG_ENTER("i_s_metadata_lock_info_init"); - schema->fields_info = i_s_metadata_lock_info_fields_info; + schema->fields_info = Show::i_s_metadata_lock_info_fields_info; schema->fill_table = i_s_metadata_lock_info_fill_table; schema->idx_field1 = 0; DBUG_RETURN(0); diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc index c01207571d2..1da9c5f6ee8 100644 --- a/plugin/qc_info/qc_info.cc +++ b/plugin/qc_info/qc_info.cc @@ -37,7 +37,7 @@ #include <sql_acl.h> // PROCESS_ACL #include <sql_class.h> // THD #include <sql_cache.h> -#include <table.h> // ST_SCHEMA_TABLE +#include <sql_i_s.h> // ST_SCHEMA_TABLE #include <set_var.h> // sql_mode_string_representation #include <tztime.h> #include <mysql/plugin.h> @@ -79,36 +79,41 @@ bool schema_table_store_record(THD *thd, TABLE *table); #define COLUMN_PKT_NR 22 #define COLUMN_HITS 23 + +namespace Show { + /* ST_FIELD_INFO is defined in table.h */ static ST_FIELD_INFO qc_info_fields[]= { - {"STATEMENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"STATEMENT_TEXT", MAX_STATEMENT_TEXT_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"RESULT_BLOCKS_COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"RESULT_BLOCKS_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"RESULT_BLOCKS_SIZE_USED", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"LIMIT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"MAX_SORT_LENGTH", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"GROUP_CONCAT_MAX_LENGTH", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"CHARACTER_SET_RESULT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"TIMEZONE", 50, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"DEFAULT_WEEK_FORMAT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"DIV_PRECISION_INCREMENT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"SQL_MODE", 250, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"LC_TIME_NAMES", 100, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"CLIENT_LONG_FLAG", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"CLIENT_PROTOCOL_41", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"PROTOCOL_TYPE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"MORE_RESULTS_EXISTS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"IN_TRANS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"AUTOCOMMIT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"PACKET_NUMBER", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"HITS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("STATEMENT_SCHEMA", Varchar(NAME_LEN), NOT_NULL), + Column("STATEMENT_TEXT", Longtext(MAX_STATEMENT_TEXT_LENGTH),NOT_NULL), + Column("RESULT_BLOCKS_COUNT", SLong(), NOT_NULL), + Column("RESULT_BLOCKS_SIZE", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS),NOT_NULL), + Column("RESULT_BLOCKS_SIZE_USED",SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("LIMIT", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("MAX_SORT_LENGTH", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("GROUP_CONCAT_MAX_LENGTH",SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL), + Column("CHARACTER_SET_RESULT", CSName(), NOT_NULL), + Column("COLLATION", CSName(), NOT_NULL), + Column("TIMEZONE", Varchar(50), NOT_NULL), + Column("DEFAULT_WEEK_FORMAT", SLong(), NOT_NULL), + Column("DIV_PRECISION_INCREMENT",SLong(), NOT_NULL), + Column("SQL_MODE", Varchar(250), NOT_NULL), + Column("LC_TIME_NAMES", Varchar(100), NOT_NULL), + Column("CLIENT_LONG_FLAG", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("CLIENT_PROTOCOL_41", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("PROTOCOL_TYPE", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("MORE_RESULTS_EXISTS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("IN_TRANS", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("AUTOCOMMIT", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("PACKET_NUMBER", STiny(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + Column("HITS", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL), + CEnd() }; +} // namespace Show + static const char unknown[]= "#UNKNOWN#"; @@ -276,7 +281,7 @@ static int qc_info_plugin_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= qc_info_fields; + schema->fields_info= Show::qc_info_fields; schema->fill_table= qc_info_fill_table; #ifdef _WIN32 diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc index c337424039c..0362c6e2792 100644 --- a/plugin/query_response_time/plugin.cc +++ b/plugin/query_response_time/plugin.cc @@ -16,7 +16,7 @@ #define MYSQL_SERVER #include <my_global.h> #include <sql_class.h> -#include <table.h> +#include <sql_i_s.h> #include <sql_show.h> #include <mysql/plugin_audit.h> #include "query_response_time.h" @@ -71,19 +71,22 @@ static struct st_mysql_sys_var *query_response_time_info_vars[]= }; +namespace Show { + ST_FIELD_INFO query_response_time_fields_info[] = { - { "TIME", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Time", 0 }, - { "COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "Count", 0 }, - { "TOTAL", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Total", 0 }, - { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 } + Column("TIME", Varchar(QRT_TIME_STRING_LENGTH), NOT_NULL, "Time"), + Column("COUNT", ULong(), NOT_NULL, "Count"), + Column("TOTAL", Varchar(QRT_TIME_STRING_LENGTH), NOT_NULL, "Total"), + CEnd() }; +} // namespace Show static int query_response_time_info_init(void *p) { ST_SCHEMA_TABLE *i_s_query_response_time= (ST_SCHEMA_TABLE *) p; - i_s_query_response_time->fields_info= query_response_time_fields_info; + i_s_query_response_time->fields_info= Show::query_response_time_fields_info; i_s_query_response_time->fill_table= query_response_time_fill; i_s_query_response_time->reset_table= query_response_time_flush; query_response_time_init(); diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc index bee8b1feccc..f820e4ad890 100644 --- a/plugin/user_variables/user_variables.cc +++ b/plugin/user_variables/user_variables.cc @@ -16,7 +16,7 @@ #define MYSQL_SERVER #include <my_global.h> #include <sql_class.h> -#include <table.h> +#include <sql_i_s.h> #include <sql_show.h> @@ -42,16 +42,18 @@ static const LEX_CSTRING unsigned_result_types[]= }; +namespace Show { + static ST_FIELD_INFO user_variables_fields_info[] = { - { "VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Variable_name", 0 }, - { "VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "Value", 0 }, - { "VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0 }, - { "CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, 0, 0 }, - { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 } + Column("VARIABLE_NAME", Name(), NOT_NULL, "Variable_name"), + Column("VARIABLE_VALUE", Varchar(2048), NULLABLE, "Value"), + Column("VARIABLE_TYPE", Name(), NOT_NULL), + Column("CHARACTER_SET_NAME", CSName(), NULLABLE), + CEnd() }; +} // namespace Show static int user_variables_fill(THD *thd, TABLE_LIST *tables, COND *cond) { @@ -110,7 +112,7 @@ int user_variables_reset(void) static int user_variables_init(void *p) { ST_SCHEMA_TABLE *is= (ST_SCHEMA_TABLE *) p; - is->fields_info= user_variables_fields_info; + is->fields_info= Show::user_variables_fields_info; is->fill_table= user_variables_fill; is->reset_table= user_variables_reset; return 0; diff --git a/plugin/userstat/client_stats.cc b/plugin/userstat/client_stats.cc index a1835384ad1..2adeb23a385 100644 --- a/plugin/userstat/client_stats.cc +++ b/plugin/userstat/client_stats.cc @@ -1,33 +1,37 @@ +namespace Show { + static ST_FIELD_INFO client_stats_fields[]= { - {"CLIENT", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Client", 0}, - {"TOTAL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Total_connections", 0}, - {"CONCURRENT_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Concurrent_connections", 0}, - {"CONNECTED_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Connected_time", 0}, - {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time", 0}, - {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time", 0}, - {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received", 0}, - {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent", 0}, - {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written", 0}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read", 0}, - {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent", 0}, - {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted", 0}, - {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted", 0}, - {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated", 0}, - {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands", 0}, - {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands", 0}, - {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands", 0}, - {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions", 0}, - {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions", 0}, - {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections", 0}, - {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections", 0}, - {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied", 0}, - {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries", 0}, - {"TOTAL_SSL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Total_ssl_connections", 0}, - {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("CLIENT",Varchar(LIST_PROCESS_HOST_LEN), NOT_NULL, "Client"), + Column("TOTAL_CONNECTIONS", SLonglong(), NOT_NULL, "Total_connections"), + Column("CONCURRENT_CONNECTIONS", SLonglong(), NOT_NULL, "Concurrent_connections"), + Column("CONNECTED_TIME", SLonglong(), NOT_NULL, "Connected_time"), + Column("BUSY_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Busy_time"), + Column("CPU_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Cpu_time"), + Column("BYTES_RECEIVED", SLonglong(), NOT_NULL, "Bytes_received"), + Column("BYTES_SENT", SLonglong(), NOT_NULL, "Bytes_sent"), + Column("BINLOG_BYTES_WRITTEN", SLonglong(), NOT_NULL, "Binlog_bytes_written"), + Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), + Column("ROWS_SENT", SLonglong(), NOT_NULL, "Rows_sent"), + Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), + Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), + Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"), + Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"), + Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"), + Column("COMMIT_TRANSACTIONS", SLonglong(), NOT_NULL, "Commit_transactions"), + Column("ROLLBACK_TRANSACTIONS", SLonglong(), NOT_NULL, "Rollback_transactions"), + Column("DENIED_CONNECTIONS", SLonglong(), NOT_NULL, "Denied_connections"), + Column("LOST_CONNECTIONS", SLonglong(), NOT_NULL, "Lost_connections"), + Column("ACCESS_DENIED", SLonglong(), NOT_NULL, "Access_denied"), + Column("EMPTY_QUERIES", SLonglong(), NOT_NULL, "Empty_queries"), + Column("TOTAL_SSL_CONNECTIONS", ULonglong(), NOT_NULL, "Total_ssl_connections"), + Column("MAX_STATEMENT_TIME_EXCEEDED", SLonglong(), NOT_NULL, "Max_statement_time_exceeded"), + CEnd() }; +} // namespace Show + static int send_user_stats(THD* thd, HASH *all_user_stats, TABLE *table) { mysql_mutex_lock(&LOCK_global_user_client_stats); @@ -92,7 +96,7 @@ static int client_stats_reset() static int client_stats_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= client_stats_fields; + schema->fields_info= Show::client_stats_fields; schema->fill_table= client_stats_fill; schema->reset_table= client_stats_reset; return 0; diff --git a/plugin/userstat/index_stats.cc b/plugin/userstat/index_stats.cc index 0528507c50e..8605e56fbc8 100644 --- a/plugin/userstat/index_stats.cc +++ b/plugin/userstat/index_stats.cc @@ -1,12 +1,16 @@ +namespace Show { + static ST_FIELD_INFO index_stats_fields[]= { - {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE}, - {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Index_name",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0,0} + Column("TABLE_SCHEMA", Varchar(NAME_LEN), NOT_NULL, "Table_schema"), + Column("TABLE_NAME", Varchar(NAME_LEN), NOT_NULL, "Table_name"), + Column("INDEX_NAME", Varchar(NAME_LEN), NOT_NULL, "Index_name"), + Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), + CEnd() }; +} // namespace Show + static int index_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond) { TABLE *table= tables->table; @@ -63,7 +67,7 @@ static int index_stats_reset() static int index_stats_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= index_stats_fields; + schema->fields_info= Show::index_stats_fields; schema->fill_table= index_stats_fill; schema->reset_table= index_stats_reset; return 0; diff --git a/plugin/userstat/table_stats.cc b/plugin/userstat/table_stats.cc index 3119e516e06..c733d77c26b 100644 --- a/plugin/userstat/table_stats.cc +++ b/plugin/userstat/table_stats.cc @@ -1,13 +1,17 @@ +namespace Show { + static ST_FIELD_INFO table_stats_fields[]= { - {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_schema",SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_name",SKIP_OPEN_TABLE}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read",SKIP_OPEN_TABLE}, - {"ROWS_CHANGED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed",SKIP_OPEN_TABLE}, - {"ROWS_CHANGED_X_INDEXES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_changed_x_#indexes",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("TABLE_SCHEMA", Varchar(NAME_LEN), NOT_NULL, "Table_schema"), + Column("TABLE_NAME", Varchar(NAME_LEN), NOT_NULL, "Table_name"), + Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), + Column("ROWS_CHANGED", SLonglong(), NOT_NULL, "Rows_changed"), + Column("ROWS_CHANGED_X_INDEXES",SLonglong(), NOT_NULL, "Rows_changed_x_#indexes"), + CEnd() }; +} // namespace Show + static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond) { TABLE *table= tables->table; @@ -67,7 +71,7 @@ static int table_stats_reset() static int table_stats_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= table_stats_fields; + schema->fields_info= Show::table_stats_fields; schema->fill_table= table_stats_fill; schema->reset_table= table_stats_reset; return 0; diff --git a/plugin/userstat/user_stats.cc b/plugin/userstat/user_stats.cc index 12e2372e5cf..50809e0442a 100644 --- a/plugin/userstat/user_stats.cc +++ b/plugin/userstat/user_stats.cc @@ -1,33 +1,37 @@ +namespace Show { + static ST_FIELD_INFO user_stats_fields[]= { - {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", 0}, - {"TOTAL_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections", 0}, - {"CONCURRENT_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections", 0}, - {"CONNECTED_TIME", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time", 0}, - {"BUSY_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Busy_time", 0}, - {"CPU_TIME", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_DOUBLE, 0, 0, "Cpu_time", 0}, - {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_received", 0}, - {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Bytes_sent", 0}, - {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Binlog_bytes_written", 0}, - {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_read", 0}, - {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_sent", 0}, - {"ROWS_DELETED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_deleted", 0}, - {"ROWS_INSERTED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_inserted", 0}, - {"ROWS_UPDATED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rows_updated", 0}, - {"SELECT_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Select_commands", 0}, - {"UPDATE_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Update_commands", 0}, - {"OTHER_COMMANDS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Other_commands", 0}, - {"COMMIT_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Commit_transactions", 0}, - {"ROLLBACK_TRANSACTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Rollback_transactions", 0}, - {"DENIED_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Denied_connections", 0}, - {"LOST_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Lost_connections", 0}, - {"ACCESS_DENIED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Access_denied", 0}, - {"EMPTY_QUERIES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Empty_queries", 0}, - {"TOTAL_SSL_CONNECTIONS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Total_ssl_connections", 0}, - {"MAX_STATEMENT_TIME_EXCEEDED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Max_statement_time_exceeded",SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("USER",Varchar(USERNAME_CHAR_LENGTH),NOT_NULL, "User"), + Column("TOTAL_CONNECTIONS", SLong(), NOT_NULL, "Total_connections"), + Column("CONCURRENT_CONNECTIONS",SLong(), NOT_NULL, "Concurrent_connections"), + Column("CONNECTED_TIME", SLong(), NOT_NULL, "Connected_time"), + Column("BUSY_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Busy_time"), + Column("CPU_TIME", Double(MY_INT64_NUM_DECIMAL_DIGITS), NOT_NULL, "Cpu_time"), + Column("BYTES_RECEIVED", SLonglong(), NOT_NULL, "Bytes_received"), + Column("BYTES_SENT", SLonglong(), NOT_NULL, "Bytes_sent"), + Column("BINLOG_BYTES_WRITTEN", SLonglong(), NOT_NULL, "Binlog_bytes_written"), + Column("ROWS_READ", SLonglong(), NOT_NULL, "Rows_read"), + Column("ROWS_SENT", SLonglong(), NOT_NULL, "Rows_sent"), + Column("ROWS_DELETED", SLonglong(), NOT_NULL, "Rows_deleted"), + Column("ROWS_INSERTED", SLonglong(), NOT_NULL, "Rows_inserted"), + Column("ROWS_UPDATED", SLonglong(), NOT_NULL, "Rows_updated"), + Column("SELECT_COMMANDS", SLonglong(), NOT_NULL, "Select_commands"), + Column("UPDATE_COMMANDS", SLonglong(), NOT_NULL, "Update_commands"), + Column("OTHER_COMMANDS", SLonglong(), NOT_NULL, "Other_commands"), + Column("COMMIT_TRANSACTIONS", SLonglong(), NOT_NULL, "Commit_transactions"), + Column("ROLLBACK_TRANSACTIONS",SLonglong(), NOT_NULL, "Rollback_transactions"), + Column("DENIED_CONNECTIONS", SLonglong(), NOT_NULL, "Denied_connections"), + Column("LOST_CONNECTIONS", SLonglong(), NOT_NULL, "Lost_connections"), + Column("ACCESS_DENIED", SLonglong(), NOT_NULL, "Access_denied"), + Column("EMPTY_QUERIES", SLonglong(), NOT_NULL, "Empty_queries"), + Column("TOTAL_SSL_CONNECTIONS",ULonglong(), NOT_NULL, "Total_ssl_connections"), + Column("MAX_STATEMENT_TIME_EXCEEDED",SLonglong(),NOT_NULL, "Max_statement_time_exceeded"), + CEnd() }; +} // namespace Show + static int user_stats_fill(THD* thd, TABLE_LIST* tables, COND* cond) { if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true)) @@ -48,7 +52,7 @@ static int user_stats_reset() static int user_stats_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= user_stats_fields; + schema->fields_info= Show::user_stats_fields; schema->fill_table= user_stats_fill; schema->reset_table= user_stats_reset; return 0; diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc index f78ecdcb68c..51eadc9d3cf 100644 --- a/plugin/wsrep_info/plugin.cc +++ b/plugin/wsrep_info/plugin.cc @@ -19,7 +19,7 @@ #include <my_global.h> #include <mysql/plugin.h> -#include <table.h> /* ST_SCHEMA_TABLE */ +#include <sql_i_s.h> /* ST_SCHEMA_TABLE */ #include <sql_show.h> #include <sql_acl.h> /* check_global_access() */ #include <wsrep_mysqld.h> @@ -55,35 +55,32 @@ /* Application protocol version */ #define COLUMN_WSREP_STATUS_PROTO_VERSION 7 +namespace Show { static ST_FIELD_INFO wsrep_memb_fields[]= { - {"INDEX", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Index", 0}, - {"UUID", WSREP_UUID_STR_LEN, MYSQL_TYPE_STRING, 0, 0, "Uuid", 0}, - {"NAME", WSREP_MEMBER_NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", 0}, - {"ADDRESS", WSREP_INCOMING_LEN, MYSQL_TYPE_STRING, 0, 0, "Address", 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("INDEX", SLong(), NOT_NULL, "Index"), + Column("UUID", Varchar(WSREP_UUID_STR_LEN), NOT_NULL, "Uuid"), + Column("NAME", Varchar(WSREP_MEMBER_NAME_LEN), NOT_NULL, "Name"), + Column("ADDRESS", Varchar(WSREP_INCOMING_LEN), NOT_NULL, "Address"), + CEnd() }; static ST_FIELD_INFO wsrep_status_fields[]= { - {"NODE_INDEX", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, - 0, 0, "Node_Index", 0}, - {"NODE_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Node_Status", 0}, - {"CLUSTER_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Cluster_Status", 0}, - {"CLUSTER_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, - 0, 0, "Cluster_Size", 0}, - {"CLUSTER_STATE_UUID", WSREP_UUID_STR_LEN, MYSQL_TYPE_STRING, - 0, 0, 0, 0}, - {"CLUSTER_STATE_SEQNO", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, 0, 0, 0}, - {"CLUSTER_CONF_ID", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, 0, 0, 0}, - {"PROTOCOL_VERSION", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, - 0, 0, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("NODE_INDEX", SLong(), NOT_NULL, "Node_Index"), + Column("NODE_STATUS", Varchar(16), NOT_NULL, "Node_Status"), + Column("CLUSTER_STATUS", Varchar(16), NOT_NULL, "Cluster_Status"), + Column("CLUSTER_SIZE", SLong(), NOT_NULL, "Cluster_Size"), + Column("CLUSTER_STATE_UUID", Varchar(WSREP_UUID_STR_LEN), NOT_NULL), + Column("CLUSTER_STATE_SEQNO", SLonglong(), NOT_NULL), + Column("CLUSTER_CONF_ID", SLonglong(), NOT_NULL), + Column("PROTOCOL_VERSION", SLong(), NOT_NULL), + CEnd() }; +} // namespace Show + static int wsrep_memb_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) { int rc= 0; @@ -131,7 +128,7 @@ static int wsrep_memb_plugin_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= wsrep_memb_fields; + schema->fields_info= Show::wsrep_memb_fields; schema->fill_table= wsrep_memb_fill_table; return 0; @@ -189,7 +186,7 @@ static int wsrep_status_plugin_init(void *p) { ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p; - schema->fields_info= wsrep_status_fields; + schema->fields_info= Show::wsrep_status_fields; schema->fill_table= wsrep_status_fill_table; return 0; diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc index befc7934a3a..4c9aa43669d 100644 --- a/sql/opt_trace.cc +++ b/sql/opt_trace.cc @@ -17,7 +17,7 @@ #include "sql_class.h" #include "sql_show.h" #include "field.h" -#include "table.h" +#include "sql_i_s.h" #include "opt_trace.h" #include "sql_parse.h" #include "set_var.h" @@ -66,18 +66,21 @@ bool sets_var_optimizer_trace(enum enum_sql_command sql_command, } +namespace Show { + + ST_FIELD_INFO optimizer_trace_info[]= { - /* name, length, type, value, maybe_null, old_name, open_method */ - {"QUERY", 65535, MYSQL_TYPE_STRING, 0, false, NULL, SKIP_OPEN_TABLE}, - {"TRACE", 65535, MYSQL_TYPE_STRING, 0, false, NULL, SKIP_OPEN_TABLE}, - {"MISSING_BYTES_BEYOND_MAX_MEM_SIZE", 20, MYSQL_TYPE_LONG, 0, false, NULL, - SKIP_OPEN_TABLE}, - {"INSUFFICIENT_PRIVILEGES", 1, MYSQL_TYPE_TINY, 0, false, NULL, - SKIP_OPEN_TABLE}, - {NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL, 0} + Column("QUERY", Longtext(65535), NOT_NULL), + Column("TRACE", Longtext(65535), NOT_NULL), + Column("MISSING_BYTES_BEYOND_MAX_MEM_SIZE", SLong(20), NOT_NULL), + Column("INSUFFICIENT_PRIVILEGES", STiny(1), NOT_NULL), + CEnd() }; +} // namespace Show + + /* TODO: one-line needs to be implemented seperately */ diff --git a/sql/set_var.cc b/sql/set_var.cc index 4b0257871ac..9ca6e4bb575 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -35,7 +35,7 @@ #include "tztime.h" // my_tz_find, my_tz_SYSTEM, struct Time_zone #include "sql_acl.h" // SUPER_ACL #include "sql_select.h" // free_underlaid_joins -#include "sql_show.h" +#include "sql_i_s.h" #include "sql_view.h" // updatable_views_with_limit_typelib #include "lock.h" // lock_global_read_lock, // make_global_read_lock_block_commit, diff --git a/sql/sql_basic_types.h b/sql/sql_basic_types.h index 170e93741ef..3200228618f 100644 --- a/sql/sql_basic_types.h +++ b/sql/sql_basic_types.h @@ -23,6 +23,8 @@ typedef ulonglong sql_mode_t; typedef int64 query_id_t; +enum enum_nullability { NOT_NULL, NULLABLE }; + /* "fuzzydate" with strict data type control. diff --git a/sql/sql_i_s.h b/sql/sql_i_s.h new file mode 100644 index 00000000000..8ccc93d8bdb --- /dev/null +++ b/sql/sql_i_s.h @@ -0,0 +1,318 @@ +#ifndef SQL_I_S_INCLUDED +#define SQL_I_S_INCLUDED +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. + Copyright (c) 2009, 2019, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include "sql_const.h" // MAX_FIELD_VARCHARLENGTH +#include "sql_basic_types.h" // enum_nullability +#include "sql_string.h" // strlen, MY_CS_NAME_SIZE +#include "lex_string.h" // LEX_CSTRING +#include "mysql_com.h" // enum_field_types +#include "my_time.h" // TIME_SECOND_PART_DIGITS + +struct TABLE_LIST; +struct TABLE; +typedef class Item COND; + +#ifdef MYSQL_CLIENT +#error MYSQL_CLIENT must not be defined +#endif // MYSQL_CLIENT + + +bool schema_table_store_record(THD *thd, TABLE *table); +COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table); + + +#define MY_I_S_MAYBE_NULL 1U +#define MY_I_S_UNSIGNED 2U + + +enum enum_show_open_table +{ + SKIP_OPEN_TABLE= 0U, // do not open table + OPEN_FRM_ONLY= 1U, // open FRM file only + OPEN_FULL_TABLE= 2U // open FRM,MYD, MYI files +}; + + +struct ST_FIELD_INFO +{ + /** + This is used as column name. + */ + const char* field_name; + /** + For string-type columns, this is the maximum number of + characters. Otherwise, it is the 'display-length' for the column. + */ + uint field_length; + /** + This denotes data type for the column. For the most part, there seems to + be one entry in the enum for each SQL data type, although there seem to + be a number of additional entries in the enum. + */ + enum enum_field_types field_type; + int value; + /** + This is used to set column attributes. By default, columns are @c NOT + @c NULL and @c SIGNED, and you can deviate from the default + by setting the appopriate flags. You can use either one of the flags + @c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or + combine them using the bitwise or operator @c |. Both flags are + defined in table.h. + */ + uint field_flags; // Field atributes(maybe_null, signed, unsigned etc.) + const char* old_name; + /** + This should be one of @c SKIP_OPEN_TABLE, + @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE. + */ + uint open_method; + + LEX_CSTRING get_name() const + { + return LEX_CSTRING({field_name, strlen(field_name)}); + } + LEX_CSTRING get_old_name() const + { + return LEX_CSTRING({old_name, strlen(old_name)}); + } + bool unsigned_flag() const { return field_flags & MY_I_S_UNSIGNED; } + uint fsp() const + { + DBUG_ASSERT(field_length <= TIME_SECOND_PART_DIGITS); + return field_length; + } +}; + + +namespace Show +{ + +class Type +{ + enum enum_field_types m_type; + uint m_char_length; + uint m_unsigned_flag; +public: + Type(enum_field_types type, uint length, uint unsigned_flag) + :m_type(type), m_char_length(length), m_unsigned_flag(unsigned_flag) + { } + enum_field_types type() const { return m_type; } + uint char_length() const { return m_char_length; } + uint unsigned_flag() const { return m_unsigned_flag; } +}; + + +class Blob: public Type +{ +public: + Blob(uint length) :Type(MYSQL_TYPE_BLOB, length, false) { } +}; + + +class Varchar: public Type +{ +public: + Varchar(uint length) :Type(MYSQL_TYPE_STRING, length, false) + { + DBUG_ASSERT(length * 3 <= MAX_FIELD_VARCHARLENGTH); + } +}; + + +class Longtext: public Type +{ +public: + Longtext(uint length) :Type(MYSQL_TYPE_STRING, length, false) { } +}; + + +class Yesno: public Varchar +{ +public: + Yesno(): Varchar(3) { } +}; + + +class Catalog: public Varchar +{ +public: + Catalog(): Varchar(FN_REFLEN) { } +}; + + +class Name: public Varchar +{ +public: + Name(): Varchar(NAME_CHAR_LEN) { } +}; + + +class Definer: public Varchar +{ +public: + Definer(): Varchar(DEFINER_CHAR_LENGTH) { } +}; + + +class Userhost: public Varchar +{ +public: + Userhost(): Varchar(USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 2) { } +}; + + +class CSName: public Varchar +{ +public: + CSName(): Varchar(MY_CS_NAME_SIZE) { } +}; + + +class SQLMode: public Varchar +{ +public: + SQLMode(): Varchar(32*256) { } +}; + + +class Datetime: public Type +{ +public: + Datetime(uint dec) :Type(MYSQL_TYPE_DATETIME, dec, false) { } +}; + + +class Decimal: public Type +{ +public: + Decimal(uint length) :Type(MYSQL_TYPE_DECIMAL, length, false) { } +}; + + +class ULonglong: public Type +{ +public: + ULonglong(uint length) :Type(MYSQL_TYPE_LONGLONG, length, true) { } + ULonglong() :ULonglong(MY_INT64_NUM_DECIMAL_DIGITS) { } +}; + + +class ULong: public Type +{ +public: + ULong(uint length) :Type(MYSQL_TYPE_LONG, length, true) { } + ULong() :ULong(MY_INT32_NUM_DECIMAL_DIGITS) { } +}; + + +class SLonglong: public Type +{ +public: + SLonglong(uint length) :Type(MYSQL_TYPE_LONGLONG, length, false) { } + SLonglong() :SLonglong(MY_INT64_NUM_DECIMAL_DIGITS) { } +}; + + +class SLong: public Type +{ +public: + SLong(uint length) :Type(MYSQL_TYPE_LONG, length, false) { } + SLong() :SLong(MY_INT32_NUM_DECIMAL_DIGITS) { } +}; + + +class SShort: public Type +{ +public: + SShort(uint length) :Type(MYSQL_TYPE_SHORT, length, false) { } +}; + + +class STiny: public Type +{ +public: + STiny(uint length) :Type(MYSQL_TYPE_TINY, length, false) { } +}; + + +class Double: public Type +{ +public: + Double(uint length) :Type(MYSQL_TYPE_DOUBLE, length, false) { } +}; + + + +class Column: public ST_FIELD_INFO +{ +public: + Column(const char *name, const Type &type, enum_nullability nullability, + const char *old_name, + enum_show_open_table open_method= SKIP_OPEN_TABLE) + { + ST_FIELD_INFO::field_name= name; + ST_FIELD_INFO::field_length= type.char_length(); + ST_FIELD_INFO::field_type= type.type(); + ST_FIELD_INFO::value= 0; + ST_FIELD_INFO::field_flags= + (type.unsigned_flag() ? MY_I_S_UNSIGNED : 0) | + (nullability == NULLABLE ? MY_I_S_MAYBE_NULL : 0); + ST_FIELD_INFO::old_name= old_name; + ST_FIELD_INFO::open_method= open_method; + } + Column(const char *name, const Type &type, enum_nullability nullability, + enum_show_open_table open_method= SKIP_OPEN_TABLE) + :Column(name, type, nullability, NullS, open_method) + { } +}; + + +// End marker +class CEnd: public Column +{ +public: + CEnd() :Column(NullS, Varchar(0), NOT_NULL, NullS, SKIP_OPEN_TABLE) { } +}; + + +} // namespace Show + + +struct TABLE_LIST; +typedef class Item COND; + +typedef struct st_schema_table +{ + const char *table_name; + ST_FIELD_INFO *fields_info; + /* for FLUSH table_name */ + int (*reset_table) (); + /* Fill table with data */ + int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond); + /* Handle fileds for old SHOW */ + int (*old_format) (THD *thd, struct st_schema_table *schema_table); + int (*process_table) (THD *thd, TABLE_LIST *tables, TABLE *table, + bool res, const LEX_CSTRING *db_name, + const LEX_CSTRING *table_name); + int idx_field1, idx_field2; + bool hidden; + uint i_s_requested_object; /* the object we need to open(TABLE | VIEW) */ +} ST_SCHEMA_TABLE; + + +#endif // SQL_I_S_INCLUDED diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 43eb4b144d2..996a7249db4 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -32,7 +32,7 @@ #include "mariadb.h" #include "sql_priv.h" #include "sql_profile.h" -#include "sql_show.h" // schema_table_store_record +#include "sql_i_s.h" // schema_table_store_record #include "sql_class.h" // THD #ifdef _WIN32 @@ -60,30 +60,32 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, #endif } +namespace Show { + ST_FIELD_INFO query_profile_statistics_info[]= { - /* name, length, type, value, maybe_null, old_name, open_method */ - {"QUERY_ID", 20, MYSQL_TYPE_LONG, 0, false, "Query_id", SKIP_OPEN_TABLE}, - {"SEQ", 20, MYSQL_TYPE_LONG, 0, false, "Seq", SKIP_OPEN_TABLE}, - {"STATE", 30, MYSQL_TYPE_STRING, 0, false, "Status", SKIP_OPEN_TABLE}, - {"DURATION", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, false, "Duration", SKIP_OPEN_TABLE}, - {"CPU_USER", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, true, "CPU_user", SKIP_OPEN_TABLE}, - {"CPU_SYSTEM", TIME_I_S_DECIMAL_SIZE, MYSQL_TYPE_DECIMAL, 0, true, "CPU_system", SKIP_OPEN_TABLE}, - {"CONTEXT_VOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_voluntary", SKIP_OPEN_TABLE}, - {"CONTEXT_INVOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, "Context_involuntary", SKIP_OPEN_TABLE}, - {"BLOCK_OPS_IN", 20, MYSQL_TYPE_LONG, 0, true, "Block_ops_in", SKIP_OPEN_TABLE}, - {"BLOCK_OPS_OUT", 20, MYSQL_TYPE_LONG, 0, true, "Block_ops_out", SKIP_OPEN_TABLE}, - {"MESSAGES_SENT", 20, MYSQL_TYPE_LONG, 0, true, "Messages_sent", SKIP_OPEN_TABLE}, - {"MESSAGES_RECEIVED", 20, MYSQL_TYPE_LONG, 0, true, "Messages_received", SKIP_OPEN_TABLE}, - {"PAGE_FAULTS_MAJOR", 20, MYSQL_TYPE_LONG, 0, true, "Page_faults_major", SKIP_OPEN_TABLE}, - {"PAGE_FAULTS_MINOR", 20, MYSQL_TYPE_LONG, 0, true, "Page_faults_minor", SKIP_OPEN_TABLE}, - {"SWAPS", 20, MYSQL_TYPE_LONG, 0, true, "Swaps", SKIP_OPEN_TABLE}, - {"SOURCE_FUNCTION", 30, MYSQL_TYPE_STRING, 0, true, "Source_function", SKIP_OPEN_TABLE}, - {"SOURCE_FILE", 20, MYSQL_TYPE_STRING, 0, true, "Source_file", SKIP_OPEN_TABLE}, - {"SOURCE_LINE", 20, MYSQL_TYPE_LONG, 0, true, "Source_line", SKIP_OPEN_TABLE}, - {NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL, 0} + Column("QUERY_ID", SLong(20), NOT_NULL, "Query_id"), + Column("SEQ", SLong(20), NOT_NULL, "Seq"), + Column("STATE", Varchar(30), NOT_NULL, "Status"), + Column("DURATION", Decimal(TIME_I_S_DECIMAL_SIZE), NOT_NULL, "Duration"), + Column("CPU_USER", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_user"), + Column("CPU_SYSTEM", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_system"), + Column("CONTEXT_VOLUNTARY", SLong(20), NULLABLE, "Context_voluntary"), + Column("CONTEXT_INVOLUNTARY", SLong(20), NULLABLE, "Context_involuntary"), + Column("BLOCK_OPS_IN", SLong(20), NULLABLE, "Block_ops_in"), + Column("BLOCK_OPS_OUT", SLong(20), NULLABLE, "Block_ops_out"), + Column("MESSAGES_SENT", SLong(20), NULLABLE, "Messages_sent"), + Column("MESSAGES_RECEIVED", SLong(20), NULLABLE, "Messages_received"), + Column("PAGE_FAULTS_MAJOR", SLong(20), NULLABLE, "Page_faults_major"), + Column("PAGE_FAULTS_MINOR", SLong(20), NULLABLE, "Page_faults_minor"), + Column("SWAPS", SLong(20), NULLABLE, "Swaps"), + Column("SOURCE_FUNCTION", Varchar(30), NULLABLE, "Source_function"), + Column("SOURCE_FILE", Varchar(20), NULLABLE, "Source_file"), + Column("SOURCE_LINE", SLong(20), NULLABLE, "Source_line"), + CEnd() }; +} // namespace Show int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table) { diff --git a/sql/sql_profile.h b/sql/sql_profile.h index 7ec20f6aaa7..59db4682440 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -22,7 +22,10 @@ class THD; struct ST_FIELD_INFO; typedef struct st_schema_table ST_SCHEMA_TABLE; +namespace Show { extern ST_FIELD_INFO query_profile_statistics_info[]; +} // namespace Show + int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond); int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8e8791d836f..642b98e0e98 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -93,7 +93,6 @@ enum enum_i_s_events_fields ISE_DB_CL }; -#define USERNAME_WITH_HOST_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 2) static const LEX_CSTRING trg_action_time_type_names[]= { @@ -4814,7 +4813,7 @@ uint get_table_open_method(TABLE_LIST *tables, { star_table_open_method= MY_MIN(star_table_open_method, - schema_table->fields_info[field_indx].open_method); + (uint) schema_table->fields_info[field_indx].open_method); if (bitmap_is_set(tables->table->read_set, field->field_index)) { used_star= false; @@ -8903,811 +8902,684 @@ int fill_key_cache_tables(THD *thd, TABLE_LIST *tables, COND *cond) } +namespace Show { + ST_FIELD_INFO schema_fields_info[]= { - {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"SCHEMA_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database", - SKIP_OPEN_TABLE}, - {"DEFAULT_CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {"DEFAULT_COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"SCHEMA_COMMENT", DATABASE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CATALOG_NAME", Catalog(), NOT_NULL), + Column("SCHEMA_NAME", Name(), NOT_NULL, "Database"), + Column("DEFAULT_CHARACTER_SET_NAME", CSName(), NOT_NULL), + Column("DEFAULT_COLLATION_NAME", CSName(), NOT_NULL), + Column("SQL_PATH", Varchar(FN_REFLEN), NULLABLE), + Column("SCHEMA_COMMENT", Varchar(DATABASE_COMMENT_MAXLEN), NOT_NULL), + CEnd() }; ST_FIELD_INFO tables_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", - SKIP_OPEN_TABLE}, - {"TABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Engine", OPEN_FRM_ONLY}, - {"VERSION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Version", OPEN_FRM_ONLY}, - {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", OPEN_FULL_TABLE}, - {"TABLE_ROWS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", OPEN_FULL_TABLE}, - {"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", OPEN_FULL_TABLE}, - {"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", OPEN_FULL_TABLE}, - {"MAX_DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", OPEN_FULL_TABLE}, - {"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", OPEN_FULL_TABLE}, - {"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", OPEN_FULL_TABLE}, - {"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Auto_increment", OPEN_FULL_TABLE}, - {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Create_time", OPEN_FULL_TABLE}, - {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Update_time", OPEN_FULL_TABLE}, - {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Check_time", OPEN_FULL_TABLE}, - {"TABLE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation", - OPEN_FRM_ONLY}, - {"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE}, - {"CREATE_OPTIONS", 2048, MYSQL_TYPE_STRING, 0, 1, "Create_options", - OPEN_FULL_TABLE}, - {"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, - "Comment", OPEN_FRM_ONLY}, - {"MAX_INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_index_length", OPEN_FULL_TABLE}, - {"TEMPORARY", 1, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "Temporary", OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Name(), NOT_NULL, "Name"), + Column("TABLE_TYPE", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("ENGINE", Name(), NULLABLE, "Engine", OPEN_FRM_ONLY), + Column("VERSION", ULonglong(), NULLABLE, "Version", OPEN_FRM_ONLY), + Column("ROW_FORMAT", Varchar(10), NULLABLE, "Row_format", OPEN_FULL_TABLE), + Column("TABLE_ROWS", ULonglong(), NULLABLE, "Rows", OPEN_FULL_TABLE), + Column("AVG_ROW_LENGTH", ULonglong(), NULLABLE, "Avg_row_length", + OPEN_FULL_TABLE), + Column("DATA_LENGTH", ULonglong(), NULLABLE, "Data_length",OPEN_FULL_TABLE), + Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, "Max_data_length", + OPEN_FULL_TABLE), + Column("INDEX_LENGTH", ULonglong(), NULLABLE, "Index_length",OPEN_FULL_TABLE), + Column("DATA_FREE", ULonglong(), NULLABLE, "Data_free", OPEN_FULL_TABLE), + Column("AUTO_INCREMENT", ULonglong(), NULLABLE, "Auto_increment", + OPEN_FULL_TABLE), + Column("CREATE_TIME", Datetime(0), NULLABLE, "Create_time",OPEN_FULL_TABLE), + Column("UPDATE_TIME", Datetime(0), NULLABLE, "Update_time",OPEN_FULL_TABLE), + Column("CHECK_TIME", Datetime(0), NULLABLE, "Check_time", OPEN_FULL_TABLE), + Column("TABLE_COLLATION", CSName(), NULLABLE, "Collation", OPEN_FRM_ONLY), + Column("CHECKSUM", ULonglong(), NULLABLE, "Checksum", OPEN_FULL_TABLE), + Column("CREATE_OPTIONS", Varchar(2048),NULLABLE, "Create_options", + OPEN_FULL_TABLE), + Column("TABLE_COMMENT", Varchar(TABLE_COMMENT_MAXLEN), + NOT_NULL, "Comment", OPEN_FRM_ONLY), + Column("MAX_INDEX_LENGTH",ULonglong(), NULLABLE, "Max_index_length", + OPEN_FULL_TABLE), + Column("TEMPORARY", Varchar(1), NULLABLE, "Temporary", OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO columns_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field", - OPEN_FRM_ONLY}, - {"ORDINAL_POSITION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_UNSIGNED, 0, OPEN_FRM_ONLY}, - {"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, - 1, "Default", OPEN_FRM_ONLY}, - {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY}, - {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"CHARACTER_MAXIMUM_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"CHARACTER_OCTET_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"NUMERIC_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"NUMERIC_SCALE", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FRM_ONLY}, - {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation", - OPEN_FRM_ONLY}, - {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY}, - {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY}, - {"EXTRA", 30, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, - {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, - {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, - "Comment", OPEN_FRM_ONLY}, - {"IS_GENERATED", 6, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"GENERATION_EXPRESSION", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1, - 0, OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("COLUMN_NAME", Name(), NOT_NULL, "Field", OPEN_FRM_ONLY), + Column("ORDINAL_POSITION", ULonglong(), NOT_NULL, OPEN_FRM_ONLY), + Column("COLUMN_DEFAULT", Longtext(MAX_FIELD_VARCHARLENGTH), + NULLABLE, "Default",OPEN_FRM_ONLY), + Column("IS_NULLABLE", Yesno(), NOT_NULL, "Null", OPEN_FRM_ONLY), + Column("DATA_TYPE", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("CHARACTER_MAXIMUM_LENGTH",ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("CHARACTER_OCTET_LENGTH", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("NUMERIC_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("NUMERIC_SCALE", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("CHARACTER_SET_NAME", CSName(), NULLABLE, OPEN_FRM_ONLY), + Column("COLLATION_NAME", CSName(), NULLABLE, "Collation", OPEN_FRM_ONLY), + Column("COLUMN_TYPE", Longtext(65535), NOT_NULL, "Type", OPEN_FRM_ONLY), + Column("COLUMN_KEY", Varchar(3), NOT_NULL, "Key", OPEN_FRM_ONLY), + Column("EXTRA", Varchar(30), NOT_NULL, "Extra", OPEN_FRM_ONLY), + Column("PRIVILEGES", Varchar(80), NOT_NULL, "Privileges", OPEN_FRM_ONLY), + Column("COLUMN_COMMENT", Varchar(COLUMN_COMMENT_MAXLEN), NOT_NULL, "Comment", + OPEN_FRM_ONLY), + Column("IS_GENERATED", Varchar(6), NOT_NULL, OPEN_FRM_ONLY), + Column("GENERATION_EXPRESSION", Longtext(MAX_FIELD_VARCHARLENGTH), + NULLABLE, OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO charsets_fields_info[]= { - {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset", - SKIP_OPEN_TABLE}, - {"DEFAULT_COLLATE_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "Default collation", SKIP_OPEN_TABLE}, - {"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description", - SKIP_OPEN_TABLE}, - {"MAXLEN", 3, MYSQL_TYPE_LONGLONG, 0, 0, "Maxlen", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CHARACTER_SET_NAME", CSName(), NOT_NULL, "Charset"), + Column("DEFAULT_COLLATE_NAME", CSName(), NOT_NULL, "Default collation"), + Column("DESCRIPTION", Varchar(60), NOT_NULL, "Description"), + Column("MAXLEN", SLonglong(3), NOT_NULL, "Maxlen"), + CEnd() }; ST_FIELD_INFO collation_fields_info[]= { - {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Collation", - SKIP_OPEN_TABLE}, - {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset", - SKIP_OPEN_TABLE}, - {"ID", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Id", - SKIP_OPEN_TABLE}, - {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, 0, "Default", SKIP_OPEN_TABLE}, - {"IS_COMPILED", 3, MYSQL_TYPE_STRING, 0, 0, "Compiled", SKIP_OPEN_TABLE}, - {"SORTLEN", 3, MYSQL_TYPE_LONGLONG, 0, 0, "Sortlen", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("COLLATION_NAME", CSName(), NOT_NULL, "Collation"), + Column("CHARACTER_SET_NAME", CSName(), NOT_NULL, "Charset"), + Column("ID", SLonglong(MY_INT32_NUM_DECIMAL_DIGITS), NOT_NULL, "Id"), + Column("IS_DEFAULT", Yesno(), NOT_NULL, "Default"), + Column("IS_COMPILED", Yesno(), NOT_NULL, "Compiled"), + Column("SORTLEN", SLonglong(3), NOT_NULL, "Sortlen"), + CEnd() }; ST_FIELD_INFO applicable_roles_fields_info[]= { - {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROLE_NAME", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("GRANTEE", Userhost(), NOT_NULL), + Column("ROLE_NAME", Varchar(USERNAME_CHAR_LENGTH), NOT_NULL), + Column("IS_GRANTABLE", Yesno(), NOT_NULL), + Column("IS_DEFAULT", Yesno(), NULLABLE), + CEnd() }; ST_FIELD_INFO enabled_roles_fields_info[]= { - {"ROLE_NAME", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("ROLE_NAME", Varchar(USERNAME_CHAR_LENGTH), NULLABLE), + CEnd() }; ST_FIELD_INFO engines_fields_info[]= { - {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE}, - {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE}, - {"COMMENT", 160, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE}, - {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE}, - {"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE}, - {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("ENGINE", Varchar(64), NOT_NULL, "Engine"), + Column("SUPPORT", Varchar(8), NOT_NULL, "Support"), + Column("COMMENT", Varchar(160), NOT_NULL, "Comment"), + Column("TRANSACTIONS", Varchar(3), NULLABLE, "Transactions"), + Column("XA", Varchar(3), NULLABLE, "XA"), + Column("SAVEPOINTS", Varchar(3), NULLABLE, "Savepoints"), + CEnd() }; ST_FIELD_INFO events_fields_info[]= { - {"EVENT_CATALOG", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"EVENT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Db", - SKIP_OPEN_TABLE}, - {"EVENT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", - SKIP_OPEN_TABLE}, - {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE}, - {"TIME_ZONE", 64, MYSQL_TYPE_STRING, 0, 0, "Time zone", SKIP_OPEN_TABLE}, - {"EVENT_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"EVENT_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE}, - {"EXECUTE_AT", 0, MYSQL_TYPE_DATETIME, 0, 1, "Execute at", SKIP_OPEN_TABLE}, - {"INTERVAL_VALUE", 256, MYSQL_TYPE_STRING, 0, 1, "Interval value", - SKIP_OPEN_TABLE}, - {"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field", - SKIP_OPEN_TABLE}, - {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"STARTS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Starts", SKIP_OPEN_TABLE}, - {"ENDS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Ends", SKIP_OPEN_TABLE}, - {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE}, - {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0, SKIP_OPEN_TABLE}, - {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0, SKIP_OPEN_TABLE}, - {"LAST_EXECUTED", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE}, - {"EVENT_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ORIGINATOR", 10, MYSQL_TYPE_LONGLONG, 0, 0, "Originator", SKIP_OPEN_TABLE}, - {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "character_set_client", SKIP_OPEN_TABLE}, - {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "collation_connection", SKIP_OPEN_TABLE}, - {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "Database Collation", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + // QQ: shouldn't EVENT_CATALOG be Catalog() like in all other places? + Column("EVENT_CATALOG", Name(), NOT_NULL), + Column("EVENT_SCHEMA", Name(), NOT_NULL, "Db"), + Column("EVENT_NAME", Name(), NOT_NULL, "Name"), + Column("DEFINER", Definer(), NOT_NULL, "Definer"), + Column("TIME_ZONE", Varchar(64), NOT_NULL, "Time zone"), + Column("EVENT_BODY", Varchar(8), NOT_NULL), + Column("EVENT_DEFINITION", Longtext(65535), NOT_NULL), + Column("EVENT_TYPE", Varchar(9), NOT_NULL, "Type"), + Column("EXECUTE_AT", Datetime(0), NULLABLE, "Execute at"), + Column("INTERVAL_VALUE", Varchar(256),NULLABLE, "Interval value"), + Column("INTERVAL_FIELD", Varchar(18), NULLABLE, "Interval field"), + Column("SQL_MODE", SQLMode(), NOT_NULL), + Column("STARTS", Datetime(0), NULLABLE, "Starts"), + Column("ENDS", Datetime(0), NULLABLE, "Ends"), + Column("STATUS", Varchar(18), NOT_NULL, "Status"), + Column("ON_COMPLETION", Varchar(12), NOT_NULL), + Column("CREATED", Datetime(0), NOT_NULL), + Column("LAST_ALTERED", Datetime(0), NOT_NULL), + Column("LAST_EXECUTED", Datetime(0), NULLABLE), + Column("EVENT_COMMENT", Name(), NOT_NULL), + Column("ORIGINATOR", SLonglong(10),NOT_NULL,"Originator"), + Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client"), + Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection"), + Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation"), + CEnd() }; ST_FIELD_INFO coll_charset_app_fields_info[]= { - {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("COLLATION_NAME", CSName(), NOT_NULL), + Column("CHARACTER_SET_NAME", CSName(), NOT_NULL), + CEnd() }; ST_FIELD_INFO proc_fields_info[]= { - {"SPECIFIC_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Db", - SKIP_OPEN_TABLE}, - {"ROUTINE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", - SKIP_OPEN_TABLE}, - {"ROUTINE_TYPE", 13, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE}, - {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"DTD_IDENTIFIER", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"EXTERNAL_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"EXTERNAL_LANGUAGE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - SKIP_OPEN_TABLE}, - {"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"SQL_DATA_ACCESS", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {"SQL_PATH", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, "Security_type", - SKIP_OPEN_TABLE}, - {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Created", SKIP_OPEN_TABLE}, - {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Modified", SKIP_OPEN_TABLE}, - {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_COMMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Comment", - SKIP_OPEN_TABLE}, - {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE}, - {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "character_set_client", SKIP_OPEN_TABLE}, - {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "collation_connection", SKIP_OPEN_TABLE}, - {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "Database Collation", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("SPECIFIC_NAME", Name(), NOT_NULL), + Column("ROUTINE_CATALOG", Catalog(), NOT_NULL), + Column("ROUTINE_SCHEMA", Name(), NOT_NULL, "Db"), + Column("ROUTINE_NAME", Name(), NOT_NULL, "Name"), + Column("ROUTINE_TYPE", Varchar(13),NOT_NULL, "Type"), + Column("DATA_TYPE", Name(), NOT_NULL), + Column("CHARACTER_MAXIMUM_LENGTH",SLong(21), NULLABLE), + Column("CHARACTER_OCTET_LENGTH", SLong(21), NULLABLE), + Column("NUMERIC_PRECISION", SLong(21), NULLABLE), + Column("NUMERIC_SCALE", SLong(21), NULLABLE), + Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("CHARACTER_SET_NAME", Varchar(64),NULLABLE), + Column("COLLATION_NAME", Varchar(64),NULLABLE), + Column("DTD_IDENTIFIER", Longtext(65535), NULLABLE), + Column("ROUTINE_BODY", Varchar(8), NOT_NULL), + Column("ROUTINE_DEFINITION", Longtext(65535), NULLABLE), + Column("EXTERNAL_NAME", Name(), NULLABLE), + Column("EXTERNAL_LANGUAGE", Name(), NULLABLE), + Column("PARAMETER_STYLE", Varchar(8), NOT_NULL), + Column("IS_DETERMINISTIC", Varchar(3), NOT_NULL), + Column("SQL_DATA_ACCESS", Name(), NOT_NULL), + Column("SQL_PATH", Name(), NULLABLE), + Column("SECURITY_TYPE", Varchar(7), NOT_NULL, "Security_type"), + Column("CREATED", Datetime(0), NOT_NULL, "Created"), + Column("LAST_ALTERED", Datetime(0), NOT_NULL, "Modified"), + Column("SQL_MODE", SQLMode(), NOT_NULL), + Column("ROUTINE_COMMENT", Longtext(65535), NOT_NULL, "Comment"), + Column("DEFINER", Definer(), NOT_NULL, "Definer"), + Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client"), + Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection"), + Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation"), + CEnd() }; ST_FIELD_INFO stat_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", OPEN_FRM_ONLY}, - {"NON_UNIQUE", 1, MYSQL_TYPE_LONGLONG, 0, 0, "Non_unique", OPEN_FRM_ONLY}, - {"INDEX_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"INDEX_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Key_name", - OPEN_FRM_ONLY}, - {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY}, - {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name", - OPEN_FRM_ONLY}, - {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY}, - {"CARDINALITY", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 1, - "Cardinality", OPEN_FULL_TABLE}, - {"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY}, - {"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed", OPEN_FRM_ONLY}, - {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY}, - {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", OPEN_FULL_TABLE}, - {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY}, - {"INDEX_COMMENT", INDEX_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, - "Index_comment", OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_NAME", Name(), NOT_NULL, "Table", OPEN_FRM_ONLY), + Column("NON_UNIQUE", SLonglong(1),NOT_NULL, "Non_unique", OPEN_FRM_ONLY), + Column("INDEX_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("INDEX_NAME", Name(), NOT_NULL, "Key_name", OPEN_FRM_ONLY), + Column("SEQ_IN_INDEX", SLonglong(2),NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), + Column("COLUMN_NAME", Name(), NOT_NULL, "Column_name", OPEN_FRM_ONLY), + Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FRM_ONLY), + Column("CARDINALITY", SLonglong(), NULLABLE, "Cardinality", OPEN_FULL_TABLE), + Column("SUB_PART", SLonglong(3),NULLABLE, "Sub_part", OPEN_FRM_ONLY), + Column("PACKED", Varchar(10), NULLABLE, "Packed", OPEN_FRM_ONLY), + Column("NULLABLE", Varchar(3), NOT_NULL, "Null", OPEN_FRM_ONLY), + Column("INDEX_TYPE", Varchar(16), NOT_NULL, "Index_type", OPEN_FULL_TABLE), + Column("COMMENT", Varchar(16), NULLABLE, "Comment", OPEN_FRM_ONLY), + Column("INDEX_COMMENT", Varchar(INDEX_COMMENT_MAXLEN), + NOT_NULL, "Index_comment",OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO view_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FRM_ONLY}, - {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FRM_ONLY}, - {"ALGORITHM", 10, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("VIEW_DEFINITION", Longtext(65535), NOT_NULL, OPEN_FRM_ONLY), + Column("CHECK_OPTION", Varchar(8), NOT_NULL, OPEN_FRM_ONLY), + Column("IS_UPDATABLE", Yesno(), NOT_NULL, OPEN_FULL_TABLE), + Column("DEFINER", Definer(), NOT_NULL, OPEN_FRM_ONLY), + Column("SECURITY_TYPE", Varchar(7), NOT_NULL, OPEN_FRM_ONLY), + Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, OPEN_FRM_ONLY), + Column("COLLATION_CONNECTION", CSName(), NOT_NULL, OPEN_FRM_ONLY), + Column("ALGORITHM", Varchar(10),NOT_NULL, OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO user_privileges_fields_info[]= { - {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yesno(), NOT_NULL), + CEnd() }; ST_FIELD_INFO schema_privileges_fields_info[]= { - {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yesno(), NOT_NULL), + CEnd() }; ST_FIELD_INFO table_privileges_fields_info[]= { - {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yesno(), NOT_NULL), + CEnd() }; ST_FIELD_INFO column_privileges_fields_info[]= { - {"GRANTEE", USERNAME_WITH_HOST_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("GRANTEE", Userhost(), NOT_NULL), + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Name(), NOT_NULL), + Column("COLUMN_NAME", Name(), NOT_NULL), + Column("PRIVILEGE_TYPE", Name(), NOT_NULL), + Column("IS_GRANTABLE", Yesno(), NOT_NULL), + CEnd() }; ST_FIELD_INFO table_constraints_fields_info[]= { - {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CONSTRAINT_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_TYPE", Name(), NOT_NULL, OPEN_FULL_TABLE), + CEnd() }; ST_FIELD_INFO key_column_usage_fields_info[]= { - {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FULL_TABLE}, - {"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONGLONG, 0, 1, 0, - OPEN_FULL_TABLE}, - {"REFERENCED_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {"REFERENCED_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {"REFERENCED_COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("COLUMN_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("ORDINAL_POSITION", SLonglong(10), NOT_NULL, OPEN_FULL_TABLE), + Column("POSITION_IN_UNIQUE_CONSTRAINT", SLonglong(10), NULLABLE, OPEN_FULL_TABLE), + Column("REFERENCED_TABLE_SCHEMA", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("REFERENCED_TABLE_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("REFERENCED_COLUMN_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + CEnd() }; ST_FIELD_INFO table_names_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH, - MYSQL_TYPE_STRING, 0, 0, "Tables_in_", SKIP_OPEN_TABLE}, - {"TABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_type", - OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NOT_NULL), + Column("TABLE_NAME", Varchar(NAME_CHAR_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH), + NOT_NULL, "Tables_in_"), + Column("TABLE_TYPE", Name(), NOT_NULL, "Table_type", OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO open_tables_fields_info[]= { - {"Database", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database", - SKIP_OPEN_TABLE}, - {"Table",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", SKIP_OPEN_TABLE}, - {"In_use", 1, MYSQL_TYPE_LONGLONG, 0, 0, "In_use", SKIP_OPEN_TABLE}, - {"Name_locked", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Name_locked", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("Database", Name(), NOT_NULL, "Database"), + Column("Table", Name(), NOT_NULL, "Table"), + Column("In_use", SLonglong(1), NOT_NULL, "In_use"), + Column("Name_locked", SLonglong(4), NOT_NULL, "Name_locked"), + CEnd() }; ST_FIELD_INFO triggers_fields_info[]= { - {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TRIGGER_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"TRIGGER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Trigger", - OPEN_FRM_ONLY}, - {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event", OPEN_FRM_ONLY}, - {"EVENT_OBJECT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FRM_ONLY}, - {"EVENT_OBJECT_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FRM_ONLY}, - {"EVENT_OBJECT_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", - OPEN_FRM_ONLY}, - {"ACTION_ORDER", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FRM_ONLY}, - {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY}, - {"ACTION_STATEMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Statement", - OPEN_FRM_ONLY}, - {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing", OPEN_FRM_ONLY}, - {"ACTION_REFERENCE_OLD_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FRM_ONLY}, - {"ACTION_REFERENCE_NEW_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FRM_ONLY}, - {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, + Column("TRIGGER_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("TRIGGER_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("TRIGGER_NAME", Name(), NOT_NULL, "Trigger", OPEN_FRM_ONLY), + Column("EVENT_MANIPULATION", Varchar(6), NOT_NULL, "Event", OPEN_FRM_ONLY), + Column("EVENT_OBJECT_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("EVENT_OBJECT_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("EVENT_OBJECT_TABLE", Name(), NOT_NULL, "Table", OPEN_FRM_ONLY), + Column("ACTION_ORDER", SLonglong(4), NOT_NULL, OPEN_FRM_ONLY), + Column("ACTION_CONDITION", Longtext(65535), NULLABLE, OPEN_FRM_ONLY), + Column("ACTION_STATEMENT", Longtext(65535), NOT_NULL, "Statement",OPEN_FRM_ONLY), + Column("ACTION_ORIENTATION", Varchar(9), NOT_NULL, OPEN_FRM_ONLY), + Column("ACTION_TIMING", Varchar(6), NOT_NULL, "Timing", OPEN_FRM_ONLY), + Column("ACTION_REFERENCE_OLD_TABLE",Name(), NULLABLE, OPEN_FRM_ONLY), + Column("ACTION_REFERENCE_NEW_TABLE",Name(), NULLABLE, OPEN_FRM_ONLY), + Column("ACTION_REFERENCE_OLD_ROW",Varchar(3),NOT_NULL, OPEN_FRM_ONLY), + Column("ACTION_REFERENCE_NEW_ROW",Varchar(3),NOT_NULL, OPEN_FRM_ONLY), /* 2 here indicates 2 decimals */ - {"CREATED", 2, MYSQL_TYPE_DATETIME, 0, 1, "Created", OPEN_FRM_ONLY}, - {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FRM_ONLY}, - {"DEFINER", DEFINER_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FRM_ONLY}, - {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "character_set_client", OPEN_FRM_ONLY}, - {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "collation_connection", OPEN_FRM_ONLY}, - {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, - "Database Collation", OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CREATED", Datetime(2), NULLABLE, "Created", OPEN_FRM_ONLY), + Column("SQL_MODE", SQLMode(), NOT_NULL, "sql_mode", OPEN_FRM_ONLY), + Column("DEFINER", Definer(), NOT_NULL, "Definer", OPEN_FRM_ONLY), + Column("CHARACTER_SET_CLIENT", CSName(), NOT_NULL, "character_set_client", + OPEN_FRM_ONLY), + Column("COLLATION_CONNECTION", CSName(), NOT_NULL, "collation_connection", + OPEN_FRM_ONLY), + Column("DATABASE_COLLATION", CSName(), NOT_NULL, "Database Collation", + OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO partitions_fields_info[]= { - {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"PARTITION_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"SUBPARTITION_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {"PARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE}, - {"SUBPARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE}, - {"PARTITION_METHOD", 18, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"SUBPARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"PARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"SUBPARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {"PARTITION_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"TABLE_ROWS", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, - OPEN_FULL_TABLE}, - {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, - OPEN_FULL_TABLE}, - {"DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, - OPEN_FULL_TABLE}, - {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE}, - {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, - OPEN_FULL_TABLE}, - {"DATA_FREE", 21 , MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, 0, - OPEN_FULL_TABLE}, - {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE}, - {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE}, - {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, OPEN_FULL_TABLE}, - {"CHECKSUM", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FULL_TABLE}, - {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("PARTITION_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("SUBPARTITION_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("PARTITION_ORDINAL_POSITION", ULonglong(), NULLABLE, OPEN_FULL_TABLE), + Column("SUBPARTITION_ORDINAL_POSITION",ULonglong(),NULLABLE, OPEN_FULL_TABLE), + Column("PARTITION_METHOD", Varchar(18), NULLABLE, OPEN_FULL_TABLE), + Column("SUBPARTITION_METHOD", Varchar(12), NULLABLE, OPEN_FULL_TABLE), + Column("PARTITION_EXPRESSION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE), + Column("SUBPARTITION_EXPRESSION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE), + Column("PARTITION_DESCRIPTION", Longtext(65535), NULLABLE, OPEN_FULL_TABLE), + Column("TABLE_ROWS", ULonglong(), NOT_NULL, OPEN_FULL_TABLE), + Column("AVG_ROW_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE), + Column("DATA_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE), + Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, OPEN_FULL_TABLE), + Column("INDEX_LENGTH", ULonglong(), NOT_NULL, OPEN_FULL_TABLE), + Column("DATA_FREE", ULonglong(), NOT_NULL, OPEN_FULL_TABLE), + Column("CREATE_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE), + Column("UPDATE_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE), + Column("CHECK_TIME", Datetime(0), NULLABLE, OPEN_FULL_TABLE), + Column("CHECKSUM", ULonglong(), NULLABLE, OPEN_FULL_TABLE), + Column("PARTITION_COMMENT", Varchar(80), NOT_NULL, OPEN_FULL_TABLE), + Column("NODEGROUP", Varchar(12), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLESPACE_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + CEnd() }; ST_FIELD_INFO variables_fields_info[]= { - {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", - SKIP_OPEN_TABLE}, - {"VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("VARIABLE_NAME", Varchar(64), NOT_NULL, "Variable_name"), + Column("VARIABLE_VALUE", Varchar(2048), NOT_NULL, "Value"), + CEnd() }; ST_FIELD_INFO sysvars_fields_info[]= { - {"VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"SESSION_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"GLOBAL_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"GLOBAL_VALUE_ORIGIN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"DEFAULT_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"VARIABLE_SCOPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"VARIABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"NUMERIC_MIN_VALUE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"NUMERIC_MAX_VALUE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"NUMERIC_BLOCK_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"ENUM_VALUE_LIST", 65535, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"READ_ONLY", 3, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"COMMAND_LINE_ARGUMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("VARIABLE_NAME", Name(), NOT_NULL), + Column("SESSION_VALUE", Varchar(2048), NULLABLE), + Column("GLOBAL_VALUE", Varchar(2048), NULLABLE), + Column("GLOBAL_VALUE_ORIGIN", Name(), NOT_NULL), + Column("DEFAULT_VALUE", Varchar(2048), NULLABLE), + Column("VARIABLE_SCOPE", Name(), NOT_NULL), + Column("VARIABLE_TYPE", Name(), NOT_NULL), + Column("VARIABLE_COMMENT", Varchar(TABLE_COMMENT_MAXLEN), NOT_NULL), + Column("NUMERIC_MIN_VALUE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE), + Column("NUMERIC_MAX_VALUE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE), + Column("NUMERIC_BLOCK_SIZE", Varchar(MY_INT64_NUM_DECIMAL_DIGITS), NULLABLE), + Column("ENUM_VALUE_LIST", Longtext(65535), NULLABLE), + Column("READ_ONLY", Yesno(), NOT_NULL), + Column("COMMAND_LINE_ARGUMENT",Name(), NULLABLE), + CEnd() }; ST_FIELD_INFO processlist_fields_info[]= { - {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE}, - {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", - SKIP_OPEN_TABLE}, - {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host", - SKIP_OPEN_TABLE}, - {"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE}, - {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE}, - {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE}, - {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE}, - {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info", - SKIP_OPEN_TABLE}, - {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL, - 0, 0, "Time_ms", SKIP_OPEN_TABLE}, - {"STAGE", 2, MYSQL_TYPE_TINY, 0, 0, "Stage", SKIP_OPEN_TABLE}, - {"MAX_STAGE", 2, MYSQL_TYPE_TINY, 0, 0, "Max_stage", SKIP_OPEN_TABLE}, - {"PROGRESS", 703, MYSQL_TYPE_DECIMAL, 0, 0, "Progress", - SKIP_OPEN_TABLE}, - {"MEMORY_USED", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Memory_used", SKIP_OPEN_TABLE}, - {"MAX_MEMORY_USED", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Max_memory_used", SKIP_OPEN_TABLE}, - {"EXAMINED_ROWS", 7, MYSQL_TYPE_LONG, 0, 0, "Examined_rows", SKIP_OPEN_TABLE}, - {"QUERY_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE}, - {"INFO_BINARY", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_BLOB, 0, 1, - "Info_binary", SKIP_OPEN_TABLE}, - {"TID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Tid", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("ID", SLonglong(4), NOT_NULL, "Id"), + Column("USER", Varchar(USERNAME_CHAR_LENGTH), NOT_NULL, "User"), + Column("HOST", Varchar(LIST_PROCESS_HOST_LEN),NOT_NULL, "Host"), + Column("DB", Name(), NULLABLE, "Db"), + Column("COMMAND", Varchar(16), NOT_NULL, "Command"), + Column("TIME", SLong(7), NOT_NULL, "Time"), + Column("STATE", Varchar(64), NULLABLE, "State"), + Column("INFO", Longtext(PROCESS_LIST_INFO_WIDTH), + NULLABLE, "Info"), + Column("TIME_MS", Decimal(100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3), + NOT_NULL, "Time_ms"), + Column("STAGE", STiny(2), NOT_NULL, "Stage"), + Column("MAX_STAGE", STiny(2), NOT_NULL, "Max_stage"), + Column("PROGRESS", Decimal(703), NOT_NULL, "Progress"), + Column("MEMORY_USED", SLonglong(7), NOT_NULL, "Memory_used"), + Column("MAX_MEMORY_USED",SLonglong(7), NOT_NULL, "Max_memory_used"), + Column("EXAMINED_ROWS", SLong(7), NOT_NULL, "Examined_rows"), + Column("QUERY_ID", SLonglong(4), NOT_NULL), + Column("INFO_BINARY",Blob(PROCESS_LIST_INFO_WIDTH),NULLABLE, "Info_binary"), + Column("TID", SLonglong(4), NOT_NULL, "Tid"), + CEnd() }; ST_FIELD_INFO plugin_fields_info[]= { - {"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", - SKIP_OPEN_TABLE}, - {"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE}, - {"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE}, - {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_LIBRARY", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Library", - SKIP_OPEN_TABLE}, - {"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_AUTHOR", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 0, "License", SKIP_OPEN_TABLE}, - {"LOAD_OPTION", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_MATURITY", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"PLUGIN_AUTH_VERSION", 80, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("PLUGIN_NAME", Name(), NOT_NULL, "Name"), + Column("PLUGIN_VERSION", Varchar(20), NOT_NULL), + Column("PLUGIN_STATUS", Varchar(16), NOT_NULL, "Status"), + Column("PLUGIN_TYPE", Varchar(80), NOT_NULL, "Type"), + Column("PLUGIN_TYPE_VERSION", Varchar(20), NOT_NULL), + Column("PLUGIN_LIBRARY", Name(), NULLABLE, "Library"), + Column("PLUGIN_LIBRARY_VERSION", Varchar(20), NULLABLE), + Column("PLUGIN_AUTHOR", Name(), NULLABLE), + Column("PLUGIN_DESCRIPTION", Longtext(65535), NULLABLE), + Column("PLUGIN_LICENSE", Varchar(80), NOT_NULL, "License"), + Column("LOAD_OPTION", Varchar(64), NOT_NULL), + Column("PLUGIN_MATURITY", Varchar(12), NOT_NULL), + Column("PLUGIN_AUTH_VERSION", Varchar(80), NULLABLE), + CEnd() }; ST_FIELD_INFO files_fields_info[]= { - {"FILE_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE}, - {"FILE_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"FILE_TYPE", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - SKIP_OPEN_TABLE}, - {"TABLE_CATALOG", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"LOGFILE_GROUP_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, - SKIP_OPEN_TABLE}, - {"LOGFILE_GROUP_NUMBER", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"FULLTEXT_KEYS", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {"DELETED_ROWS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"UPDATE_COUNT", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"FREE_EXTENTS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"TOTAL_EXTENTS", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"EXTENT_SIZE", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE}, - {"INITIAL_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE}, - {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE}, - {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE}, - {"CREATION_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE}, - {"LAST_UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE}, - {"LAST_ACCESS_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, 0, SKIP_OPEN_TABLE}, - {"RECOVER_TIME", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"TRANSACTION_COUNTER", 4, MYSQL_TYPE_LONGLONG, 0, 1, 0, SKIP_OPEN_TABLE}, - {"VERSION", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Version", SKIP_OPEN_TABLE}, - {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", SKIP_OPEN_TABLE}, - {"TABLE_ROWS", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", SKIP_OPEN_TABLE}, - {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", SKIP_OPEN_TABLE}, - {"DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", SKIP_OPEN_TABLE}, - {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", SKIP_OPEN_TABLE}, - {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", SKIP_OPEN_TABLE}, - {"DATA_FREE", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", SKIP_OPEN_TABLE}, - {"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Create_time", SKIP_OPEN_TABLE}, - {"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Update_time", SKIP_OPEN_TABLE}, - {"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Check_time", SKIP_OPEN_TABLE}, - {"CHECKSUM", 21 , MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", SKIP_OPEN_TABLE}, - {"STATUS", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"EXTRA", 255, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("FILE_ID", SLonglong(4), NOT_NULL), + Column("FILE_NAME", Varchar(FN_REFLEN),NULLABLE), + Column("FILE_TYPE", Varchar(20), NOT_NULL), + Column("TABLESPACE_NAME", Name(), NULLABLE), + Column("TABLE_CATALOG", Name(), NOT_NULL), + Column("TABLE_SCHEMA", Name(), NULLABLE), + Column("TABLE_NAME", Name(), NULLABLE), + Column("LOGFILE_GROUP_NAME", Name(), NULLABLE), + Column("LOGFILE_GROUP_NUMBER",SLonglong(4), NULLABLE), + Column("ENGINE", Name(), NOT_NULL), + Column("FULLTEXT_KEYS", Name(), NULLABLE), + Column("DELETED_ROWS", SLonglong(4), NULLABLE), + Column("UPDATE_COUNT", SLonglong(4), NULLABLE), + Column("FREE_EXTENTS", SLonglong(4), NULLABLE), + Column("TOTAL_EXTENTS", SLonglong(4), NULLABLE), + Column("EXTENT_SIZE", SLonglong(4), NOT_NULL), + Column("INITIAL_SIZE", ULonglong(), NULLABLE), + Column("MAXIMUM_SIZE", ULonglong(), NULLABLE), + Column("AUTOEXTEND_SIZE", ULonglong(), NULLABLE), + Column("CREATION_TIME", Datetime(0), NULLABLE), + Column("LAST_UPDATE_TIME", Datetime(0), NULLABLE), + Column("LAST_ACCESS_TIME", Datetime(0), NULLABLE), + Column("RECOVER_TIME", SLonglong(4), NULLABLE), + Column("TRANSACTION_COUNTER", SLonglong(4), NULLABLE), + Column("VERSION", ULonglong(), NULLABLE, "Version"), + Column("ROW_FORMAT", Varchar(10), NULLABLE, "Row_format"), + Column("TABLE_ROWS", ULonglong(), NULLABLE, "Rows"), + Column("AVG_ROW_LENGTH", ULonglong(), NULLABLE, "Avg_row_length"), + Column("DATA_LENGTH", ULonglong(), NULLABLE, "Data_length"), + Column("MAX_DATA_LENGTH", ULonglong(), NULLABLE, "Max_data_length"), + Column("INDEX_LENGTH", ULonglong(), NULLABLE, "Index_length"), + Column("DATA_FREE", ULonglong(), NULLABLE, "Data_free"), + Column("CREATE_TIME", Datetime(0), NULLABLE, "Create_time"), + Column("UPDATE_TIME", Datetime(0), NULLABLE, "Update_time"), + Column("CHECK_TIME", Datetime(0), NULLABLE, "Check_time"), + Column("CHECKSUM", ULonglong(), NULLABLE, "Checksum"), + Column("STATUS", Varchar(20), NOT_NULL), + Column("EXTRA", Varchar(255), NULLABLE), + CEnd() }; +}; // namespace Show + + void init_fill_schema_files_row(TABLE* table) { int i; - for(i=0; files_fields_info[i].field_name!=NULL; i++) + for(i=0; Show::files_fields_info[i].field_name!=NULL; i++) table->field[i]->set_null(); table->field[IS_FILES_STATUS]->set_notnull(); table->field[IS_FILES_STATUS]->store("NORMAL", 6, system_charset_info); } + +namespace Show { + ST_FIELD_INFO referential_constraints_fields_info[]= { - {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"UNIQUE_CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"UNIQUE_CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, - MY_I_S_MAYBE_NULL, 0, OPEN_FULL_TABLE}, - {"MATCH_OPTION", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"UPDATE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"DELETE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"REFERENCED_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("UNIQUE_CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("UNIQUE_CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("UNIQUE_CONSTRAINT_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("MATCH_OPTION", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("UPDATE_RULE", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("DELETE_RULE", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("REFERENCED_TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + CEnd() }; ST_FIELD_INFO parameters_fields_info[]= { - {"SPECIFIC_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"SPECIFIC_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"SPECIFIC_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE}, - {"PARAMETER_MODE", 5, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"PARAMETER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"DATA_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE}, - {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE}, - {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE}, - {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE}, - {"DATETIME_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, - 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY}, - {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE}, - {"DTD_IDENTIFIER", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE} + Column("SPECIFIC_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("SPECIFIC_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("SPECIFIC_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("ORDINAL_POSITION", SLong(21), NOT_NULL, OPEN_FULL_TABLE), + Column("PARAMETER_MODE", Varchar(5), NULLABLE, OPEN_FULL_TABLE), + Column("PARAMETER_NAME", Name(), NULLABLE, OPEN_FULL_TABLE), + Column("DATA_TYPE", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CHARACTER_MAXIMUM_LENGTH",SLong(21), NULLABLE, OPEN_FULL_TABLE), + Column("CHARACTER_OCTET_LENGTH", SLong(21), NULLABLE, OPEN_FULL_TABLE), + Column("NUMERIC_PRECISION", SLong(21), NULLABLE, OPEN_FULL_TABLE), + Column("NUMERIC_SCALE", SLong(21), NULLABLE, OPEN_FULL_TABLE), + Column("DATETIME_PRECISION", ULonglong(), NULLABLE, OPEN_FRM_ONLY), + Column("CHARACTER_SET_NAME", Varchar(64), NULLABLE, OPEN_FULL_TABLE), + Column("COLLATION_NAME", Varchar(64), NULLABLE, OPEN_FULL_TABLE), + Column("DTD_IDENTIFIER", Longtext(65535), NOT_NULL, OPEN_FULL_TABLE), + Column("ROUTINE_TYPE", Varchar(9), NOT_NULL, OPEN_FULL_TABLE), + CEnd() }; ST_FIELD_INFO tablespaces_fields_info[]= { - {"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - SKIP_OPEN_TABLE}, - {"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"TABLESPACE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, - 0, SKIP_OPEN_TABLE}, - {"LOGFILE_GROUP_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, - 0, SKIP_OPEN_TABLE}, - {"EXTENT_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE}, - {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE}, - {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE}, - {"NODEGROUP_ID", 21, MYSQL_TYPE_LONGLONG, 0, - MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE}, - {"TABLESPACE_COMMENT", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, - SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("TABLESPACE_NAME", Name(), NOT_NULL), + Column("ENGINE", Name(), NOT_NULL), + Column("TABLESPACE_TYPE", Name(), NULLABLE), + Column("LOGFILE_GROUP_NAME", Name(), NULLABLE), + Column("EXTENT_SIZE", ULonglong(), NULLABLE), + Column("AUTOEXTEND_SIZE", ULonglong(), NULLABLE), + Column("MAXIMUM_SIZE", ULonglong(), NULLABLE), + Column("NODEGROUP_ID", ULonglong(), NULLABLE), + Column("TABLESPACE_COMMENT", Varchar(2048), NULLABLE), + CEnd() }; ST_FIELD_INFO keycache_fields_info[]= { - {"KEY_CACHE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"SEGMENTS", 3, MYSQL_TYPE_LONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED) , 0, SKIP_OPEN_TABLE}, - {"SEGMENT_NUMBER", 3, MYSQL_TYPE_LONG, 0, - (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE}, - {"FULL_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE}, - {"BLOCK_SIZE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), 0, SKIP_OPEN_TABLE }, - {"USED_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_blocks_used", SKIP_OPEN_TABLE}, - {"UNUSED_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_blocks_unused", SKIP_OPEN_TABLE}, - {"DIRTY_BLOCKS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_blocks_not_flushed", SKIP_OPEN_TABLE}, - {"READ_REQUESTS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_read_requests", SKIP_OPEN_TABLE}, - {"READS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_reads", SKIP_OPEN_TABLE}, - {"WRITE_REQUESTS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_write_requests", SKIP_OPEN_TABLE}, - {"WRITES", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, - (MY_I_S_UNSIGNED), "Key_writes", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("KEY_CACHE_NAME",Varchar(NAME_LEN),NOT_NULL), + Column("SEGMENTS", ULong(3), NULLABLE), + Column("SEGMENT_NUMBER", ULong(3), NULLABLE), + Column("FULL_SIZE", ULonglong(), NOT_NULL), + Column("BLOCK_SIZE", ULonglong(), NOT_NULL), + Column("USED_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_used"), + Column("UNUSED_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_unused"), + Column("DIRTY_BLOCKS", ULonglong(), NOT_NULL, "Key_blocks_not_flushed"), + Column("READ_REQUESTS", ULonglong(), NOT_NULL, "Key_read_requests"), + Column("READS", ULonglong(), NOT_NULL, "Key_reads"), + Column("WRITE_REQUESTS", ULonglong(), NOT_NULL, "Key_write_requests"), + Column("WRITES", ULonglong(), NOT_NULL, "Key_writes"), + CEnd() }; ST_FIELD_INFO show_explain_fields_info[]= { - /* field_name, length, type, value, field_flags, old_name*/ - {"id", 3, MYSQL_TYPE_LONGLONG, 0 /*value*/, MY_I_S_MAYBE_NULL, "id", - SKIP_OPEN_TABLE}, - {"select_type", 19, MYSQL_TYPE_STRING, 0 /*value*/, 0, "select_type", - SKIP_OPEN_TABLE}, - {"table", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0 /*value*/, MY_I_S_MAYBE_NULL, - "table", SKIP_OPEN_TABLE}, - {"type", 15, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "type", SKIP_OPEN_TABLE}, - {"possible_keys", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/, - MY_I_S_MAYBE_NULL, "possible_keys", SKIP_OPEN_TABLE}, - {"key", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/, - MY_I_S_MAYBE_NULL, "key", SKIP_OPEN_TABLE}, - {"key_len", NAME_CHAR_LEN*MAX_KEY, MYSQL_TYPE_STRING, 0/*value*/, - MY_I_S_MAYBE_NULL, "key_len", SKIP_OPEN_TABLE}, - {"ref", NAME_CHAR_LEN*MAX_REF_PARTS, MYSQL_TYPE_STRING, 0/*value*/, - MY_I_S_MAYBE_NULL, "ref", SKIP_OPEN_TABLE}, - {"rows", 10, MYSQL_TYPE_LONGLONG, 0/*value*/, MY_I_S_MAYBE_NULL, "rows", - SKIP_OPEN_TABLE}, - {"Extra", 255, MYSQL_TYPE_STRING, 0/*value*/, 0 /*flags*/, "Extra", - SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("id", SLonglong(3), NULLABLE, "id"), + Column("select_type", Varchar(19), NOT_NULL, "select_type"), + Column("table", Name(), NULLABLE, "table"), + Column("type", Varchar(15), NULLABLE, "type"), + Column("possible_keys",Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "possible_keys"), + Column("key", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key"), + Column("key_len", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key_len"), + Column("ref", Varchar(NAME_CHAR_LEN*MAX_REF_PARTS),NULLABLE, "ref"), + Column("rows", SLonglong(10), NULLABLE, "rows"), + Column("Extra", Varchar(255), NOT_NULL, "Extra"), + CEnd() }; #ifdef HAVE_SPATIAL ST_FIELD_INFO geometry_columns_fields_info[]= { - {"F_TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"F_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"F_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"F_GEOMETRY_COLUMN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field", - OPEN_FRM_ONLY}, - {"G_TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"G_TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"G_TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, - {"G_GEOMETRY_COLUMN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field", - OPEN_FRM_ONLY}, - {"STORAGE_TYPE", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY}, - {"GEOMETRY_TYPE", 7, MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FRM_ONLY}, - {"COORD_DIMENSION", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY}, - {"MAX_PPR", 2, MYSQL_TYPE_TINY, 0, 0, 0, OPEN_FRM_ONLY}, - {"SRID", 5, MYSQL_TYPE_SHORT, 0, 0, 0, OPEN_FRM_ONLY}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("F_TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("F_TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("F_TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("F_GEOMETRY_COLUMN", Name(), NOT_NULL, "Field", OPEN_FRM_ONLY), + Column("G_TABLE_CATALOG", Catalog(), NOT_NULL, OPEN_FRM_ONLY), + Column("G_TABLE_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("G_TABLE_NAME", Name(), NOT_NULL, OPEN_FRM_ONLY), + Column("G_GEOMETRY_COLUMN", Name(), NOT_NULL, "Field", OPEN_FRM_ONLY), + Column("STORAGE_TYPE", STiny(2), NOT_NULL, OPEN_FRM_ONLY), + Column("GEOMETRY_TYPE", SLong(7), NOT_NULL, OPEN_FRM_ONLY), + Column("COORD_DIMENSION", STiny(2), NOT_NULL, OPEN_FRM_ONLY), + Column("MAX_PPR", STiny(2), NOT_NULL, OPEN_FRM_ONLY), + Column("SRID", SShort(5), NOT_NULL, OPEN_FRM_ONLY), + CEnd() }; ST_FIELD_INFO spatial_ref_sys_fields_info[]= { - {"SRID", 5, MYSQL_TYPE_SHORT, 0, 0, 0, SKIP_OPEN_TABLE}, - {"AUTH_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"AUTH_SRID", 5, MYSQL_TYPE_LONG, 0, 0, 0, SKIP_OPEN_TABLE}, - {"SRTEXT", 2048, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("SRID", SShort(5), NOT_NULL), + Column("AUTH_NAME", Varchar(FN_REFLEN), NOT_NULL), + Column("AUTH_SRID", SLong(5), NOT_NULL), + Column("SRTEXT", Varchar(2048), NOT_NULL), + CEnd() }; #endif /*HAVE_SPATIAL*/ ST_FIELD_INFO check_constraints_fields_info[]= { - {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE}, - {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, - OPEN_FULL_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE), + Column("CHECK_CLAUSE", Name(), NOT_NULL, OPEN_FULL_TABLE), + CEnd() }; +}; // namespace Show + + +namespace Show { + /** For creating fields of information_schema.OPTIMIZER_TRACE */ extern ST_FIELD_INFO optimizer_trace_info[]; +} //namespace Show + /* Description of ST_FIELD_INFO in table.h @@ -9717,106 +9589,106 @@ extern ST_FIELD_INFO optimizer_trace_info[]; ST_SCHEMA_TABLE schema_tables[]= { - {"ALL_PLUGINS", plugin_fields_info, 0, + {"ALL_PLUGINS", Show::plugin_fields_info, 0, fill_all_plugins, make_old_format, 0, 5, -1, 0, 0}, - {"APPLICABLE_ROLES", applicable_roles_fields_info, 0, + {"APPLICABLE_ROLES", Show::applicable_roles_fields_info, 0, fill_schema_applicable_roles, 0, 0, -1, -1, 0, 0}, - {"CHARACTER_SETS", charsets_fields_info, 0, + {"CHARACTER_SETS", Show::charsets_fields_info, 0, fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0}, - {"CHECK_CONSTRAINTS", check_constraints_fields_info, 0, + {"CHECK_CONSTRAINTS", Show::check_constraints_fields_info, 0, get_all_tables, 0, get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, - {"COLLATIONS", collation_fields_info, 0, + {"COLLATIONS", Show::collation_fields_info, 0, fill_schema_collation, make_old_format, 0, -1, -1, 0, 0}, - {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info, + {"COLLATION_CHARACTER_SET_APPLICABILITY", Show::coll_charset_app_fields_info, 0, fill_schema_coll_charset_app, 0, 0, -1, -1, 0, 0}, - {"COLUMNS", columns_fields_info, 0, + {"COLUMNS", Show::columns_fields_info, 0, get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL}, - {"COLUMN_PRIVILEGES", column_privileges_fields_info, 0, + {"COLUMN_PRIVILEGES", Show::column_privileges_fields_info, 0, fill_schema_column_privileges, 0, 0, -1, -1, 0, 0}, - {"ENABLED_ROLES", enabled_roles_fields_info, 0, + {"ENABLED_ROLES", Show::enabled_roles_fields_info, 0, fill_schema_enabled_roles, 0, 0, -1, -1, 0, 0}, - {"ENGINES", engines_fields_info, 0, + {"ENGINES", Show::engines_fields_info, 0, fill_schema_engines, make_old_format, 0, -1, -1, 0, 0}, #ifdef HAVE_EVENT_SCHEDULER - {"EVENTS", events_fields_info, 0, + {"EVENTS", Show::events_fields_info, 0, Events::fill_schema_events, make_old_format, 0, -1, -1, 0, 0}, #else - {"EVENTS", events_fields_info, 0, + {"EVENTS", Show::events_fields_info, 0, 0, make_old_format, 0, -1, -1, 0, 0}, #endif - {"EXPLAIN", show_explain_fields_info, 0, fill_show_explain, + {"EXPLAIN", Show::show_explain_fields_info, 0, fill_show_explain, make_old_format, 0, -1, -1, TRUE /*hidden*/ , 0}, - {"FILES", files_fields_info, 0, + {"FILES", Show::files_fields_info, 0, hton_fill_schema_table, 0, 0, -1, -1, 0, 0}, - {"GLOBAL_STATUS", variables_fields_info, 0, + {"GLOBAL_STATUS", Show::variables_fields_info, 0, fill_status, make_old_format, 0, 0, -1, 0, 0}, - {"GLOBAL_VARIABLES", variables_fields_info, 0, + {"GLOBAL_VARIABLES", Show::variables_fields_info, 0, fill_variables, make_old_format, 0, 0, -1, 0, 0}, - {"KEY_CACHES", keycache_fields_info, 0, + {"KEY_CACHES", Show::keycache_fields_info, 0, fill_key_cache_tables, 0, 0, -1,-1, 0, 0}, - {"KEY_COLUMN_USAGE", key_column_usage_fields_info, 0, + {"KEY_COLUMN_USAGE", Show::key_column_usage_fields_info, 0, get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, - {"OPEN_TABLES", open_tables_fields_info, 0, + {"OPEN_TABLES", Show::open_tables_fields_info, 0, fill_open_tables, make_old_format, 0, -1, -1, 1, 0}, - {"OPTIMIZER_TRACE", optimizer_trace_info, 0, + {"OPTIMIZER_TRACE", Show::optimizer_trace_info, 0, fill_optimizer_trace_info, NULL, NULL, -1, -1, false, 0}, - {"PARAMETERS", parameters_fields_info, 0, + {"PARAMETERS", Show::parameters_fields_info, 0, fill_schema_proc, 0, 0, -1, -1, 0, 0}, - {"PARTITIONS", partitions_fields_info, 0, + {"PARTITIONS", Show::partitions_fields_info, 0, get_all_tables, 0, get_schema_partitions_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, - {"PLUGINS", plugin_fields_info, 0, + {"PLUGINS", Show::plugin_fields_info, 0, fill_plugins, make_old_format, 0, -1, -1, 0, 0}, - {"PROCESSLIST", processlist_fields_info, 0, + {"PROCESSLIST", Show::processlist_fields_info, 0, fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0}, - {"PROFILING", query_profile_statistics_info, 0, + {"PROFILING", Show::query_profile_statistics_info, 0, fill_query_profile_statistics_info, make_profile_table_for_show, NULL, -1, -1, false, 0}, - {"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info, + {"REFERENTIAL_CONSTRAINTS", Show::referential_constraints_fields_info, 0, get_all_tables, 0, get_referential_constraints_record, 1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, - {"ROUTINES", proc_fields_info, 0, + {"ROUTINES", Show::proc_fields_info, 0, fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0}, - {"SCHEMATA", schema_fields_info, 0, + {"SCHEMATA", Show::schema_fields_info, 0, fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0}, - {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, 0, + {"SCHEMA_PRIVILEGES", Show::schema_privileges_fields_info, 0, fill_schema_schema_privileges, 0, 0, -1, -1, 0, 0}, - {"SESSION_STATUS", variables_fields_info, 0, + {"SESSION_STATUS", Show::variables_fields_info, 0, fill_status, make_old_format, 0, 0, -1, 0, 0}, - {"SESSION_VARIABLES", variables_fields_info, 0, + {"SESSION_VARIABLES", Show::variables_fields_info, 0, fill_variables, make_old_format, 0, 0, -1, 0, 0}, - {"STATISTICS", stat_fields_info, 0, + {"STATISTICS", Show::stat_fields_info, 0, get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0, OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE}, - {"SYSTEM_VARIABLES", sysvars_fields_info, 0, + {"SYSTEM_VARIABLES", Show::sysvars_fields_info, 0, fill_sysvars, make_old_format, 0, 0, -1, 0, 0}, - {"TABLES", tables_fields_info, 0, + {"TABLES", Show::tables_fields_info, 0, get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0, OPTIMIZE_I_S_TABLE}, - {"TABLESPACES", tablespaces_fields_info, 0, + {"TABLESPACES", Show::tablespaces_fields_info, 0, hton_fill_schema_table, 0, 0, -1, -1, 0, 0}, - {"TABLE_CONSTRAINTS", table_constraints_fields_info, 0, + {"TABLE_CONSTRAINTS", Show::table_constraints_fields_info, 0, get_all_tables, 0, get_schema_constraints_record, 3, 4, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, - {"TABLE_NAMES", table_names_fields_info, 0, + {"TABLE_NAMES", Show::table_names_fields_info, 0, get_all_tables, make_table_names_old_format, 0, 1, 2, 1, OPTIMIZE_I_S_TABLE}, - {"TABLE_PRIVILEGES", table_privileges_fields_info, 0, + {"TABLE_PRIVILEGES", Show::table_privileges_fields_info, 0, fill_schema_table_privileges, 0, 0, -1, -1, 0, 0}, - {"TRIGGERS", triggers_fields_info, 0, + {"TRIGGERS", Show::triggers_fields_info, 0, get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0, OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE}, - {"USER_PRIVILEGES", user_privileges_fields_info, 0, + {"USER_PRIVILEGES", Show::user_privileges_fields_info, 0, fill_schema_user_privileges, 0, 0, -1, -1, 0, 0}, - {"VIEWS", view_fields_info, 0, + {"VIEWS", Show::view_fields_info, 0, get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE}, #ifdef HAVE_SPATIAL - {"GEOMETRY_COLUMNS", geometry_columns_fields_info, 0, + {"GEOMETRY_COLUMNS", Show::geometry_columns_fields_info, 0, get_all_tables, make_columns_old_format, get_geometry_column_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL}, - {"SPATIAL_REF_SYS", spatial_ref_sys_fields_info, 0, + {"SPATIAL_REF_SYS", Show::spatial_ref_sys_fields_info, 0, fill_spatial_ref_sys, make_old_format, 0, -1, -1, 0, 0}, #endif /*HAVE_SPATIAL*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} diff --git a/sql/sql_show.h b/sql/sql_show.h index 39cbc35230a..bc566bffad0 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -117,9 +117,7 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name); void view_store_options(THD *thd, TABLE_LIST *table, String *buff); void init_fill_schema_files_row(TABLE* table); -bool schema_table_store_record(THD *thd, TABLE *table); void initialize_information_schema_acl(); -COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table); ST_SCHEMA_TABLE *find_schema_table(THD *thd, const LEX_CSTRING *table_name, bool *in_plugin); diff --git a/sql/table.h b/sql/table.h index de52d6d8395..ae146fa40f0 100644 --- a/sql/table.h +++ b/sql/table.h @@ -31,6 +31,7 @@ #include "thr_lock.h" /* thr_lock_type */ #include "filesort_utils.h" #include "parse_file.h" +#include "sql_i_s.h" /* Structs that defines the TABLE */ @@ -1662,86 +1663,6 @@ typedef struct st_foreign_key_info LEX_CSTRING *fk_option_name(enum_fk_option opt); bool fk_modifies_child(enum_fk_option opt); -#define MY_I_S_MAYBE_NULL 1U -#define MY_I_S_UNSIGNED 2U - - -#define SKIP_OPEN_TABLE 0U // do not open table -#define OPEN_FRM_ONLY 1U // open FRM file only -#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files - -struct ST_FIELD_INFO -{ - /** - This is used as column name. - */ - const char* field_name; - /** - For string-type columns, this is the maximum number of - characters. Otherwise, it is the 'display-length' for the column. - */ - uint field_length; - /** - This denotes data type for the column. For the most part, there seems to - be one entry in the enum for each SQL data type, although there seem to - be a number of additional entries in the enum. - */ - enum enum_field_types field_type; - int value; - /** - This is used to set column attributes. By default, columns are @c NOT - @c NULL and @c SIGNED, and you can deviate from the default - by setting the appopriate flags. You can use either one of the flags - @c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or - combine them using the bitwise or operator @c |. Both flags are - defined in table.h. - */ - uint field_flags; // Field atributes(maybe_null, signed, unsigned etc.) - const char* old_name; - /** - This should be one of @c SKIP_OPEN_TABLE, - @c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE. - */ - uint open_method; - - LEX_CSTRING get_name() const - { - return LEX_CSTRING({field_name, strlen(field_name)}); - } - LEX_CSTRING get_old_name() const - { - return LEX_CSTRING({old_name, strlen(old_name)}); - } - bool unsigned_flag() const { return field_flags & MY_I_S_UNSIGNED; } - uint fsp() const - { - DBUG_ASSERT(field_length <= TIME_SECOND_PART_DIGITS); - return field_length; - } -}; - - -struct TABLE_LIST; -typedef class Item COND; - -typedef struct st_schema_table -{ - const char *table_name; - ST_FIELD_INFO *fields_info; - /* for FLUSH table_name */ - int (*reset_table) (); - /* Fill table with data */ - int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond); - /* Handle fileds for old SHOW */ - int (*old_format) (THD *thd, struct st_schema_table *schema_table); - int (*process_table) (THD *thd, TABLE_LIST *tables, TABLE *table, - bool res, const LEX_CSTRING *db_name, - const LEX_CSTRING *table_name); - int idx_field1, idx_field2; - bool hidden; - uint i_s_requested_object; /* the object we need to open(TABLE | VIEW) */ -} ST_SCHEMA_TABLE; - class IS_table_read_plan; /* diff --git a/sql/thread_pool_info.cc b/sql/thread_pool_info.cc index 56760105668..99ac3cd148c 100644 --- a/sql/thread_pool_info.cc +++ b/sql/thread_pool_info.cc @@ -18,24 +18,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #include <my_global.h> #include <sql_class.h> -#include <table.h> +#include <sql_i_s.h> #include <mysql/plugin.h> #include <sql_show.h> #include <threadpool_generic.h> +namespace Show { + static ST_FIELD_INFO groups_fields_info[] = { - {"GROUP_ID", 6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"CONNECTIONS", 6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"THREADS", 6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"ACTIVE_THREADS",6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"STANDBY_THREADS", 6, MYSQL_TYPE_LONG, 0, 0, 0,0}, - {"QUEUE_LENGTH", 6, MYSQL_TYPE_LONG, 0,0, 0, 0}, - {"HAS_LISTENER",1,MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {"IS_STALLED",1,MYSQL_TYPE_TINY, 0, 0, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("GROUP_ID", SLong(6), NOT_NULL), + Column("CONNECTIONS", SLong(6), NOT_NULL), + Column("THREADS", SLong(6), NOT_NULL), + Column("ACTIVE_THREADS", SLong(6), NOT_NULL), + Column("STANDBY_THREADS", SLong(6), NOT_NULL), + Column("QUEUE_LENGTH", SLong(6), NOT_NULL), + Column("HAS_LISTENER", STiny(1), NOT_NULL), + Column("IS_STALLED", STiny(1), NOT_NULL), + CEnd() }; +} // namespace Show + + static int groups_fill_table(THD* thd, TABLE_LIST* tables, COND*) { if (!all_groups) @@ -74,22 +79,26 @@ static int groups_fill_table(THD* thd, TABLE_LIST* tables, COND*) static int groups_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p; - schema->fields_info = groups_fields_info; + schema->fields_info = Show::groups_fields_info; schema->fill_table = groups_fill_table; return 0; } +namespace Show { + static ST_FIELD_INFO queues_field_info[] = { - {"GROUP_ID", 6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"POSITION",6,MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"PRIORITY", 1, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"CONNECTION_ID", 19, MYSQL_TYPE_LONGLONG, MY_I_S_UNSIGNED, 0, 0, 0}, - {"QUEUEING_TIME_MICROSECONDS", 19, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0}, - {0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0} + Column("GROUP_ID", SLong(6), NOT_NULL), + Column("POSITION", SLong(6), NOT_NULL), + Column("PRIORITY", SLong(1), NOT_NULL), + Column("CONNECTION_ID", ULonglong(19), NOT_NULL), + Column("QUEUEING_TIME_MICROSECONDS", SLonglong(19), NOT_NULL), + CEnd() }; +} // namespace Show + typedef connection_queue_t::Iterator connection_queue_iterator; static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*) @@ -140,27 +149,32 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*) static int queues_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p; - schema->fields_info = queues_field_info; + schema->fields_info = Show::queues_field_info; schema->fill_table = queues_fill_table; return 0; } +namespace Show { + static ST_FIELD_INFO stats_fields_info[] = { - {"GROUP_ID", 6, MYSQL_TYPE_LONG, 0, 0, 0, 0}, - {"THREAD_CREATIONS",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {"THREAD_CREATIONS_DUE_TO_STALL",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {"WAKES",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {"WAKES_DUE_TO_STALL",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {"THROTTLES",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {"STALLS",19,MYSQL_TYPE_LONGLONG,0,0, 0, 0}, - {"POLLS_BY_LISTENER",19,MYSQL_TYPE_LONGLONG,0,0, 0, 0}, - {"POLLS_BY_WORKER",19,MYSQL_TYPE_LONGLONG,0,0, 0, 0}, - {"DEQUEUES_BY_LISTENER",19,MYSQL_TYPE_LONGLONG,0,0, 0, 0}, - {"DEQUEUES_BY_WORKER",19,MYSQL_TYPE_LONGLONG,0,0, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("GROUP_ID", SLong(6), NOT_NULL), + Column("THREAD_CREATIONS", SLonglong(19), NOT_NULL), + Column("THREAD_CREATIONS_DUE_TO_STALL", SLonglong(19), NOT_NULL), + Column("WAKES", SLonglong(19), NOT_NULL), + Column("WAKES_DUE_TO_STALL", SLonglong(19), NOT_NULL), + Column("THROTTLES", SLonglong(19), NOT_NULL), + Column("STALLS", SLonglong(19), NOT_NULL), + Column("POLLS_BY_LISTENER", SLonglong(19), NOT_NULL), + Column("POLLS_BY_WORKER", SLonglong(19), NOT_NULL), + Column("DEQUEUES_BY_LISTENER", SLonglong(19), NOT_NULL), + Column("DEQUEUES_BY_WORKER", SLonglong(19), NOT_NULL), + CEnd() }; +} // namespace Show + + static int stats_fill_table(THD* thd, TABLE_LIST* tables, COND*) { if (!all_groups) @@ -206,21 +220,24 @@ static int stats_reset_table() static int stats_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p; - schema->fields_info = stats_fields_info; + schema->fields_info = Show::stats_fields_info; schema->fill_table = stats_fill_table; schema->reset_table = stats_reset_table; return 0; } +namespace Show { static ST_FIELD_INFO waits_fields_info[] = { - {"REASON", 16, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"COUNT",19,MYSQL_TYPE_LONGLONG,0,0, 0,0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0} + Column("REASON", Varchar(16), NOT_NULL), + Column("COUNT", SLonglong(19), NOT_NULL), + CEnd() }; +} // namespace Show + /* See thd_wait_type enum for explanation*/ static const LEX_CSTRING wait_reasons[THD_WAIT_LAST] = { @@ -267,7 +284,7 @@ static int waits_reset_table() static int waits_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p; - schema->fields_info = waits_fields_info; + schema->fields_info = Show::waits_fields_info; schema->fill_table = waits_fill_table; schema->reset_table = waits_reset_table; return 0; |