MySQL 9.1.0
Source Code Documentation
sql_show.cc File Reference
#include "sql/sql_show.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <algorithm>
#include <atomic>
#include <functional>
#include <memory>
#include <new>
#include <optional>
#include <string>
#include <vector>
#include "decimal.h"
#include "dig_vec.h"
#include "field_types.h"
#include "keycache.h"
#include "m_string.h"
#include "mutex_lock.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_command.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_hostname.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "my_systime.h"
#include "my_thread_local.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/my_loglevel.h"
#include "mysql/mysql_lex_string.h"
#include "mysql/plugin.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysqld_error.h"
#include "nulls.h"
#include "scope_guard.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/dd/dd_schema.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/properties.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/column.h"
#include "sql/dd/types/foreign_key.h"
#include "sql/dd/types/foreign_key_element.h"
#include "sql/dd/types/partition.h"
#include "sql/dd/types/partition_index.h"
#include "sql/dd/types/schema.h"
#include "sql/dd/types/table.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/enum_query_type.h"
#include "sql/error_handler.h"
#include "sql/events.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/key.h"
#include "sql/log.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/mysqld_thd_manager.h"
#include "sql/opt_trace.h"
#include "sql/partition_info.h"
#include "sql/protocol.h"
#include "sql/psi_memory_key.h"
#include "sql/query_options.h"
#include "sql/query_result.h"
#include "sql/rpl_source.h"
#include "sql/set_var.h"
#include "sql/sp.h"
#include "sql/sp_head.h"
#include "sql/sp_rcontext.h"
#include "sql/sql_base.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_check_constraint.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_db.h"
#include "sql/sql_error.h"
#include "sql/sql_executor.h"
#include "sql/sql_gipk.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_parse.h"
#include "sql/sql_partition.h"
#include "sql/sql_plugin.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_profile.h"
#include "sql/sql_table.h"
#include "sql/sql_tmp_table.h"
#include "sql/sql_trigger.h"
#include "sql/strfunc.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/table_trigger_dispatcher.h"
#include "sql/temp_table_param.h"
#include "sql/thd_raii.h"
#include "sql/trigger.h"
#include "sql/tztime.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "strmake.h"
#include "template_utils.h"
#include "thr_lock.h"

Classes

class  CSET_STRING
 Character set armed LEX_CSTRING. More...
 
struct  show_privileges_st
 
class  Show_create_error_handler
 An Internal_error_handler that suppresses errors regarding views' underlying tables that occur during privilege checking within SHOW CREATE VIEW commands. More...
 
class  thread_info
 
class  thread_info_compare
 
class  List_process_list
 
class  Fill_process_list
 This class implements callback function used by fill_schema_processlist() to populate all the client process information into I_S table. More...
 
class  Show_var_cmp
 
class  Add_status
 Collect status for all running threads. More...
 
struct  schema_table_ref
 
struct  run_hton_fill_schema_table_args
 

Macros

#define TMP_TABLE_COLUMNS_COLUMN_NAME   0
 
#define TMP_TABLE_COLUMNS_COLUMN_TYPE   1
 
#define TMP_TABLE_COLUMNS_COLLATION_NAME   2
 
#define TMP_TABLE_COLUMNS_IS_NULLABLE   3
 
#define TMP_TABLE_COLUMNS_COLUMN_KEY   4
 
#define TMP_TABLE_COLUMNS_COLUMN_DEFAULT   5
 
#define TMP_TABLE_COLUMNS_EXTRA   6
 
#define TMP_TABLE_COLUMNS_PRIVILEGES   7
 
#define TMP_TABLE_COLUMNS_COLUMN_COMMENT   8
 
#define TMP_TABLE_COLUMNS_GENERATION_EXPRESSION   9
 
#define TMP_TABLE_KEYS_TABLE_NAME   0
 
#define TMP_TABLE_KEYS_IS_NON_UNIQUE   1
 
#define TMP_TABLE_KEYS_INDEX_SCHEMA   2
 
#define TMP_TABLE_KEYS_INDEX_NAME   3
 
#define TMP_TABLE_KEYS_SEQ_IN_INDEX   4
 
#define TMP_TABLE_KEYS_COLUMN_NAME   5
 
#define TMP_TABLE_KEYS_COLLATION   6
 
#define TMP_TABLE_KEYS_CARDINALITY   7
 
#define TMP_TABLE_KEYS_SUB_PART   8
 
#define TMP_TABLE_KEYS_PACKED   9
 
#define TMP_TABLE_KEYS_IS_NULLABLE   10
 
#define TMP_TABLE_KEYS_INDEX_TYPE   11
 
#define TMP_TABLE_KEYS_COMMENT   12
 
#define TMP_TABLE_KEYS_INDEX_COMMENT   13
 
#define TMP_TABLE_KEYS_IS_VISIBLE   14
 
#define TMP_TABLE_KEYS_EXPRESSION   15
 

Typedefs

typedef Mem_root_array< thread_info * > Thread_info_array
 This class implements callback function used by mysqld_list_processes() to list all the client process information. More...
 
typedef std::vector< SHOW_VARStatus_var_array
 

Functions

bool iterate_all_dynamic_privileges (THD *thd, std::function< bool(const char *)> action)
 
static void store_key_options (THD *thd, String *packet, TABLE *table, KEY *key_info)
 
static void get_cs_converted_string_value (THD *thd, String *input_str, String *output_str, const CHARSET_INFO *cs, bool use_hex)
 
static void append_algorithm (Table_ref *table, String *buff)
 Append ALGORITHM clause to the given buffer. More...
 
static void view_store_create_info (const THD *thd, Table_ref *table, String *buff)
 
static bool try_acquire_high_prio_shared_mdl_lock (THD *thd, Table_ref *table, bool can_deadlock)
 Try acquire high priority share metadata lock on a table (with optional wait for conflicting locks to go away). More...
 
static size_t make_version_string (char *buf, size_t buf_length, uint version)
 
static bool show_plugins (THD *thd, plugin_ref plugin, void *arg)
 
static int fill_plugins (THD *thd, Table_ref *tables, Item *)
 
bool mysqld_show_privileges (THD *thd)
 
bool mysqld_show_create (THD *thd, Table_ref *table_list)
 
bool mysqld_show_create_db (THD *thd, char *dbname, HA_CREATE_INFO *create_info)
 
