All pages
Powered by GitBook
1 of 1

Loading...

Information Schema plugins: SHOW and FLUSH statements

Information Schema plugins can support and statements.

SHOW

SHOW statements support is enabled automatically. A plugin only needs to specify column names for the SHOW statement in the old_name member of the field declaration structure. Columns with the old_name set to 0 will be hidden from the SHOW statement. If all columns are hidden, the SHOW statement will not work for this plugin.

Note that SHOW statement is a user-friendly shortcut; it's easier to type and should be easier to view — if the Information Schema table contains many columns, the SHOW statement is supposed to display only most important columns and fit nicely on the 80x25 terminal screen.

Consider an example, :

While the table has 8 columns, the statement will only display 4 of them:

FLUSH

To support the FLUSH statement a plugin must declare the reset_table callback. For example, in the plugin:

This page is licensed: CC BY-SA / Gnu FDL

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}
};
LOCALES plugin
QUERY_RESPONSE_TIME
MariaDB [test]> show locales;
+-----+-------+-------------------------------------+------------------------+
| Id  | Name  | Description                         | Error_Message_Language |
+-----+-------+-------------------------------------+------------------------+
|   0 | en_US | English - United States             | english                |
|   1 | en_GB | English - United Kingdom            | english                |
|   2 | ja_JP | Japanese - Japan                    | japanese               |
|   3 | sv_SE | Swedish - Sweden                    | swedish                |
...
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->fill_table= query_response_time_fill;
  i_s_query_response_time->reset_table= query_response_time_flush;
  query_response_time_init();
  return 0;
}
SHOW
FLUSH
INFORMATION_SCHEMA.LOCALES
SHOW LOCALES