summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-12-07 16:22:51 +0400
committerSergey Vojtovich <svoj@sun.com>2009-12-07 16:22:51 +0400
commite8d0168475c73058fa09cd80c23eb5b64d0401cc (patch)
tree451fc8d3951634c817b1851f1706493e30050826 /sql/sql_show.cc
parente86daf9bf299b552d68cb27771b3492ee7a1c9bf (diff)
downloadmariadb-git-e8d0168475c73058fa09cd80c23eb5b64d0401cc.tar.gz
WL#2511 - Add a new table to the Information Schema for TABLESPACE's
Implemented a new INFORMATION_SCHEMA table, which is intended to provide information about tablespaces. mysql-test/r/information_schema.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/r/information_schema_db.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/r/mysqlshow.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/suite/funcs_1/r/is_columns_is.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/suite/funcs_1/r/is_tables_is.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. sql/handler.h: Added SCH_TABLESPACES to enum_schema_tables. sql/mysql_priv.h: Added human readable definitions for I_S.TABLESPACES field identifiers. sql/sql_show.cc: Added I_S.TABLESPACES schema. The code which handles I_S.FILES is capable to handle I_S.TABLESPACES as well. Thus we reuse this code and let functions/variables have more generic names.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc43
1 files changed, 34 insertions, 9 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b6bfac99dd5..bef367f63d0 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -6252,17 +6252,17 @@ bool get_schema_tables_result(JOIN *join,
DBUG_RETURN(result);
}
-struct run_hton_fill_schema_files_args
+struct run_hton_fill_schema_table_args
{
TABLE_LIST *tables;
COND *cond;
};
-static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
+static my_bool run_hton_fill_schema_table(THD *thd, plugin_ref plugin,
void *arg)
{
- struct run_hton_fill_schema_files_args *args=
- (run_hton_fill_schema_files_args *) arg;
+ struct run_hton_fill_schema_table_args *args=
+ (run_hton_fill_schema_table_args *) arg;
handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->fill_is_table && hton->state == SHOW_OPTION_YES)
hton->fill_is_table(hton, thd, args->tables, args->cond,
@@ -6270,15 +6270,15 @@ static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
return false;
}
-int fill_schema_files(THD *thd, TABLE_LIST *tables, COND *cond)
+int hton_fill_schema_table(THD *thd, TABLE_LIST *tables, COND *cond)
{
- DBUG_ENTER("fill_schema_files");
+ DBUG_ENTER("hton_fill_schema_table");
- struct run_hton_fill_schema_files_args args;
+ struct run_hton_fill_schema_table_args args;
args.tables= tables;
args.cond= cond;
- plugin_foreach(thd, run_hton_fill_schema_files,
+ plugin_foreach(thd, run_hton_fill_schema_table,
MYSQL_STORAGE_ENGINE_PLUGIN, &args);
DBUG_RETURN(0);
@@ -6860,6 +6860,29 @@ ST_FIELD_INFO referential_constraints_fields_info[]=
};
+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}
+};
+
+
/*
Description of ST_FIELD_INFO in table.h
@@ -6890,7 +6913,7 @@ ST_SCHEMA_TABLE schema_tables[]=
0, make_old_format, 0, -1, -1, 0, 0},
#endif
{"FILES", files_fields_info, create_schema_table,
- fill_schema_files, 0, 0, -1, -1, 0, 0},
+ hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
{"GLOBAL_STATUS", variables_fields_info, create_schema_table,
fill_status, make_old_format, 0, 0, -1, 0, 0},
{"GLOBAL_VARIABLES", variables_fields_info, create_schema_table,
@@ -6931,6 +6954,8 @@ ST_SCHEMA_TABLE schema_tables[]=
{"TABLES", tables_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
OPTIMIZE_I_S_TABLE},
+ {"TABLESPACES", tablespaces_fields_info, create_schema_table,
+ hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
get_all_tables, 0, get_schema_constraints_record, 3, 4, 0,
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},