void mysqld_list_fields (THD *thd, Table_ref *table_list, const char *wild)
 
static const char * require_quotes (const char *name, size_t name_length)
 
void append_identifier (String *packet, const char *name, size_t length)
 Convert and quote the given identifier if needed and append it to the target string. More...
 
void append_identifier (const THD *thd, String *packet, const char *name, size_t length, const CHARSET_INFO *from_cs, const CHARSET_INFO *to_cs)
 Convert and quote the given identifier if needed and append it to the target string. More...
 
int get_quote_char_for_identifier (const THD *thd, const char *name, size_t length)
 
void append_identifier (const THD *thd, String *packet, const char *name, size_t length)
 
static void append_directory (THD *thd, String *packet, const char *dir_type, const char *filename)
 
static bool print_on_update_clause (Field *field, String *val, bool lcase)
 Print "ON UPDATE" clause of a field into a string. More...
 
static bool print_default_clause (THD *thd, Field *field, String *def_value, bool quoted)
 Print "DEFAULT" clause of a field into a string. More...
 
static bool should_print_encryption_clause (THD *thd, TABLE_SHARE *share, bool *print)
 
static void print_foreign_key_info (THD *thd, const LEX_CSTRING *db, const dd::Table *table_obj, String *packet)
 Append definitions of FOREIGN KEY statements to SHOW CREATE TABLE statement output for the table. More...
 
bool store_create_info (THD *thd, Table_ref *table_list, String *packet, HA_CREATE_INFO *create_info_arg, bool show_database, bool for_show_create_stmt)
 Build a CREATE TABLE statement for a table. More...
 
void view_store_options (const THD *thd, Table_ref *table, String *buff)
 
void append_definer (const THD *thd, String *buffer, const LEX_CSTRING &definer_user, const LEX_CSTRING &definer_host)
 Append DEFINER clause to the given buffer. More...
 
static const char * thread_state_info (THD *invoking_thd, THD *inspected_thd)
 
void mysqld_list_processes (THD *thd, const char *user, bool verbose, bool has_cursor)
 List running processes (actually connected sessions). More...
 
static int fill_schema_processlist (THD *thd, Table_ref *tables, Item *)
 
Status_var_array all_status_vars (0)
 
static int show_var_cmp (const SHOW_VAR *var1, const SHOW_VAR *var2)
 
static bool is_show_undef (const SHOW_VAR &var)
 
static void shrink_var_array (Status_var_array *array)
 
bool add_status_vars (const SHOW_VAR *list)
 
void init_status_vars ()
 
void reset_status_vars ()
 
ulonglong get_status_vars_version (void)
 
void free_status_vars ()
 
static bool get_recursive_status_var_inner (THD *thd, SHOW_VAR *list, bool is_a_list, const char *name, char *const value, enum_var_type var_type, size_t *length, const CHARSET_INFO **charset)
 Search for a status variable and gets its string value. More...
 
bool get_recursive_status_var (THD *thd, const char *name, char *const value, enum_var_type var_type, size_t *length, const CHARSET_INFO **charset)
 Get the string value of a status variable. More...
 
void remove_status_vars (SHOW_VAR *list)
 
const char * get_one_variable (THD *thd, const SHOW_VAR *variable, enum_var_type value_type, SHOW_TYPE show_type, System_status_var *status_var, const CHARSET_INFO **charset, char *buff, size_t *length, bool *is_null)
 Returns the value of a system or a status variable. More...
 
const char * get_one_variable_ext (THD *running_thd, THD *target_thd, const SHOW_VAR *variable, enum_var_type value_type, SHOW_TYPE show_type, System_status_var *status_var, const CHARSET_INFO **charset, char *buff, size_t *length, bool *is_null)
 Returns the value of a system or a status variable. More...
 
void calc_sum_of_all_status (System_status_var *to)
 
bool schema_table_store_record (THD *thd, TABLE *table)
 
int schema_table_store_record2 (THD *thd, TABLE *table, bool make_ondisk)
 Store record to I_S table, convert HEAP table to InnoDB table if necessary. More...
 
bool convert_heap_table_to_ondisk (THD *thd, TABLE *table, int error)
 Convert HEAP table to InnoDB table if necessary. More...
 
bool make_table_list (THD *thd, Query_block *sel, const LEX_CSTRING &db_name, const LEX_CSTRING &table_name)
 Prepare a Table_ident and add a table_list into Query_block. More...
 
enum enum_schema_tables get_schema_table_idx (ST_SCHEMA_TABLE *schema_table)
 
static int show_temporary_tables (THD *thd, Table_ref *tables, Item *)
 Implementation of SHOW INDEX / SHOW COLUMNS for temporary tables. More...
 
static int get_schema_tmp_table_columns_record (THD *thd, Table_ref *tables, TABLE *table, bool res, LEX_CSTRING db_name, LEX_CSTRING table_name)
 
static bool iter_schema_engines (THD *thd, plugin_ref plugin, void *ptable)
 
static int fill_schema_engines (THD *thd, Table_ref *tables, Item *)
 
static int get_schema_tmp_table_keys_record (THD *thd, Table_ref *tables, TABLE *table, bool res, LEX_CSTRING, LEX_CSTRING table_name)
 
bool get_cs_converted_part_value_from_string (THD *thd, Item *item, String *input_str, String *output_str, const CHARSET_INFO *cs, bool use_hex)
 
static int fill_open_tables (THD *thd, Table_ref *tables, Item *)
 
static bool find_schema_table_in_plugin (THD *, plugin_ref plugin, void *p_table)
 
ST_SCHEMA_TABLEfind_schema_table (THD *thd, const char *table_name)
 
ST_SCHEMA_TABLEget_schema_table (enum enum_schema_tables schema_table_idx)
 
static TABLEcreate_schema_table (THD *thd, Table_ref *table_list)
 Create information_schema table using schema_table data. More...
 
static int make_old_format (THD *thd, ST_SCHEMA_TABLE *schema_table)
 
static int make_tmp_table_columns_format (THD *thd, ST_SCHEMA_TABLE *schema_table)
 
bool mysql_schema_table (THD *thd, LEX *lex, Table_ref *table_list)
 Create information_schema table. More...
 
bool make_schema_query_block (THD *thd, Query_block *sel, enum enum_schema_tables schema_table_idx)
 Generate select from information_schema table. More...
 
