MySQL 9.1.0
Source Code Documentation
|
#include <stddef.h>
#include <sys/types.h>
#include "field_types.h"
#include "lex_string.h"
#include "my_inttypes.h"
#include "mysql/status_var.h"
#include "sql/sql_select.h"
#include "typelib.h"
Go to the source code of this file.
Classes | |
class | Sql_cmd_show |
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally. More... | |
class | Sql_cmd_show_noplan |
Common base class: Represents commands that are not represented by a plan that is equivalent to a SELECT statement. More... | |
class | Sql_cmd_show_schema_base |
Common base class: Represents commands that operate on a schema (database) More... | |
class | Sql_cmd_show_table_base |
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements. More... | |
class | Sql_cmd_show_routine_code |
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements. More... | |
class | Sql_cmd_show_binlog_events |
Following are all subclasses of class Sql_cmd_show, in alphabetical order. More... | |
class | Sql_cmd_show_binlogs |
Represents SHOW BINARY LOGS statement. More... | |
class | Sql_cmd_show_charsets |
Represents SHOW CHARACTER SET statement. More... | |
class | Sql_cmd_show_collations |
Represents SHOW COLLATION statement. More... | |
class | Sql_cmd_show_columns |
Represents SHOW COLUMNS statement. More... | |
class | Sql_cmd_show_create_database |
Represents SHOW CREATE DATABASE statement. More... | |
class | Sql_cmd_show_create_event |
Represents SHOW CREATE EVENT statement. More... | |
class | Sql_cmd_show_create_function |
Represents SHOW CREATE FUNCTION statement. More... | |
class | Sql_cmd_show_create_procedure |
Represents SHOW CREATE PROCEDURE statement. More... | |
class | Sql_cmd_show_create_table |
Represents SHOW CREATE TABLE/VIEW statement. More... | |
class | Sql_cmd_show_create_trigger |
Represents SHOW CREATE TRIGGER statement. More... | |
class | Sql_cmd_show_create_user |
Represents SHOW CREATE USER statement. More... | |
class | Sql_cmd_show_databases |
Represents SHOW DATABASES statement. More... | |
class | Sql_cmd_show_engine_logs |
Represents SHOW ENGINE LOGS statement. More... | |
class | Sql_cmd_show_engine_mutex |
Represents SHOW ENGINE MUTEX statement. More... | |
class | Sql_cmd_show_engine_status |
Represents SHOW ENGINE STATUS statement. More... | |
class | Sql_cmd_show_engines |
Represents SHOW STORAGE ENGINES statement. More... | |
class | Sql_cmd_show_errors |
Represents SHOW ERRORS statement. More... | |
class | Sql_cmd_show_events |
Represents SHOW EVENTS statement. More... | |
class | Sql_cmd_show_grants |
Represents SHOW GRANTS statement. More... | |
class | Sql_cmd_show_keys |
Represents the SHOW INDEX statement. More... | |
class | Sql_cmd_show_binary_log_status |
Represents SHOW BINARY LOG STATUS statement. More... | |
class | Sql_cmd_show_open_tables |
Represents SHOW OPEN TABLES statement. More... | |
class | Sql_cmd_show_plugins |
Represents SHOW PLUGINS statement. More... | |
class | Sql_cmd_show_privileges |
Represents SHOW PRIVILEGES statement. More... | |
class | Sql_cmd_show_processlist |
Represents SHOW PROCESSLIST statement. More... | |
class | Sql_cmd_show_parse_tree |
Represents SHOW PARSE_TREE statement. More... | |
class | Sql_cmd_show_profile |
Represents SHOW PROFILE statement. More... | |
class | Sql_cmd_show_profiles |
Represents SHOW PROFILES statement. More... | |
class | Sql_cmd_show_relaylog_events |
Represents SHOW RELAYLOG EVENTS statement. More... | |
class | Sql_cmd_show_replicas |
Represents SHOW REPLICAS statement. More... | |
class | Sql_cmd_show_replica_status |
Represents SHOW REPLICA STATUS statement. More... | |
class | Sql_cmd_show_status |
Represents SHOW STATUS statement. More... | |
class | Sql_cmd_show_status_func |
Represents SHOW STATUS FUNCTION statement. More... | |
class | Sql_cmd_show_status_proc |
Represents SHOW STATUS PROCEDURE statement. More... | |
class | Sql_cmd_show_table_status |
Represents SHOW TABLE STATUS statement. More... | |
class | Sql_cmd_show_tables |
Represents SHOW TABLES statement. More... | |
class | Sql_cmd_show_triggers |
Represents SHOW TRIGGERS statement. More... | |
class | Sql_cmd_show_variables |
Represents SHOW VARIABLES statement. More... | |
class | Sql_cmd_show_warnings |
Represents SHOW WARNINGS statement. More... | |
Typedefs | |
typedef enum enum_mysql_show_type | SHOW_TYPE |
Functions | |
enum enum_schema_tables int enum constexpr enum_var_type int const size_t constexpr PROCESS_LIST_WIDTH const size_t PROCESS_LIST_INFO_WIDTH 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) |
Characters shown for the command in 'show processlist'. 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... | |
void | append_identifier (const THD *thd, String *packet, const char *name, size_t length) |
void | mysqld_list_fields (THD *thd, Table_ref *table, const char *wild) |
bool | mysqld_show_create (THD *thd, Table_ref *table_list) |
bool | mysqld_show_create_db (THD *thd, char *dbname, HA_CREATE_INFO *create) |
void | mysqld_list_processes (THD *thd, const char *user, bool verbose, bool has_cursor) |
List running processes (actually connected sessions). More... | |
bool | mysqld_show_privileges (THD *thd) |
void | calc_sum_of_all_status (System_status_var *to) |
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... | |
bool | add_status_vars (const SHOW_VAR *list) |
void | remove_status_vars (SHOW_VAR *list) |
void | init_status_vars () |
void | free_status_vars () |
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 | reset_status_vars () |
ulonglong | get_status_vars_version (void) |
bool | show_create_trigger (THD *thd, const sp_name *trg_name) |
SHOW CREATE TRIGGER high-level implementation. More... | |
void | view_store_options (const THD *thd, Table_ref *table, String *buff) |
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... | |
void | initialize_information_schema_acl () |
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... | |
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) |
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 | mysql_schema_table (THD *thd, LEX *lex, Table_ref *table_list) |
Create information_schema table. More... | |
enum enum_schema_tables | get_schema_table_idx (ST_SCHEMA_TABLE *schema_table) |
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=nullptr) |
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=nullptr) |
Returns the value of a system or a status variable. More... | |
int | get_quote_char_for_identifier (const THD *thd, const char *name, size_t length) |
void | show_sql_type (enum_field_types type, bool is_array, uint metadata, String *str, const CHARSET_INFO *field_cs=nullptr, unsigned int vector_dimensionality=0) |
A field's SQL type printout. 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... | |
Variables | |
std::atomic_ulong | deprecated_use_i_s_processlist_count |
Count number of times information_schema.processlist has been used. More... | |
std::atomic_ullong | deprecated_use_i_s_processlist_last_timestamp |
Last time information_schema.processlist was used, as usec since epoch. More... | |
TYPELIB | grant_types |
typedef enum enum_mysql_show_type SHOW_TYPE |
bool add_status_vars | ( | const SHOW_VAR * | list | ) |
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 |
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 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. |
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. |
ST_SCHEMA_TABLE * find_schema_table | ( | THD * | thd, |
const char * | table_name | ||
) |
void free_status_vars | ( | ) |
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 |
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 | ) |
ulonglong get_status_vars_version | ( | void | ) |
void init_status_vars | ( | ) |
void initialize_information_schema_acl | ( | ) |
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. |
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 | ||
) |
bool mysqld_show_privileges | ( | THD * | thd | ) |
void remove_status_vars | ( | SHOW_VAR * | list | ) |
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. |
SHOW CREATE TRIGGER high-level implementation.
thd | Thread context. |
trg_name | Trigger name. |
true | Error. |
false | Success. |
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 |
|
constexpr |
Characters shown for the command in 'show processlist'.
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.
|
extern |
Count number of times information_schema.processlist has been used.
|
extern |
Last time information_schema.processlist was used, as usec since epoch.
|
extern |