summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth_gssapi/server_plugin.cc3
-rw-r--r--plugin/disks/information_schema_disks.cc25
-rw-r--r--plugin/feedback/feedback.cc11
-rwxr-xr-xplugin/handler_socket/client/hspool_test.pl4
-rwxr-xr-xplugin/handler_socket/client/hstest.pl4
-rw-r--r--plugin/handler_socket/regtest/common/hstest.pm8
-rw-r--r--plugin/locale_info/locale_info.cc28
-rw-r--r--plugin/metadata_lock_info/metadata_lock_info.cc29
-rw-r--r--plugin/qc_info/qc_info.cc59
-rw-r--r--plugin/query_response_time/plugin.cc15
-rw-r--r--plugin/type_geom/CMakeLists.txt3
-rw-r--r--plugin/type_geom/plugin.cc254
-rw-r--r--plugin/user_variables/user_variables.cc18
-rw-r--r--plugin/userstat/client_stats.cc58
-rw-r--r--plugin/userstat/index_stats.cc16
-rw-r--r--plugin/userstat/table_stats.cc18
-rw-r--r--plugin/userstat/user_stats.cc58
-rw-r--r--plugin/wsrep_info/plugin.cc43
18 files changed, 472 insertions, 182 deletions
diff --git a/plugin/auth_gssapi/server_plugin.cc b/plugin/auth_gssapi/server_plugin.cc
index bce6a812d12..4fdad2de4b8 100644
--- a/plugin/auth_gssapi/server_plugin.cc
+++ b/plugin/auth_gssapi/server_plugin.cc
@@ -90,6 +90,7 @@ static int deinitialize_plugin(void *unused)
return plugin_deinit();
}
+#ifdef PLUGIN_GSSAPI
/* system variable */
static MYSQL_SYSVAR_STR(keytab_path, srv_keytab_path,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
@@ -97,6 +98,8 @@ static MYSQL_SYSVAR_STR(keytab_path, srv_keytab_path,
NULL,
NULL,
"");
+#endif
+
static MYSQL_SYSVAR_STR(principal_name, srv_principal_name,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
"GSSAPI target name - service principal name for Kerberos authentication.",
diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc
index 9b1b6c0fe69..6715d40f20d 100644
--- a/plugin/disks/information_schema_disks.cc
+++ b/plugin/disks/information_schema_disks.cc
@@ -19,26 +19,29 @@
#include <sys/types.h>
#include <mntent.h>
#include <sql_class.h>
-#include <table.h>
+#include <sql_i_s.h>
#include <sql_acl.h> /* check_global_access() */
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,
@@ -134,7 +137,7 @@ int disks_table_init(void *ptr)
return 0;
}
-}
+} // namespace Show
extern "C"
{
@@ -147,7 +150,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 */
0x0101, /* version = 1.1 */
NULL, /* no status variables */
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 75e9a1e430e..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;
@@ -93,8 +93,9 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
{
Item_cond_or *res= NULL;
Name_resolution_context nrc;
- const char *db= tables->db.str, *table= tables->alias.str;
- LEX_CSTRING *field= &tables->table->field[0]->field_name;
+ LEX_CSTRING &db= tables->db;
+ LEX_CSTRING &table= tables->alias;
+ LEX_CSTRING &field= tables->table->field[0]->field_name;
CHARSET_INFO *cs= &my_charset_latin1;
if (!filter->str)
diff --git a/plugin/handler_socket/client/hspool_test.pl b/plugin/handler_socket/client/hspool_test.pl
index 7fe073301b1..091cb4967cb 100755
--- a/plugin/handler_socket/client/hspool_test.pl
+++ b/plugin/handler_socket/client/hspool_test.pl
@@ -31,8 +31,8 @@ my $moreflds_prefix = get_conf("moreflds_prefix", "f");
my $mysql_user = 'root';
my $mysql_password = '';
-my $dsn = "DBI:mysql:database=;host=$host;port=$mysqlport"
- . ";mysql_server_prepare=$ssps";
+my $dsn = "DBI:MariaDB:database=;host=$host;port=$mysqlport"
+ . ";mariadb_server_prepare=$ssps";
my $dbh = DBI->connect($dsn, $mysql_user, $mysql_password,
{ RaiseError => 1 });
my $hsargs = { 'host' => $host, 'port' => $hsport_rd };
diff --git a/plugin/handler_socket/client/hstest.pl b/plugin/handler_socket/client/hstest.pl
index 4d177b6cdc8..de39fcb6d6c 100755
--- a/plugin/handler_socket/client/hstest.pl
+++ b/plugin/handler_socket/client/hstest.pl
@@ -33,8 +33,8 @@ my $moreflds_prefix = get_conf("moreflds_prefix", "column0123456789_");
my $keytype = get_conf("keytype", "varchar(32)");
my $file = get_conf("file", undef);
-my $dsn = "DBI:mysql:database=;host=$host;port=$mysqlport"
- . ";mysql_server_prepare=$ssps";
+my $dsn = "DBI:MariaDB:database=;host=$host;port=$mysqlport"
+ . ";mariadb_server_prepare=$ssps";
my $dbh = DBI->connect($dsn, $mysqluser, $mysqlpass, { RaiseError => 1 });
my $hsargs = { 'host' => $host, 'port' => $hsport };
my $cli = new Net::HandlerSocket($hsargs);
diff --git a/plugin/handler_socket/regtest/common/hstest.pm b/plugin/handler_socket/regtest/common/hstest.pm
index 348242b027f..89f273c9786 100644
--- a/plugin/handler_socket/regtest/common/hstest.pm
+++ b/plugin/handler_socket/regtest/common/hstest.pm
@@ -29,10 +29,10 @@ sub get_dbi_connection {
= ($conf{dbname}, $conf{host}, $conf{myport}, $conf{ssps},
$conf{user}, $conf{pass});
my $mycnf = "binary_my.cnf";
- my $dsn = "DBI:mysql:database=;host=$host;port=$myport"
- . ";mysql_server_prepare=$ssps"
- . ";mysql_read_default_group=perl"
- . ";mysql_read_default_file=../common/$mycnf";
+ my $dsn = "DBI:MariaDB:database=;host=$host;port=$myport"
+ . ";mariadb_server_prepare=$ssps"
+ . ";mariadb_read_default_group=perl"
+ . ";mariadb_read_default_file=../common/$mycnf";
my $dbh = DBI->connect($dsn, $user, $pass, { RaiseError => 1 });
return $dbh;
}
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/type_geom/CMakeLists.txt b/plugin/type_geom/CMakeLists.txt
new file mode 100644
index 00000000000..2b0c84f6fa0
--- /dev/null
+++ b/plugin/type_geom/CMakeLists.txt
@@ -0,0 +1,3 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
+
+MYSQL_ADD_PLUGIN(TYPE_GEOM plugin.cc MANDATORY RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/type_geom/plugin.cc b/plugin/type_geom/plugin.cc
new file mode 100644
index 00000000000..aa2f9255f17
--- /dev/null
+++ b/plugin/type_geom/plugin.cc
@@ -0,0 +1,254 @@
+/*
+ Copyright (c) 2000, 2015, 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-1301 USA */
+
+#include <my_global.h>
+#include <sql_class.h> // THD
+#include <sql_i_s.h> // ST_SCHEMA_TABLE
+#include <mysql/plugin.h>
+#include "sql_show.h" // get_all_tables()
+#include "sql_error.h" // convert_error_to_warning()
+#include "sql_type_geom.h"
+
+
+/*********** INFORMATION_SCHEMA.SPATIEL_REF_SYS *******************/
+
+namespace Show {
+
+static ST_FIELD_INFO spatial_ref_sys_fields_info[]=
+{
+ 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()
+};
+
+
+static int spatial_ref_sys_fill(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ DBUG_ENTER("fill_spatial_ref_sys");
+ TABLE *table= tables->table;
+ CHARSET_INFO *cs= system_charset_info;
+ int result= 1;
+
+ restore_record(table, s->default_values);
+
+ table->field[0]->store(-1, FALSE); /*SRID*/
+ table->field[1]->store(STRING_WITH_LEN("Not defined"), cs); /*AUTH_NAME*/
+ table->field[2]->store(-1, FALSE); /*AUTH_SRID*/
+ table->field[3]->store(STRING_WITH_LEN(
+ "LOCAL_CS[\"Spatial reference wasn't specified\","
+ "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0]," "AXIS[\"x\",EAST],"
+ "AXIS[\"y\",NORTH]]"), cs);/*SRTEXT*/
+ if (schema_table_store_record(thd, table))
+ goto exit;
+
+ table->field[0]->store(0, TRUE); /*SRID*/
+ table->field[1]->store(STRING_WITH_LEN("EPSG"), cs); /*AUTH_NAME*/
+ table->field[2]->store(404000, TRUE); /*AUTH_SRID*/
+ table->field[3]->store(STRING_WITH_LEN(
+ "LOCAL_CS[\"Wildcard 2D cartesian plane in metric unit\","
+ "LOCAL_DATUM[\"Unknown\",0]," "UNIT[\"m\",1.0],"
+ "AXIS[\"x\",EAST]," "AXIS[\"y\",NORTH],"
+ "AUTHORITY[\"EPSG\",\"404000\"]]"), cs);/*SRTEXT*/
+ if (schema_table_store_record(thd, table))
+ goto exit;
+
+ result= 0;
+
+exit:
+ DBUG_RETURN(result);
+}
+
+
+static int plugin_init_spatial_ref_sys(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+ schema->fields_info= spatial_ref_sys_fields_info;
+ schema->fill_table= spatial_ref_sys_fill;
+ return 0;
+}
+
+
+static struct st_mysql_information_schema spatial_ref_sys_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+
+} // namespace Show
+
+/*********** INFORMATION_SCHEMA.GEOMETRY_COLUMNS *******************/
+
+
+namespace Show {
+
+static ST_FIELD_INFO geometry_columns_fields_info[]=
+{
+ 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, 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, 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()
+};
+
+
+static void geometry_columns_fill_record(TABLE *table,
+ const LEX_CSTRING *db_name,
+ const LEX_CSTRING *table_name,
+ const Field_geom *field)
+{
+ static const LEX_CSTRING catalog= {STRING_WITH_LEN("def")};
+ const CHARSET_INFO *cs= system_charset_info;
+ const Type_handler_geometry *gth= field->type_handler_geom();
+ /*F_TABLE_CATALOG*/
+ table->field[0]->store(catalog, cs);
+ /*F_TABLE_SCHEMA*/
+ table->field[1]->store(db_name, cs);
+ /*F_TABLE_NAME*/
+ table->field[2]->store(table_name, cs);
+ /*G_TABLE_CATALOG*/
+ table->field[4]->store(catalog, cs);
+ /*G_TABLE_SCHEMA*/
+ table->field[5]->store(db_name, cs);
+ /*G_TABLE_NAME*/
+ table->field[6]->store(table_name, cs);
+ /*G_GEOMETRY_COLUMN*/
+ table->field[7]->store(field->field_name, cs);
+ /*STORAGE_TYPE*/
+ table->field[8]->store(1LL, true); /*Always 1 (binary implementation)*/
+ /*GEOMETRY_TYPE*/
+ table->field[9]->store((longlong) (gth->geometry_type()), true);
+ /*COORD_DIMENSION*/
+ table->field[10]->store(2LL, true);
+ /*MAX_PPR*/
+ table->field[11]->set_null();
+ /*SRID*/
+ table->field[12]->store((longlong) (field->get_srid()), true);
+}
+
+
+static int get_geometry_column_record(THD *thd, TABLE_LIST *tables,
+ TABLE *table, bool res,
+ const LEX_CSTRING *db_name,
+ const LEX_CSTRING *table_name)
+{
+ TABLE *show_table;
+ Field **ptr, *field;
+ DBUG_ENTER("get_geometry_column_record");
+
+ if (res)
+ {
+ /*
+ open_table() failed with an error.
+ Convert the error to a warning and let the caller
+ continue with the next table.
+ */
+ convert_error_to_warning(thd);
+ DBUG_RETURN(0);
+ }
+
+ // Skip INFORMATION_SCHEMA tables. They don't have geometry columns.
+ if (tables->schema_table)
+ DBUG_RETURN(0);
+
+ show_table= tables->table;
+ ptr= show_table->field;
+ show_table->use_all_columns(); // Required for default
+ restore_record(show_table, s->default_values);
+
+ for (; (field= *ptr) ; ptr++)
+ {
+ const Field_geom *fg;
+ if (field->type() == MYSQL_TYPE_GEOMETRY &&
+ (fg= dynamic_cast<const Field_geom*>(field)))
+ {
+ DEBUG_SYNC(thd, "get_schema_column");
+ /* Get default row, with all NULL fields set to NULL */
+ restore_record(table, s->default_values);
+ geometry_columns_fill_record(table, db_name, table_name, fg);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
+ }
+ }
+
+ DBUG_RETURN(0);
+}
+
+
+static int plugin_init_geometry_columns(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+ schema->fields_info= geometry_columns_fields_info;
+ schema->fill_table= get_all_tables;
+ schema->process_table= get_geometry_column_record;
+ schema->idx_field1= 1;
+ schema->idx_field2= 2;
+ schema->i_s_requested_object= OPTIMIZE_I_S_TABLE | OPEN_VIEW_FULL;
+ return 0;
+}
+
+
+static struct st_mysql_information_schema geometry_columns_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+
+} // namespace Show
+
+
+/********************* Plugin library descriptors ************************/
+
+
+maria_declare_plugin(type_geom)
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &Show::spatial_ref_sys_plugin, // pointer to type-specific plugin descriptor
+ "SPATIAL_REF_SYS", // plugin name
+ "MariaDB", // plugin author
+ "Lists all geometry columns", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ Show::plugin_init_spatial_ref_sys, // Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)*/
+},
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &Show::geometry_columns_plugin, // pointer to type-specific plugin descriptor
+ "GEOMETRY_COLUMNS", // plugin name
+ "MariaDB", // plugin author
+ "Lists all geometry columns", // the plugin description
+ PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
+ Show::plugin_init_geometry_columns,// Pointer to plugin initialization function
+ 0, // Pointer to plugin deinitialization function
+ 0x0100, // Numeric version 0xAABB means AA.BB veriosn
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)
+}
+maria_declare_plugin_end;
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;