bool do_fill_information_schema_table (THD *thd, Table_ref *table_list, Item *condition)
 Fill INFORMATION_SCHEMA-table, leave correct Diagnostics_area state after itself. More...
 
int initialize_schema_table (st_plugin_int *plugin)
 
int finalize_schema_table (st_plugin_int *plugin)
 
static bool show_create_trigger_impl (THD *thd, Trigger *trigger)
 Output trigger information (SHOW CREATE TRIGGER) to the client. More...
 
static Table_refget_trigger_table (THD *thd, const sp_name *trg_name)
 Read the Data Dictionary to obtain base table name for the specified trigger name and construct TABE_LIST object for the base table. More...
 
static bool acquire_mdl_for_table (THD *thd, const char *db_name, const char *table_name)
 Acquire shared MDL lock for a specified database name/table name. More...
 
static Triggerfind_trigger_in_share (TABLE_SHARE *share, const LEX_STRING &name)
 Helper to look up a Trigger object in a TABLE_SHARE by trigger name. More...
 
bool show_create_trigger (THD *thd, const sp_name *trg_name)
 SHOW CREATE TRIGGER high-level implementation. More...
 
void initialize_information_schema_acl ()
 
void show_sql_type (enum_field_types type, bool is_array, uint metadata, String *str, const CHARSET_INFO *field_cs, unsigned int vector_dimensionality)
 A field's SQL type printout. More...
 

Variables

std::atomic_ulong deprecated_use_i_s_processlist_count = 0
 Count number of times information_schema.processlist has been used. More...
 
std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp = 0
 Last time information_schema.processlist was used, as usec since epoch. More...
 
static const char * grant_names []
 
TYPELIB grant_types
 
static struct show_privileges_st sys_privileges []
 
bool status_vars_inited = false
 
ulonglong status_var_array_version = 0
 
ST_SCHEMA_TABLE schema_tables []
 
ST_FIELD_INFO engines_fields_info []
 
ST_FIELD_INFO tmp_table_keys_fields_info []
 
static const int GRANTEE_MAX_CHAR_LENGTH
 Grantee is of form 'user'@'hostname', so add +1 for '@' and +4 for the single quotes. More...
 
ST_FIELD_INFO user_privileges_fields_info []
 
ST_FIELD_INFO schema_privileges_fields_info []
 
ST_FIELD_INFO table_privileges_fields_info []
 
ST_FIELD_INFO column_privileges_fields_info []
 
ST_FIELD_INFO open_tables_fields_info []
 
ST_FIELD_INFO processlist_fields_info []
 
ST_FIELD_INFO plugin_fields_info []
 
ST_FIELD_INFO tmp_table_columns_fields_info []
 
ST_FIELD_INFO optimizer_trace_info []
 For creating fields of information_schema.OPTIMIZER_TRACE. More...
 
static IS_internal_schema_access is_internal_schema_access
 

Macro Definition Documentation

◆ TMP_TABLE_COLUMNS_COLLATION_NAME

#define TMP_TABLE_COLUMNS_COLLATION_NAME   2

◆ TMP_TABLE_COLUMNS_COLUMN_COMMENT

#define TMP_TABLE_COLUMNS_COLUMN_COMMENT   8

◆ TMP_TABLE_COLUMNS_COLUMN_DEFAULT

#define TMP_TABLE_COLUMNS_COLUMN_DEFAULT   5

◆ TMP_TABLE_COLUMNS_COLUMN_KEY

#define TMP_TABLE_COLUMNS_COLUMN_KEY   4

◆ TMP_TABLE_COLUMNS_COLUMN_NAME

#define TMP_TABLE_COLUMNS_COLUMN_NAME   0

◆ TMP_TABLE_COLUMNS_COLUMN_TYPE

#define TMP_TABLE_COLUMNS_COLUMN_TYPE   1

◆ TMP_TABLE_COLUMNS_EXTRA

#define TMP_TABLE_COLUMNS_EXTRA   6

◆ TMP_TABLE_COLUMNS_GENERATION_EXPRESSION

#define TMP_TABLE_COLUMNS_GENERATION_EXPRESSION   9

◆ TMP_TABLE_COLUMNS_IS_NULLABLE

#define TMP_TABLE_COLUMNS_IS_NULLABLE   3

◆ TMP_TABLE_COLUMNS_PRIVILEGES

#define TMP_TABLE_COLUMNS_PRIVILEGES   7

◆ TMP_TABLE_KEYS_CARDINALITY

#define TMP_TABLE_KEYS_CARDINALITY   7

◆ TMP_TABLE_KEYS_COLLATION

#define TMP_TABLE_KEYS_COLLATION   6

◆ TMP_TABLE_KEYS_COLUMN_NAME

#define TMP_TABLE_KEYS_COLUMN_NAME   5

◆ TMP_TABLE_KEYS_COMMENT

#define TMP_TABLE_KEYS_COMMENT   12

◆ TMP_TABLE_KEYS_EXPRESSION

#define TMP_TABLE_KEYS_EXPRESSION   15

◆ TMP_TABLE_KEYS_INDEX_COMMENT

#define TMP_TABLE_KEYS_INDEX_COMMENT   13

◆ TMP_TABLE_KEYS_INDEX_NAME

#define TMP_TABLE_KEYS_INDEX_NAME   3

◆ TMP_TABLE_KEYS_INDEX_SCHEMA

#define TMP_TABLE_KEYS_INDEX_SCHEMA   2

◆ TMP_TABLE_KEYS_INDEX_TYPE

#define TMP_TABLE_KEYS_INDEX_TYPE   11

◆ TMP_TABLE_KEYS_IS_NON_UNIQUE

#define TMP_TABLE_KEYS_IS_NON_UNIQUE   1

◆ TMP_TABLE_KEYS_IS_NULLABLE

#define TMP_TABLE_KEYS_IS_NULLABLE   10

◆ TMP_TABLE_KEYS_IS_VISIBLE

#define TMP_TABLE_KEYS_IS_VISIBLE   14

◆ TMP_TABLE_KEYS_PACKED

#define TMP_TABLE_KEYS_PACKED   9

◆ TMP_TABLE_KEYS_SEQ_IN_INDEX

#define TMP_TABLE_KEYS_SEQ_IN_INDEX   4

◆ TMP_TABLE_KEYS_SUB_PART

#define TMP_TABLE_KEYS_SUB_PART   8

