MySQL 9.0.0
Source Code Documentation
|
#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 |
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_VAR > | Status_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_TABLE * | find_schema_table (THD *thd, const char *table_name) |
ST_SCHEMA_TABLE * | get_schema_table (enum enum_schema_tables schema_table_idx) |
static TABLE * | create_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_ref * | get_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... | |
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... | |
#define TMP_TABLE_COLUMNS_COLLATION_NAME 2 |
#define TMP_TABLE_COLUMNS_COLUMN_COMMENT 8 |
#define TMP_TABLE_COLUMNS_COLUMN_DEFAULT 5 |
#define TMP_TABLE_COLUMNS_COLUMN_KEY 4 |
#define TMP_TABLE_COLUMNS_COLUMN_NAME 0 |
#define TMP_TABLE_COLUMNS_COLUMN_TYPE 1 |
#define TMP_TABLE_COLUMNS_EXTRA 6 |
#define TMP_TABLE_COLUMNS_GENERATION_EXPRESSION 9 |
#define TMP_TABLE_COLUMNS_IS_NULLABLE 3 |
#define TMP_TABLE_COLUMNS_PRIVILEGES 7 |
#define TMP_TABLE_KEYS_CARDINALITY 7 |
#define TMP_TABLE_KEYS_COLLATION 6 |
#define TMP_TABLE_KEYS_COLUMN_NAME 5 |
#define TMP_TABLE_KEYS_COMMENT 12 |
#define TMP_TABLE_KEYS_EXPRESSION 15 |
#define TMP_TABLE_KEYS_INDEX_COMMENT 13 |
#define TMP_TABLE_KEYS_INDEX_NAME 3 |
#define TMP_TABLE_KEYS_INDEX_SCHEMA 2 |
#define TMP_TABLE_KEYS_INDEX_TYPE 11 |
#define TMP_TABLE_KEYS_IS_NON_UNIQUE 1 |
#define TMP_TABLE_KEYS_IS_NULLABLE 10 |
#define TMP_TABLE_KEYS_IS_VISIBLE 14 |
#define TMP_TABLE_KEYS_PACKED 9 |
#define TMP_TABLE_KEYS_SEQ_IN_INDEX 4 |
#define TMP_TABLE_KEYS_SUB_PART 8 |
#define TMP_TABLE_KEYS_TABLE_NAME 0 |
typedef std::vector<SHOW_VAR> Status_var_array |
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.
|
static |
Acquire shared MDL lock for a specified database name/table name.
thd | Thread context. |
db_name | Database name. |
table_name | Table name. |
true | Error. |
false | Success. |
bool add_status_vars | ( | const SHOW_VAR * | list | ) |
Status_var_array all_status_vars | ( | 0 | ) |
Append ALGORITHM clause to the given buffer.
table | VIEW definition | |
[in,out] | buff | buffer to hold ALGORITHM clause |
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.
thd | thread handle | |
[in,out] | buffer | buffer to hold DEFINER clause |
definer_user | user name part of definer | |
definer_host | host name part of definer |
|
static |
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.
thd | thread handler |
packet | target string |
name | the identifier to be appended |
length | length of the appending identifier |
from_cs | Charset information about the input string |
to_cs | Charset information about the target string |
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.
packet | target string |
name | the identifier to be appended |
length | length of the appending identifier |
void calc_sum_of_all_status | ( | System_status_var * | to | ) |
Convert HEAP table to InnoDB table if necessary.
[in] | thd | thread handler |
[in] | table | Information schema table to be converted. |
[in] | error | the error code returned previously. |
Create information_schema table using schema_table data.
thd | thread handler |
table_list | Used to pass I_S table information(fields info, tables parameters etc) and table name. |
NULL | Can't create table |
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.
thd | Thread context. |
table_list | I_S table. |
condition | Condition, 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). |
true | Error. |
false | Success. |
int finalize_schema_table | ( | st_plugin_int * | plugin | ) |
ST_SCHEMA_TABLE * find_schema_table | ( | THD * | thd, |
const char * | table_name | ||
) |
|
static |
void free_status_vars | ( | ) |
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 |
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.
thd | The handle of the current THD. | |
variable | Details of the variable. | |
value_type | Variable type. | |
show_type | Variable show type. | |
status_var | Status values or NULL if for system variable. | |
[out] | charset | Character set of the value. |
[in,out] | buff | Buffer to store the value. |
[out] | length | Length of the value. |
[out] | is_null | Is variable value NULL or not. |
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.
running_thd | The handle of the current THD. | |
target_thd | The handle of the remote THD. | |
variable | Details of the variable. | |
value_type | Variable type. | |
show_type | Variable show type. | |
status_var | Status values or NULL if for system variable. | |
[out] | charset | Character set of the value. |
[in,out] | buff | Buffer to store the value. |
[out] | length | Length of the value. |
[out] | is_null | Is variable value NULL or not. This parameter is set only for variables of string type. |
int get_quote_char_for_identifier | ( | const THD * | thd, |
const char * | name, | ||
size_t | length | ||
) |
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
[in] | thd | thread handler |
[in] | name | name of the status variable |
[in] | var_type | Variable type |
[in,out] | value | buffer in which value of the status variable needs to be filled in |
[in,out] | length | filled with buffer length |
[out] | charset | charset of the data returned |
false | if variable is not found in the list |
true | if variable is found in the list |
|
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
[in] | thd | thread handler |
[in] | list | list of SHOW_VAR objects in which function should search |
[in] | is_a_list | true if it's a list array that needs to be iterated |
[in] | name | name of the status variable |
[in] | var_type | Variable type |
[in,out] | value | buffer in which value of the status variable needs to be filled in |
[in,out] | length | filled with buffer length |
[out] | charset | charset of the data returned |
false | if variable is not found in the list |
true | if variable is found in the list |
ST_SCHEMA_TABLE * get_schema_table | ( | enum enum_schema_tables | schema_table_idx | ) |
enum enum_schema_tables get_schema_table_idx | ( | ST_SCHEMA_TABLE * | schema_table | ) |
|
static |
|
static |
ulonglong get_status_vars_version | ( | void | ) |
Read the Data Dictionary to obtain base table name for the specified trigger name and construct TABE_LIST object for the base table.
thd | Thread context. |
trg_name | Trigger name. |
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:
void init_status_vars | ( | ) |
void initialize_information_schema_acl | ( | ) |
int initialize_schema_table | ( | st_plugin_int * | plugin | ) |
|
inlinestatic |
|
static |
bool iterate_all_dynamic_privileges | ( | THD * | thd, |
std::function< bool(const char *)> | action | ||
) |
|
static |
bool make_schema_query_block | ( | THD * | thd, |
Query_block * | sel, | ||
enum enum_schema_tables | schema_table_idx | ||
) |
Generate select from information_schema table.
thd | thread handler |
sel | pointer to Query_block |
schema_table_idx | index of 'schema_tables' element |
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.
thd | Thread |
sel | Instance of Query_block. |
db_name | Database name. |
table_name | Table name. |
|
static |
|
static |
Create information_schema table.
thd | thread handler |
lex | pointer to LEX |
table_list | pointer to table_list |
void mysqld_list_processes | ( | THD * | thd, |
const char * | user, | ||
bool | verbose, | ||
bool | has_cursor | ||
) |
List running processes (actually connected sessions).
thd | thread handle. |
user | Username of connected client. |
verbose | if false, limit output to PROCESS_LIST_WIDTH characters. |
has_cursor | if true, called from a command object that handles terminatation of sending to client, otherwise terminate explicitly with my_eof() call. |
bool mysqld_show_create_db | ( | THD * | thd, |
char * | dbname, | ||
HA_CREATE_INFO * | create_info | ||
) |
bool mysqld_show_privileges | ( | THD * | thd | ) |
|
static |
Print "DEFAULT" clause of a field into a string.
thd | The THD to create the DEFAULT clause for. |
field | The field to generate the DEFAULT clause for. |
def_value | String to write the DEFAULT clause to to. |
quoted | Whether 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). |
|
static |
Append definitions of FOREIGN KEY statements to SHOW CREATE TABLE statement output for the table.
thd | Thread context. | |
db | Table's database. | |
table_obj | dd::Table describing the table. | |
[in,out] | packet | Pointer to a string where CREATE TABLE statement describing the table is being constructed. |
Print "ON UPDATE" clause of a field into a string.
field | The field to generate ON UPDATE clause for. |
val | String to write ON UPDATE clause to to |
lcase | Whether to print in lower case. |
void remove_status_vars | ( | SHOW_VAR * | list | ) |
|
static |
void reset_status_vars | ( | ) |
Store record to I_S table, convert HEAP table to InnoDB table if necessary.
[in] | thd | thread handler |
[in] | table | Information schema table to be updated |
[in] | make_ondisk | if true, convert heap table to on disk table. default value is true. |
|
static |
SHOW CREATE TRIGGER high-level implementation.
thd | Thread context. |
trg_name | Trigger name. |
true | Error. |
false | Success. |
Output trigger information (SHOW CREATE TRIGGER) to the client.
thd | Thread context. |
trigger | table trigger to dump. |
true | Error. |
false | Success. |
|
static |
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.
type | the type to print |
is_array | whether the field is a typed array |
metadata | field's metadata, depending on the type could be nothing, length, or length + decimals |
str | String to print to |
field_cs | field's charset. When given [var]char length is printed in characters, otherwise - in bytes |
vector_dimensionality | The dimensionality of a vector field |
Implementation of SHOW INDEX / SHOW COLUMNS for temporary tables.
thd | Thread handle |
tables | Table to fill with data |
|
static |
|
constexpr |
Build a CREATE TABLE statement for a table.
Characters shown for the command in 'show processlist'.
thd | The thread |
table_list | A list containing one table to write statement for. |
packet | Pointer to a string where statement will be written. |
create_info_arg | Pointer 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_database | If 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_stmt | If 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. |
Append START TRANSACTION for CREATE SELECT on SE supporting atomic DDL. This is done only while binlogging CREATE TABLE AS SELECT.
|
static |
Try acquire high priority share metadata lock on a table (with optional wait for conflicting locks to go away).
thd | Thread context. |
table | Table list element for the table |
can_deadlock | Indicates that deadlocks are possible due to metadata locks, so to avoid them we should not wait in case if conflicting lock is present. |
false | No error, if lock was obtained Table_ref::mdl_request::ticket is set to non-NULL value. |
true | Some error occurred (probably thread was killed). |
ST_FIELD_INFO column_privileges_fields_info[] |
std::atomic_ulong deprecated_use_i_s_processlist_count = 0 |
Count number of times information_schema.processlist has been used.
std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp = 0 |
Last time information_schema.processlist was used, as usec since epoch.
ST_FIELD_INFO engines_fields_info[] |
|
static |
TYPELIB grant_types |
|
static |
Grantee is of form 'user'@'hostname', so add +1 for '@' and +4 for the single quotes.
|
static |
ST_FIELD_INFO open_tables_fields_info[] |
|
extern |
For creating fields of information_schema.OPTIMIZER_TRACE.
ST_FIELD_INFO plugin_fields_info[] |
ST_FIELD_INFO processlist_fields_info[] |
ST_FIELD_INFO schema_privileges_fields_info[] |
ST_SCHEMA_TABLE schema_tables |
ulonglong status_var_array_version = 0 |
bool status_vars_inited = false |
|
static |
ST_FIELD_INFO table_privileges_fields_info[] |
ST_FIELD_INFO tmp_table_columns_fields_info[] |
ST_FIELD_INFO tmp_table_keys_fields_info[] |
ST_FIELD_INFO user_privileges_fields_info[] |