summaryrefslogtreecommitdiff
path: root/sql/sql_show.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.h')
-rw-r--r--sql/sql_show.h94
1 files changed, 85 insertions, 9 deletions
diff --git a/sql/sql_show.h b/sql/sql_show.h
index c1c6388216d..dbae2a42b39 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -77,7 +77,7 @@ typedef struct system_status_var STATUS_VAR;
typedef enum { WITHOUT_DB_NAME, WITH_DB_NAME } enum_with_db_name;
int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
- HA_CREATE_INFO *create_info_arg,
+ Table_specification_st *create_info_arg,
enum_with_db_name with_db_name);
int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
@@ -86,10 +86,13 @@ bool append_identifier(THD *thd, String *packet, const char *name,
uint length);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
+bool mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
+ List<Item> *field_list, String *buffer);
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
+void mysqld_show_create_db_get_fields(THD *thd, List<Item> *field_list);
bool mysqld_show_create_db(THD *thd, LEX_STRING *db_name,
LEX_STRING *orig_db_name,
- HA_CREATE_INFO *create);
+ const DDL_options_st &options);
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
int mysqld_show_status(THD *thd);
@@ -99,7 +102,7 @@ bool mysqld_show_authors(THD *thd);
bool mysqld_show_contributors(THD *thd);
bool mysqld_show_privileges(THD *thd);
char *make_backup_log_name(char *buff, const char *name, const char* log_ext);
-void calc_sum_of_all_status(STATUS_VAR *to);
+uint calc_sum_of_all_status(STATUS_VAR *to);
void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
const LEX_STRING *definer_host);
int add_status_vars(SHOW_VAR *list);
@@ -109,22 +112,24 @@ void free_status_vars();
void reset_status_vars();
bool show_create_trigger(THD *thd, const sp_name *trg_name);
void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
-void view_store_options4(THD *thd, TABLE_LIST *table, String *buff,
- bool check_inherit);
void init_fill_schema_files_row(TABLE* table);
bool schema_table_store_record(THD *thd, TABLE *table);
void initialize_information_schema_acl();
-int del_global_index_stat(THD *thd, TABLE* tab, KEY* key_info);
-int del_global_table_stat(THD *thd, LEX_STRING *db, LEX_STRING *table);
-ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
+COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table);
+
+ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name, bool *in_plugin);
+static inline ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name)
+{ bool unused; return find_schema_table(thd, table_name, &unused); }
+
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
int make_schema_select(THD *thd, SELECT_LEX *sel,
- enum enum_schema_tables schema_table_idx);
+ ST_SCHEMA_TABLE *schema_table);
int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
bool get_schema_tables_result(JOIN *join,
enum enum_schema_table_state executed_place);
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
+TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list);
/* These functions were under INNODB_COMPATIBILITY_HOOKS */
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
@@ -154,6 +159,77 @@ public:
void call_in_target_thread();
};
+/**
+ Condition pushdown used for INFORMATION_SCHEMA / SHOW queries.
+ This structure is to implement an optimization when
+ accessing data dictionary data in the INFORMATION_SCHEMA
+ or SHOW commands.
+ When the query contain a TABLE_SCHEMA or TABLE_NAME clause,
+ narrow the search for data based on the constraints given.
+*/
+typedef struct st_lookup_field_values
+{
+ /**
+ Value of a TABLE_SCHEMA clause.
+ Note that this value length may exceed @c NAME_LEN.
+ @sa wild_db_value
+ */
+ LEX_STRING db_value;
+ /**
+ Value of a TABLE_NAME clause.
+ Note that this value length may exceed @c NAME_LEN.
+ @sa wild_table_value
+ */
+ LEX_STRING table_value;
+ /**
+ True when @c db_value is a LIKE clause,
+ false when @c db_value is an '=' clause.
+ */
+ bool wild_db_value;
+ /**
+ True when @c table_value is a LIKE clause,
+ false when @c table_value is an '=' clause.
+ */
+ bool wild_table_value;
+} LOOKUP_FIELD_VALUES;
+
+
+/*
+ INFORMATION_SCHEMA: Execution plan for get_all_tables() call
+*/
+
+class IS_table_read_plan : public Sql_alloc
+{
+public:
+ IS_table_read_plan() : no_rows(false), trivial_show_command(FALSE) {}
+
+ bool no_rows;
+ /*
+ For EXPLAIN only: For SHOW KEYS and SHOW COLUMNS, we know which
+ db_name.table_name will be read, however for some reason we don't
+ set the fields in this->lookup_field_vals.
+ In order to not have JOIN::save_explain_data() walking over uninitialized
+ data, we set trivial_show_command=true.
+ */
+ bool trivial_show_command;
+
+ LOOKUP_FIELD_VALUES lookup_field_vals;
+ Item *partial_cond;
+
+ bool has_db_lookup_value()
+ {
+ return (lookup_field_vals.db_value.length &&
+ !lookup_field_vals.wild_db_value);
+ }
+ bool has_table_lookup_value()
+ {
+ return (lookup_field_vals.table_value.length &&
+ !lookup_field_vals.wild_table_value);
+ }
+};
+
+bool optimize_schema_tables_reads(JOIN *join);
+
/* Handle the ignored database directories list for SHOW/I_S. */
bool ignore_db_dirs_init();
void ignore_db_dirs_free();