◆ TMP_TABLE_KEYS_TABLE_NAME

#define TMP_TABLE_KEYS_TABLE_NAME   0

Typedef Documentation

◆ Status_var_array

typedef std::vector<SHOW_VAR> Status_var_array

◆ Thread_info_array

This class implements callback function used by mysqld_list_processes() to list all the client process information.

Function Documentation

◆ acquire_mdl_for_table()

static bool acquire_mdl_for_table ( THD thd,
const char *  db_name,
const char *  table_name 
)
static

Acquire shared MDL lock for a specified database name/table name.

Parameters
thdThread context.
db_nameDatabase name.
table_nameTable name.
Returns
Operation status
Return values
trueError.
falseSuccess.

◆ add_status_vars()

bool add_status_vars ( const SHOW_VAR list)

◆ all_status_vars()

Status_var_array all_status_vars ( )

◆ append_algorithm()

static void append_algorithm ( Table_ref table,
String buff 
)
static

Append ALGORITHM clause to the given buffer.

Parameters
tableVIEW definition
[in,out]buffbuffer to hold ALGORITHM clause

◆ append_definer()

void append_definer ( const THD thd,
String buffer,
const LEX_CSTRING definer_user,
const LEX_CSTRING definer_host 
)

Append DEFINER clause to the given buffer.

Parameters
thdthread handle
[in,out]bufferbuffer to hold DEFINER clause
definer_useruser name part of definer
definer_hosthost name part of definer

◆ append_directory()

static void append_directory ( THD thd,
String packet,
const char *  dir_type,
const char *  filename 
)
static

◆ append_identifier() [1/3]

void append_identifier ( const THD thd,
String packet,
const char *  name,
size_t  length 
)

◆ append_identifier() [2/3]

void append_identifier ( const THD thd,
String packet,
const char *  name,
size_t  length,
const CHARSET_INFO from_cs,
const CHARSET_INFO to_cs 
)

Convert and quote the given identifier if needed and append it to the target string.

If the given identifier is empty, it will be quoted.

Parameters
thdthread handler
packettarget string
namethe identifier to be appended
lengthlength of the appending identifier
from_csCharset information about the input string
to_csCharset information about the target string

◆ append_identifier() [3/3]

void append_identifier ( String packet,
const char *  name,
size_t  length 
)

Convert and quote the given identifier if needed and append it to the target string.

If the given identifier is empty, it will be quoted. This function always use the backtick as escape char and thus rid itself of the THD dependency.

Parameters
packettarget string
namethe identifier to be appended
lengthlength of the appending identifier

◆ calc_sum_of_all_status()

void calc_sum_of_all_status ( System_status_var to)

◆ convert_heap_table_to_ondisk()

bool convert_heap_table_to_ondisk ( THD thd,
TABLE table,
int  error 
)

Convert HEAP table to InnoDB table if necessary.

Parameters
[in]thdthread handler
[in]tableInformation schema table to be converted.
[in]errorthe error code returned previously.
Returns
false on success, true on error.

◆ create_schema_table()

static TABLE * create_schema_table ( THD thd,
Table_ref table_list 
)
static

Create information_schema table using schema_table data.

Note
For MYSQL_TYPE_DECIMAL fields only, the field_length member has encoded into it two numbers, based on modulus of base-10 numbers. In the ones position is the number of decimals. Tens position is unused. In the hundreds and thousands position is a two-digit decimal number representing length. Encode this value with (decimals*100)+length , where 0<decimals<10 and 0<=length<100 .
Parameters
thdthread handler
table_listUsed to pass I_S table information(fields info, tables parameters etc) and table name.
Returns
Pointer to created table
Return values
NULLCan't create table

◆ do_fill_information_schema_table()

bool do_fill_information_schema_table ( THD thd,
Table_ref table_list,
Item condition 
)

Fill INFORMATION_SCHEMA-table, leave correct Diagnostics_area state after itself.

This function is a wrapper around ST_SCHEMA_TABLE::fill_table(), which may "partially silence" some errors. The thing is that during fill_table() many errors might be emitted. These errors stem from the nature of fill_table().

For example, SELECT ... FROM INFORMATION_SCHEMA.xxx WHERE TABLE_NAME = 'xxx' results in a number of 'Table <db name>.xxx does not exist' errors, because fill_table() tries to open the 'xxx' table in every possible database.

Those errors are cleared (the error status is cleared from Diagnostics_area) inside fill_table(), but they remain in the Diagnostics_area condition list (the list is not cleared because it may contain useful warnings).

This function is responsible for making sure that Diagnostics_area does not contain warnings corresponding to the cleared errors.

Note
: THD::no_warnings_for_error used to be set before calling fill_table(), thus those errors didn't go to Diagnostics_area. This is not the case now (THD::no_warnings_for_error was eliminated as a hack), so we need to take care of those warnings here.
Parameters
thdThread context.
table_listI_S table.
conditionCondition, which can be used to do less file manipulations (for example, WHERE TABLE_SCHEMA='test' allows to open only directory 'test', not other database directories).
Returns
Error status.
Return values
trueError.
falseSuccess.

◆ fill_open_tables()

static int fill_open_tables ( THD thd,
Table_ref tables,
Item  
)
static

◆ fill_plugins()

static int fill_plugins ( THD thd,
Table_ref tables,
Item  
)
static

◆ fill_schema_engines()

static int fill_schema_engines ( THD thd,
Table_ref tables,
Item  
)
static

◆ fill_schema_processlist()

static int fill_schema_processlist ( THD thd,
Table_ref tables,
Item  
)
static

◆ finalize_schema_table()

int finalize_schema_table ( st_plugin_int plugin)

◆ find_schema_table()

ST_SCHEMA_TABLE * find_schema_table ( THD thd,
const char *  table_name 
)

◆ find_schema_table_in_plugin()

static bool find_schema_table_in_plugin ( THD ,
plugin_ref  plugin,
void *  p_table 
)
static

◆ find_trigger_in_share()

static Trigger * find_trigger_in_share ( TABLE_SHARE share,
const LEX_STRING name 
)
static

Helper to look up a Trigger object in a TABLE_SHARE by trigger name.

Parameters
shareTABLE_SHARE in whose list of Trigger objects the lookup is to be performed.
nameName of trigger to find.
Returns
Pointer to Trigger object, or nullptr if no trigger with the provided name was found.

◆ free_status_vars()

