My Project
|
00001 /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00015 00016 #ifndef SQL_SHOW_H 00017 #define SQL_SHOW_H 00018 00019 #include "sql_list.h" /* List */ 00020 #include "handler.h" /* enum_schema_tables */ 00021 #include "table.h" /* enum_schema_table_state */ 00022 00023 /* Forward declarations */ 00024 class JOIN; 00025 class String; 00026 class THD; 00027 class sp_name; 00028 struct TABLE_LIST; 00029 struct st_ha_create_information; 00030 typedef class st_select_lex SELECT_LEX; 00031 typedef st_ha_create_information HA_CREATE_INFO; 00032 struct LEX; 00033 typedef struct st_mysql_show_var SHOW_VAR; 00034 typedef struct st_schema_table ST_SCHEMA_TABLE; 00035 struct TABLE; 00036 typedef struct system_status_var STATUS_VAR; 00037 00038 enum find_files_result { 00039 FIND_FILES_OK, 00040 FIND_FILES_OOM, 00041 FIND_FILES_DIR 00042 }; 00043 00044 /* Define fields' indexes for COLUMNS table of I_S tables */ 00045 #define IS_COLUMNS_TABLE_CATALOG 0 00046 #define IS_COLUMNS_TABLE_SCHEMA 1 00047 #define IS_COLUMNS_TABLE_NAME 2 00048 #define IS_COLUMNS_COLUMN_NAME 3 00049 #define IS_COLUMNS_ORDINAL_POSITION 4 00050 #define IS_COLUMNS_COLUMN_DEFAULT 5 00051 #define IS_COLUMNS_IS_NULLABLE 6 00052 #define IS_COLUMNS_DATA_TYPE 7 00053 #define IS_COLUMNS_CHARACTER_MAXIMUM_LENGTH 8 00054 #define IS_COLUMNS_CHARACTER_OCTET_LENGTH 9 00055 #define IS_COLUMNS_NUMERIC_PRECISION 10 00056 #define IS_COLUMNS_NUMERIC_SCALE 11 00057 #define IS_COLUMNS_DATETIME_PRECISION 12 00058 #define IS_COLUMNS_CHARACTER_SET_NAME 13 00059 #define IS_COLUMNS_COLLATION_NAME 14 00060 #define IS_COLUMNS_COLUMN_TYPE 15 00061 #define IS_COLUMNS_COLUMN_KEY 16 00062 #define IS_COLUMNS_EXTRA 17 00063 #define IS_COLUMNS_PRIVILEGES 18 00064 #define IS_COLUMNS_COLUMN_COMMENT 19 00065 00066 /* Define fields' indexes for ROUTINES table of I_S tables */ 00067 #define IS_ROUTINES_SPECIFIC_NAME 0 00068 #define IS_ROUTINES_ROUTINE_CATALOG 1 00069 #define IS_ROUTINES_ROUTINE_SCHEMA 2 00070 #define IS_ROUTINES_ROUTINE_NAME 3 00071 #define IS_ROUTINES_ROUTINE_TYPE 4 00072 #define IS_ROUTINES_DATA_TYPE 5 00073 #define IS_ROUTINES_CHARACTER_MAXIMUM_LENGTH 6 00074 #define IS_ROUTINES_CHARACTER_OCTET_LENGTH 7 00075 #define IS_ROUTINES_NUMERIC_PRECISION 8 00076 #define IS_ROUTINES_NUMERIC_SCALE 9 00077 #define IS_ROUTINES_DATETIME_PRECISION 10 00078 #define IS_ROUTINES_CHARACTER_SET_NAME 11 00079 #define IS_ROUTINES_COLLATION_NAME 12 00080 #define IS_ROUTINES_DTD_IDENTIFIER 13 00081 #define IS_ROUTINES_ROUTINE_BODY 14 00082 #define IS_ROUTINES_ROUTINE_DEFINITION 15 00083 #define IS_ROUTINES_EXTERNAL_NAME 16 00084 #define IS_ROUTINES_EXTERNAL_LANGUAGE 17 00085 #define IS_ROUTINES_PARAMETER_STYLE 18 00086 #define IS_ROUTINES_IS_DETERMINISTIC 19 00087 #define IS_ROUTINES_SQL_DATA_ACCESS 20 00088 #define IS_ROUTINES_SQL_PATH 21 00089 #define IS_ROUTINES_SECURITY_TYPE 22 00090 #define IS_ROUTINES_CREATED 23 00091 #define IS_ROUTINES_LAST_ALTERED 24 00092 #define IS_ROUTINES_SQL_MODE 25 00093 #define IS_ROUTINES_ROUTINE_COMMENT 26 00094 #define IS_ROUTINES_DEFINER 27 00095 #define IS_ROUTINES_CHARACTER_SET_CLIENT 28 00096 #define IS_ROUTINES_COLLATION_CONNECTION 29 00097 #define IS_ROUTINES_DATABASE_COLLATION 30 00098 00099 00100 /* Define fields' indexes for PARAMETERS table of I_S tables */ 00101 #define IS_PARAMETERS_SPECIFIC_CATALOG 0 00102 #define IS_PARAMETERS_SPECIFIC_SCHEMA 1 00103 #define IS_PARAMETERS_SPECIFIC_NAME 2 00104 #define IS_PARAMETERS_ORDINAL_POSITION 3 00105 #define IS_PARAMETERS_PARAMETER_MODE 4 00106 #define IS_PARAMETERS_PARAMETER_NAME 5 00107 #define IS_PARAMETERS_DATA_TYPE 6 00108 #define IS_PARAMETERS_CHARACTER_MAXIMUM_LENGTH 7 00109 #define IS_PARAMETERS_CHARACTER_OCTET_LENGTH 8 00110 #define IS_PARAMETERS_NUMERIC_PRECISION 9 00111 #define IS_PARAMETERS_NUMERIC_SCALE 10 00112 #define IS_PARAMETERS_DATETIME_PRECISION 11 00113 #define IS_PARAMETERS_CHARACTER_SET_NAME 12 00114 #define IS_PARAMETERS_COLLATION_NAME 13 00115 #define IS_PARAMETERS_DTD_IDENTIFIER 14 00116 #define IS_PARAMETERS_ROUTINE_TYPE 15 00117 00118 /* Used by handlers to store things in schema tables */ 00119 #define IS_FILES_FILE_ID 0 00120 #define IS_FILES_FILE_NAME 1 00121 #define IS_FILES_FILE_TYPE 2 00122 #define IS_FILES_TABLESPACE_NAME 3 00123 #define IS_FILES_TABLE_CATALOG 4 00124 #define IS_FILES_TABLE_SCHEMA 5 00125 #define IS_FILES_TABLE_NAME 6 00126 #define IS_FILES_LOGFILE_GROUP_NAME 7 00127 #define IS_FILES_LOGFILE_GROUP_NUMBER 8 00128 #define IS_FILES_ENGINE 9 00129 #define IS_FILES_FULLTEXT_KEYS 10 00130 #define IS_FILES_DELETED_ROWS 11 00131 #define IS_FILES_UPDATE_COUNT 12 00132 #define IS_FILES_FREE_EXTENTS 13 00133 #define IS_FILES_TOTAL_EXTENTS 14 00134 #define IS_FILES_EXTENT_SIZE 15 00135 #define IS_FILES_INITIAL_SIZE 16 00136 #define IS_FILES_MAXIMUM_SIZE 17 00137 #define IS_FILES_AUTOEXTEND_SIZE 18 00138 #define IS_FILES_CREATION_TIME 19 00139 #define IS_FILES_LAST_UPDATE_TIME 20 00140 #define IS_FILES_LAST_ACCESS_TIME 21 00141 #define IS_FILES_RECOVER_TIME 22 00142 #define IS_FILES_TRANSACTION_COUNTER 23 00143 #define IS_FILES_VERSION 24 00144 #define IS_FILES_ROW_FORMAT 25 00145 #define IS_FILES_TABLE_ROWS 26 00146 #define IS_FILES_AVG_ROW_LENGTH 27 00147 #define IS_FILES_DATA_LENGTH 28 00148 #define IS_FILES_MAX_DATA_LENGTH 29 00149 #define IS_FILES_INDEX_LENGTH 30 00150 #define IS_FILES_DATA_FREE 31 00151 #define IS_FILES_CREATE_TIME 32 00152 #define IS_FILES_UPDATE_TIME 33 00153 #define IS_FILES_CHECK_TIME 34 00154 #define IS_FILES_CHECKSUM 35 00155 #define IS_FILES_STATUS 36 00156 #define IS_FILES_EXTRA 37 00157 00158 find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db, 00159 const char *path, const char *wild, bool dir, 00160 MEM_ROOT *tmp_mem_root); 00161 00162 int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, 00163 HA_CREATE_INFO *create_info_arg, bool show_database); 00164 int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); 00165 00166 int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table); 00167 int get_quote_char_for_identifier(THD *thd, const char *name, uint length); 00168 00169 void append_identifier(THD *thd, String *packet, const char *name, 00170 uint length); 00171 inline void append_identifier(THD *thd, String *packet, Simple_cstring str) 00172 { 00173 append_identifier(thd, packet, str.ptr(), static_cast<uint>(str.length())); 00174 } 00175 void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); 00176 bool mysqld_show_create(THD *thd, TABLE_LIST *table_list); 00177 bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create); 00178 00179 void mysqld_list_processes(THD *thd,const char *user,bool verbose); 00180 int mysqld_show_status(THD *thd); 00181 int mysqld_show_variables(THD *thd,const char *wild); 00182 bool mysqld_show_storage_engines(THD *thd); 00183 bool mysqld_show_privileges(THD *thd); 00184 char *make_backup_log_name(char *buff, const char *name, const char* log_ext); 00185 void calc_sum_of_all_status(STATUS_VAR *to); 00186 void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user, 00187 const LEX_STRING *definer_host); 00188 int add_status_vars(SHOW_VAR *list); 00189 void remove_status_vars(SHOW_VAR *list); 00190 void init_status_vars(); 00191 void free_status_vars(); 00192 bool get_status_var(THD* thd, SHOW_VAR *list, const char *name, char * const buff); 00193 void reset_status_vars(); 00194 bool show_create_trigger(THD *thd, const sp_name *trg_name); 00195 void view_store_options(THD *thd, TABLE_LIST *table, String *buff); 00196 00197 void init_fill_schema_files_row(TABLE* table); 00198 bool schema_table_store_record(THD *thd, TABLE *table); 00199 void initialize_information_schema_acl(); 00200 00201 ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name); 00202 ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx); 00203 int make_schema_select(THD *thd, SELECT_LEX *sel, 00204 enum enum_schema_tables schema_table_idx); 00205 int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list); 00206 bool get_schema_tables_result(JOIN *join, 00207 enum enum_schema_table_state executed_place); 00208 enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table); 00209 00210 /* These functions were under INNODB_COMPATIBILITY_HOOKS */ 00211 int get_quote_char_for_identifier(THD *thd, const char *name, uint length); 00212 00213 /* Handle the ignored database directories list for SHOW/I_S. */ 00214 bool ignore_db_dirs_init(); 00215 void ignore_db_dirs_free(); 00216 void ignore_db_dirs_reset(); 00217 bool ignore_db_dirs_process_additions(); 00218 bool push_ignored_db_dir(char *path); 00219 extern char *opt_ignore_db_dirs; 00220 00221 #endif /* SQL_SHOW_H */