void free_status_vars ( )

◆ get_cs_converted_part_value_from_string()

bool get_cs_converted_part_value_from_string ( THD thd,
Item item,
String input_str,
String output_str,
const CHARSET_INFO cs,
bool  use_hex 
)

◆ get_cs_converted_string_value()

static void get_cs_converted_string_value ( THD thd,
String input_str,
String output_str,
const CHARSET_INFO cs,
bool  use_hex 
)
static

◆ get_one_variable()

const char * get_one_variable ( THD thd,
const SHOW_VAR variable,
enum_var_type  value_type,
SHOW_TYPE  show_type,
System_status_var status_var,
const CHARSET_INFO **  charset,
char *  buff,
size_t *  length,
bool *  is_null 
)

Returns the value of a system or a status variable.

Parameters
thdThe handle of the current THD.
variableDetails of the variable.
value_typeVariable type.
show_typeVariable show type.
status_varStatus values or NULL if for system variable.
[out]charsetCharacter set of the value.
[in,out]buffBuffer to store the value.
[out]lengthLength of the value.
[out]is_nullIs variable value NULL or not.
Returns
Pointer to the value buffer.

◆ get_one_variable_ext()

const char * get_one_variable_ext ( THD running_thd,
THD target_thd,
const SHOW_VAR variable,
enum_var_type  value_type,
SHOW_TYPE  show_type,
System_status_var status_var,
const CHARSET_INFO **  charset,
char *  buff,
size_t *  length,
bool *  is_null 
)

Returns the value of a system or a status variable.

Parameters
running_thdThe handle of the current THD.
target_thdThe handle of the remote THD.
variableDetails of the variable.
value_typeVariable type.
show_typeVariable show type.
status_varStatus values or NULL if for system variable.
[out]charsetCharacter set of the value.
[in,out]buffBuffer to store the value.
[out]lengthLength of the value.
[out]is_nullIs variable value NULL or not. This parameter is set only for variables of string type.
Returns
Pointer to the value buffer.

◆ get_quote_char_for_identifier()

int get_quote_char_for_identifier ( const THD thd,
const char *  name,
size_t  length 
)

◆ get_recursive_status_var()

bool get_recursive_status_var ( THD thd,
const char *  name,
char *const  value,
enum_var_type  var_type,
size_t *  length,
const CHARSET_INFO **  charset 
)

Get the string value of a status variable.

A top level API

Takes the LOCK_status lock and iterates over the registered status variable array all_status_vars to evaluate the value of a named status variable by calling get_recursive_status_var_inner for each element in all_status_vars.

Get the value of given status variable

Parameters
[in]thdthread handler
[in]namename of the status variable
[in]var_typeVariable type
[in,out]valuebuffer in which value of the status variable needs to be filled in
[in,out]lengthfilled with buffer length
[out]charsetcharset of the data returned
Returns
status
Return values
falseif variable is not found in the list
trueif variable is found in the list

◆ get_recursive_status_var_inner()

static bool get_recursive_status_var_inner ( THD thd,
SHOW_VAR list,
bool  is_a_list,
const char *  name,
char *const  value,
enum_var_type  var_type,
size_t *  length,
const CHARSET_INFO **  charset 
)
static

Search for a status variable and gets its string value.

Check if the supplied SHOW_VAR contains the status variable, diving into SHOW_ARRAY arrays and evaluating SHOW_FUNC functions as needed. Can be called recursively. If a variable is found its string value is produced by calling get_one_variable.

Used in conjunction with get_recursive_status_var

Get the value of given status variable

Parameters
[in]thdthread handler
[in]listlist of SHOW_VAR objects in which function should search
[in]is_a_listtrue if it's a list array that needs to be iterated
[in]namename of the status variable
[in]var_typeVariable type
[in,out]valuebuffer in which value of the status variable needs to be filled in
[in,out]lengthfilled with buffer length
[out]charsetcharset of the data returned
Returns
status
Return values
falseif variable is not found in the list
trueif variable is found in the list

◆ get_schema_table()

ST_SCHEMA_TABLE * get_schema_table ( enum enum_schema_tables  schema_table_idx)

◆ get_schema_table_idx()

enum enum_schema_tables get_schema_table_idx ( ST_SCHEMA_TABLE schema_table)

◆ get_schema_tmp_table_columns_record()

static int get_schema_tmp_table_columns_record ( THD thd,
Table_ref tables,
TABLE table,
bool  res,
LEX_CSTRING  db_name,
LEX_CSTRING  table_name 
)
static

◆ get_schema_tmp_table_keys_record()

static int get_schema_tmp_table_keys_record ( THD thd,
Table_ref tables,
TABLE table,
bool  res,
LEX_CSTRING  ,
LEX_CSTRING  table_name 
)
static

◆ get_status_vars_version()

ulonglong get_status_vars_version ( void  )

◆ get_trigger_table()

static Table_ref * get_trigger_table ( THD thd,
const sp_name trg_name 
)
static

Read the Data Dictionary to obtain base table name for the specified trigger name and construct TABE_LIST object for the base table.

Parameters
thdThread context.
trg_nameTrigger name.
Returns
Table_ref object corresponding to the base table.

TODO: This function is a copy&paste from add_table_to_list() and sp_add_to_query_tables(). The problem is that in order to be compatible with Stored Programs (Prepared Statements), we should not touch thd->lex. The "source" functions also add created Table_ref object to the thd->lex->query_tables.

The plan to eliminate this copy&paste is to:

  • get rid of sp_add_to_query_tables() and use Lex::add_table_to_list(). Only add_table_to_list() must be used to add tables from the parser into Lex::query_tables list.
  • do not update Lex::query_tables in add_table_to_list().

◆ init_status_vars()

void init_status_vars ( )

◆ initialize_information_schema_acl()

void initialize_information_schema_acl ( )

◆ initialize_schema_table()

int initialize_schema_table ( st_plugin_int plugin)

◆ is_show_undef()

static bool is_show_undef ( const SHOW_VAR var)
inlinestatic

◆ iter_schema_engines()

static bool iter_schema_engines ( THD thd,
plugin_ref  plugin,
void *  ptable 
)
static

◆ iterate_all_dynamic_privileges()

bool iterate_all_dynamic_privileges ( THD thd,
std::function< bool(const char *)>  action 
)

◆ make_old_format()

static int make_old_format ( THD thd,
ST_SCHEMA_TABLE schema_table 
)
static

◆ make_schema_query_block()

bool make_schema_query_block ( THD thd,
Query_block sel,
enum enum_schema_tables  schema_table_idx 
)

Generate select from information_schema table.

Parameters
thdthread handler
selpointer to Query_block
schema_table_idxindex of 'schema_tables' element
Returns
true on error, false otherwise

◆ make_table_list()

bool make_table_list ( THD thd,
Query_block sel,
const LEX_CSTRING db_name,
const LEX_CSTRING table_name 
)

Prepare a Table_ident and add a table_list into Query_block.

Parameters
thdThread
selInstance of Query_block.
db_nameDatabase name.
table_nameTable name.
Returns
true on failure. false on success.

◆ make_tmp_table_columns_format()

static int make_tmp_table_columns_format ( THD thd,
ST_SCHEMA_TABLE schema_table 
)
static

◆ make_version_string()

static size_t make_version_string ( char *  buf,
size_t  buf_length,
uint  version 
)
static

◆ mysql_schema_table()

bool mysql_schema_table ( THD thd,
LEX lex,
Table_ref table_list 
)

Create information_schema table.

Parameters
thdthread handler
lexpointer to LEX
table_listpointer to table_list
Returns
true on error, false otherwise.

◆ mysqld_list_fields()

void mysqld_list_fields ( THD thd,
Table_ref table_list,
const char *  wild 
)

◆ mysqld_list_processes()

void mysqld_list_processes ( THD thd,
const char *  user,
bool  verbose,
bool  has_cursor 
)

List running processes (actually connected sessions).

Parameters
thdthread handle.
userUsername of connected client.
verboseif false, limit output to PROCESS_LIST_WIDTH characters.
has_cursorif true, called from a command object that handles terminatation of sending to client, otherwise terminate explicitly with my_eof() call.

◆ mysqld_show_create()

bool mysqld_show_create ( THD thd,
Table_ref table_list 
)

◆ mysqld_show_create_db()

bool mysqld_show_create_db ( THD thd,
char *  dbname,
HA_CREATE_INFO create_info 
)

◆ mysqld_show_privileges()

bool mysqld_show_privileges ( THD thd)

◆ print_default_clause()

static bool print_default_clause ( THD thd,
Field field,
String def_value,
bool  quoted 
)
static

Print "DEFAULT" clause of a field into a string.

Parameters
thdThe THD to create the DEFAULT clause for.
fieldThe field to generate the DEFAULT clause for.
def_valueString to write the DEFAULT clause to to.
quotedWhether to quote the default value. false for not needed (value will became its own field (with its own charset) in a table); true for quote (as part of a SHOW CREATE statement).
Returns
true if field has a DEFAULT value, false otherwise.

◆ print_foreign_key_info()

static void print_foreign_key_info ( THD thd,
const LEX_CSTRING db,
const dd::Table table_obj,
String packet 
)
static

Append definitions of FOREIGN KEY statements to SHOW CREATE TABLE statement output for the table.

Parameters
thdThread context.
dbTable's database.
table_objdd::Table describing the table.
[in,out]packetPointer to a string where CREATE TABLE statement describing the table is being constructed.

◆ print_on_update_clause()

static bool print_on_update_clause ( Field field,
String val,
bool  lcase 
)
static

Print "ON UPDATE" clause of a field into a string.

Parameters
fieldThe field to generate ON UPDATE clause for.
valString to write ON UPDATE clause to to
lcaseWhether to print in lower case.
Returns
false on success, true on error.

◆ remove_status_vars()

void remove_status_vars ( SHOW_VAR list)

◆ require_quotes()

static const char * require_quotes ( const char *  name,
size_t  name_length 
)
static

◆ reset_status_vars()

void reset_status_vars ( )

◆ schema_table_store_record()

bool schema_table_store_record ( THD thd,
TABLE table 
)

◆ schema_table_store_record2()

int schema_table_store_record2 ( THD thd,
TABLE table,
bool  make_ondisk 
)

Store record to I_S table, convert HEAP table to InnoDB table if necessary.

Parameters
[in]thdthread handler
[in]tableInformation schema table to be updated
[in]make_ondiskif true, convert heap table to on disk table. default value is true.
Returns
0 on success
error code on failure.

◆ should_print_encryption_clause()

static bool should_print_encryption_clause ( THD thd,
TABLE_SHARE share,
bool *  print 
)
static

◆ show_create_trigger()

bool show_create_trigger ( THD thd,
const sp_name trg_name 
)

SHOW CREATE TRIGGER high-level implementation.

Parameters
thdThread context.
trg_nameTrigger name.
Returns
Operation status
Return values
trueError.
falseSuccess.

◆ show_create_trigger_impl()

static bool show_create_trigger_impl ( THD thd,
Trigger trigger 
)
static

Output trigger information (SHOW CREATE TRIGGER) to the client.

Parameters
thdThread context.
triggertable trigger to dump.
Returns
Operation status
Return values
trueError.
falseSuccess.

◆ show_plugins()

static bool show_plugins ( THD thd,
plugin_ref  plugin,
void *  arg 
)
static

◆ show_sql_type()

void show_sql_type ( enum_field_types  type,
bool  is_array,
uint  metadata,
String str,
const CHARSET_INFO field_cs,
unsigned int  vector_dimensionality 
)

A field's SQL type printout.

Parameters
typethe type to print
is_arraywhether the field is a typed array
metadatafield's metadata, depending on the type could be nothing, length, or length + decimals
strString to print to
field_csfield's charset. When given [var]char length is printed in characters, otherwise - in bytes
vector_dimensionalityThe dimensionality of a vector field

◆ show_temporary_tables()

static int show_temporary_tables ( THD thd,
Table_ref tables,
Item  
)
static

Implementation of SHOW INDEX / SHOW COLUMNS for temporary tables.

Parameters
thdThread handle
tablesTable to fill with data

◆ show_var_cmp()

static int show_var_cmp ( const SHOW_VAR var1,
const SHOW_VAR var2 
)
inlinestatic

◆ shrink_var_array()

static void shrink_var_array ( Status_var_array array)
static

◆ store_create_info()

bool store_create_info ( THD thd,
Table_ref table_list,
String packet,
HA_CREATE_INFO create_info_arg,
bool  show_database,
bool  for_show_create_stmt 
)
constexpr

Build a CREATE TABLE statement for a table.

Characters shown for the command in 'show processlist'.

Parameters
thdThe thread
table_listA list containing one table to write statement for.
packetPointer to a string where statement will be written.
create_info_argPointer to create information that can be used to tailor the format of the statement. Can be NULL, in which case only SQL_MODE is considered when building the statement.
show_databaseIf true, then print the database before the table name. The database name is only printed in the event that it is different from the current database. If false, then do not print the database before the table name.
for_show_create_stmtIf true, then build CREATE TABLE statement for SHOW CREATE TABLE statement. If false, then store_create_info() is invoked to build CREATE TABLE statement while logging event to binlog.
Returns
true if error, false otherwise.

Append START TRANSACTION for CREATE SELECT on SE supporting atomic DDL. This is done only while binlogging CREATE TABLE AS SELECT.

◆ store_key_options()

static void store_key_options ( THD thd,
String packet,
TABLE table,
KEY key_info 
)
static

◆ thread_state_info()

static const char * thread_state_info ( THD invoking_thd,
THD inspected_thd 
)
static

◆ try_acquire_high_prio_shared_mdl_lock()

static bool try_acquire_high_prio_shared_mdl_lock ( THD thd,
Table_ref table,
bool  can_deadlock 
)
static

Try acquire high priority share metadata lock on a table (with optional wait for conflicting locks to go away).

Parameters
thdThread context.
tableTable list element for the table
can_deadlockIndicates that deadlocks are possible due to metadata locks, so to avoid them we should not wait in case if conflicting lock is present.
Note
This is an auxiliary function to be used in cases when we want to access table's description by looking up info in TABLE_SHARE without going through full-blown table open.
This function assumes that there are no other metadata lock requests in the current metadata locking context.
Return values
falseNo error, if lock was obtained Table_ref::mdl_request::ticket is set to non-NULL value.
trueSome error occurred (probably thread was killed).

◆ view_store_create_info()

static void view_store_create_info ( const THD thd,
Table_ref table,
String buff 
)
static

◆ view_store_options()

void view_store_options ( const THD thd,
Table_ref table,
String buff 
)

Variable Documentation

◆ column_privileges_fields_info

ST_FIELD_INFO column_privileges_fields_info[]
Initial value:
= {
{"GRANTEE", GRANTEE_MAX_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}
@ MYSQL_TYPE_STRING
Definition: field_types.h:89
#define FN_REFLEN
Definition: my_io.h:83
#define NAME_CHAR_LEN
Field/table name length.
Definition: mysql_com.h:60
static const int GRANTEE_MAX_CHAR_LENGTH
Grantee is of form 'user'@'hostname', so add +1 for '@' and +4 for the single quotes.
Definition: sql_show.cc:4988

◆ deprecated_use_i_s_processlist_count

std::atomic_ulong deprecated_use_i_s_processlist_count = 0

Count number of times information_schema.processlist has been used.

◆ deprecated_use_i_s_processlist_last_timestamp

std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp = 0

Last time information_schema.processlist was used, as usec since epoch.

◆ engines_fields_info

ST_FIELD_INFO engines_fields_info[]
Initial value:
= {
{"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", 0},
{"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", 0},
{"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", 0},
{"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", 0},
{"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", 0},
{"SAVEPOINTS", 3, MYSQL_TYPE_STRING, 0, 1, "Savepoints", 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}

◆ grant_names

const char* grant_names[]
static
Initial value:
= {
"select", "insert", "update", "delete", "create", "drop", "reload",
"shutdown", "process", "file", "grant", "references", "index", "alter"}

◆ grant_types

TYPELIB grant_types
Initial value:
= {sizeof(grant_names) / sizeof(char **), "grant_types",
grant_names, nullptr}
static const char * grant_names[]
Definition: sql_show.cc:190

◆ GRANTEE_MAX_CHAR_LENGTH

const int GRANTEE_MAX_CHAR_LENGTH
static
Initial value:
=
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:43
#define USERNAME_CHAR_LENGTH
Definition: mysql_com.h:64

Grantee is of form 'user'@'hostname', so add +1 for '@' and +4 for the single quotes.

◆ is_internal_schema_access

IS_internal_schema_access is_internal_schema_access
static

◆ open_tables_fields_info

ST_FIELD_INFO open_tables_fields_info[]
Initial value:
= {
{"Database", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database", 0},
{"Table", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", 0},
{"In_use", 1, MYSQL_TYPE_LONGLONG, 0, 0, "In_use", 0},
{"Name_locked", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Name_locked", 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:64

◆ optimizer_trace_info

ST_FIELD_INFO optimizer_trace_info[]
extern

For creating fields of information_schema.OPTIMIZER_TRACE.

◆ plugin_fields_info

ST_FIELD_INFO plugin_fields_info[]
Initial value:
= {
{"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", 0},
{"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status", 0},
{"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", 0},
{"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PLUGIN_LIBRARY", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Library", 0},
{"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, nullptr, 0},
{"PLUGIN_AUTHOR", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, nullptr, 0},
{"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, nullptr, 0},
{"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 1, "License", 0},
{"LOAD_OPTION", 64, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}

◆ processlist_fields_info

ST_FIELD_INFO processlist_fields_info[]
Initial value:
= {
{"ID", 21, MYSQL_TYPE_LONGLONG, 0, MY_I_S_UNSIGNED, "Id", 0},
{"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", 0},
{"HOST", HOST_AND_PORT_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Host", 0},
{"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", 0},
{"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", 0},
{"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", 0},
{"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", 0},
{"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info", 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}
@ MYSQL_TYPE_LONG
Definition: field_types.h:59
static constexpr int HOST_AND_PORT_LENGTH
Length of "hostname:portnumber".
Definition: my_hostname.h:55
#define MY_I_S_UNSIGNED
Definition: table.h:2531

◆ schema_privileges_fields_info

ST_FIELD_INFO schema_privileges_fields_info[]
Initial value:
= {
{"GRANTEE", GRANTEE_MAX_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}

◆ schema_tables

ST_SCHEMA_TABLE schema_tables
Initial value:
= {
{"COLUMN_PRIVILEGES", column_privileges_fields_info,
fill_schema_column_privileges, nullptr, nullptr, false},
nullptr, false},
nullptr, true},
nullptr, nullptr, false},
false},
make_old_format, nullptr, false},
false},
{"SCHEMA_PRIVILEGES", schema_privileges_fields_info,
fill_schema_schema_privileges, nullptr, nullptr, false},
{"TABLE_PRIVILEGES", table_privileges_fields_info,
fill_schema_table_privileges, nullptr, nullptr, false},
{"USER_PRIVILEGES", user_privileges_fields_info,
fill_schema_user_privileges, nullptr, nullptr, false},
{nullptr, nullptr, nullptr, nullptr, nullptr, false}}
int fill_schema_table_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5769
int fill_schema_schema_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5707
int fill_schema_column_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5834
int fill_schema_user_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5631
int fill_optimizer_trace_info(THD *thd, Table_ref *tables, Item *)
Fills information_schema.OPTIMIZER_TRACE with rows (one per trace)
Definition: opt_trace2server.cc:480
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
Definition: sql_profile.cc:127
ST_FIELD_INFO query_profile_statistics_info[]
Definition: sql_profile.cc:101
int fill_query_profile_statistics_info(THD *thd, Table_ref *tables, Item *)
Connects Information_Schema and Profiling.
Definition: sql_profile.cc:83
ST_FIELD_INFO engines_fields_info[]
Definition: sql_show.cc:4953
static int fill_open_tables(THD *thd, Table_ref *tables, Item *)
Definition: sql_show.cc:4457
ST_FIELD_INFO open_tables_fields_info[]
Definition: sql_show.cc:5025
static int make_tmp_table_columns_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
Definition: sql_show.cc:4711
static int make_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
Definition: sql_show.cc:4695
ST_FIELD_INFO plugin_fields_info[]
Definition: sql_show.cc:5043
static int fill_schema_processlist(THD *thd, Table_ref *tables, Item *)
Definition: sql_show.cc:3233
ST_FIELD_INFO column_privileges_fields_info[]
Definition: sql_show.cc:5015
ST_FIELD_INFO tmp_table_keys_fields_info[]
Definition: sql_show.cc:4962
ST_FIELD_INFO processlist_fields_info[]
Definition: sql_show.cc:5032
static int get_schema_tmp_table_columns_record(THD *thd, Table_ref *tables, TABLE *table, bool res, LEX_CSTRING db_name, LEX_CSTRING table_name)
Definition: sql_show.cc:4013
static int show_temporary_tables(THD *thd, Table_ref *tables, Item *)
Implementation of SHOW INDEX / SHOW COLUMNS for temporary tables.
Definition: sql_show.cc:3842
static int get_schema_tmp_table_keys_record(THD *thd, Table_ref *tables, TABLE *table, bool res, LEX_CSTRING, LEX_CSTRING table_name)
Definition: sql_show.cc:4244
ST_FIELD_INFO user_privileges_fields_info[]
Definition: sql_show.cc:4991
ST_FIELD_INFO schema_privileges_fields_info[]
Definition: sql_show.cc:4998
ST_FIELD_INFO table_privileges_fields_info[]
Definition: sql_show.cc:5006
static int fill_plugins(THD *thd, Table_ref *tables, Item *)
Definition: sql_show.cc:893
static int fill_schema_engines(THD *thd, Table_ref *tables, Item *)
Definition: sql_show.cc:4217
ST_FIELD_INFO tmp_table_columns_fields_info[]
Definition: sql_show.cc:5057
ST_FIELD_INFO optimizer_trace_info[]
For creating fields of information_schema.OPTIMIZER_TRACE.
Definition: opt_trace2server.cc:534

◆ status_var_array_version

ulonglong status_var_array_version = 0

◆ status_vars_inited

bool status_vars_inited = false

◆ sys_privileges

struct show_privileges_st sys_privileges[]
static

◆ table_privileges_fields_info

ST_FIELD_INFO table_privileges_fields_info[]
Initial value:
= {
{"GRANTEE", GRANTEE_MAX_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}

◆ tmp_table_columns_fields_info

ST_FIELD_INFO tmp_table_columns_fields_info[]
Initial value:
= {
{"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Field", 0},
{"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", 0},
{"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation",
0},
{"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", 0},
{"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", 0},
{"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1,
"Default", 0},
{"EXTRA", 40, MYSQL_TYPE_STRING, 0, 0, "Extra", 0},
{"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", 0},
{"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Comment", 0},
{"GENERATION_EXPRESSION", GENERATED_COLUMN_EXPRESSION_MAXLEN,
MYSQL_TYPE_STRING, 0, 0, "Generation expression", 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}
constexpr int MY_CS_NAME_SIZE
Definition: m_ctype.h:46
#define COLUMN_COMMENT_MAXLEN
Definition: mysql_com.h:95
#define GENERATED_COLUMN_EXPRESSION_MAXLEN
Maximum length of the expression statement defined for generated columns.
Definition: mysql_com.h:123
constexpr const int MAX_FIELD_VARCHARLENGTH
Definition: sql_const.h:50

◆ tmp_table_keys_fields_info

ST_FIELD_INFO tmp_table_keys_fields_info[]
Initial value:
= {
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", 0},
{"NON_UNIQUE", 1, MYSQL_TYPE_LONGLONG, 0, 0, "Non_unique", 0},
{"INDEX_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"INDEX_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Key_name", 0},
{"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", 0},
{"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Column_name", 0},
{"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", 0},
"Cardinality", 0},
{"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", 0},
{"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed", 0},
{"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", 0},
{"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", 0},
{"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", 0},
{"INDEX_COMMENT", INDEX_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Index_comment", 0},
{"IS_VISIBLE", 4, MYSQL_TYPE_STRING, 0, 1, "Visible", 0},
{"EXPRESSION", MAX_FIELD_BLOBLENGTH, MYSQL_TYPE_STRING, 0, 1, "Expression",
0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}
#define MY_INT64_NUM_DECIMAL_DIGITS
Definition: my_inttypes.h:103
#define INDEX_COMMENT_MAXLEN
Definition: mysql_com.h:96
constexpr const unsigned int MAX_FIELD_BLOBLENGTH
Definition: sql_const.h:53

◆ user_privileges_fields_info

ST_FIELD_INFO user_privileges_fields_info[]
Initial value:
= {
{"GRANTEE", GRANTEE_MAX_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"PRIVILEGE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, nullptr, 0},
{nullptr, 0, MYSQL_TYPE_STRING, 0, 0, nullptr, 0}}