MySQL 8.4.3
Source Code Documentation
|
Modules | |
Event Scheduler | |
Mysys - low level utilities for MySQL | |
Serialized Dictionary Information | |
Code to serialize and deserialize data dictionary objects, and for storing and retrieving the serialized representation from files or tablespaces. | |
Server time functions | |
Stored Routines | |
Classes | |
class | Kill_non_super_conn |
This class implements callback function used by killall_non_super_threads to kill all threads that do not have either SYSTEM_VARIABLES_ADMIN + CONNECTION_ADMIN privileges or legacy SUPER privilege. More... | |
class | Parser_oom_handler |
Macros | |
#define | SP_COM_STRING(LP) |
#define | MY_YACC_INIT 1000 |
#define | MY_YACC_MAX 32000 |
Functions | |
static void | sql_kill (THD *thd, my_thread_id id, bool only_kill_query) |
bool | command_satisfy_acl_cache_requirement (unsigned command) |
bool | all_tables_not_ok (THD *thd, Table_ref *tables) |
Returns true if all tables should be ignored. More... | |
bool | is_normal_transaction_boundary_stmt (enum_sql_command sql_cmd) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of a transaction. More... | |
bool | is_xa_transaction_boundary_stmt (enum_sql_command sql_cmd) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of an XA transaction. More... | |
bool | check_database_filters (THD *thd, const char *db, enum_sql_command sql_cmd) |
Checks whether the event for the given database, db, should be ignored or not. More... | |
bool | some_non_temp_table_to_be_updated (THD *thd, Table_ref *tables) |
bool | stmt_causes_implicit_commit (const THD *thd, uint mask) |
Returns whether the command in thd->lex->sql_command should cause an implicit commit. More... | |
static bool | run_post_replication_filters_actions (THD *thd) |
Iterates over all post replication filter actions registered and executes them. More... | |
static bool | check_and_report_require_row_format_violation (THD *thd) |
This function determines if the current statement parsed violates the require_row_format check. More... | |
void | init_sql_command_flags () |
bool | sqlcom_can_generate_row_events (enum enum_sql_command command) |
bool | is_update_query (enum enum_sql_command command) |
bool | is_explainable_query (enum enum_sql_command command) |
bool | is_log_table_write_query (enum enum_sql_command command) |
Check if a sql command is allowed to write to log tables. More... | |
static bool | sqlcom_needs_autocommit_off (const LEX *lex) |
Check if statement (typically DDL) needs auto-commit mode temporarily turned off. More... | |
void | execute_init_command (THD *thd, LEX_STRING *init_command, mysql_rwlock_t *var_lock) |
void | free_items (Item *item) |
void | cleanup_items (Item *item) |
This works because items are allocated with (*THR_MALLOC)->Alloc(). More... | |
void | bind_fields (Item *first) |
Bind Item fields to Field objects. More... | |
bool | do_command (THD *thd) |
Read one command from connection and execute it (query or simple command). More... | |
static bool | deny_updates_if_read_only_option (THD *thd, Table_ref *all_tables) |
Determine if an attempt to update a non-temporary table while the read-only option was enabled has been made. More... | |
static void | check_secondary_engine_statement (THD *thd, Parser_state *parser_state, const char *query_string, size_t query_length) |
Check if a failed statement should be restarted in another storage engine, and restart the statement if needed. More... | |
void | set_gr_incoming_connection (gr_incoming_connection_cb x) |
gr_incoming_connection_cb | get_gr_incoming_connection () |
int | call_gr_incoming_connection_cb (THD *thd, int fd, SSL *ssl_ctx) |
Call the registered GR callback that delegates an incoming connection which is destined to GR. More... | |
void | wait_for_gr_connection_end (THD *thd) |
Wait for a delegated connection to GR, until it ends or GR is shutdown. More... | |
static void | copy_bind_parameter_values (THD *thd, PS_PARAM *parameters, unsigned long count) |
Deep copy the name and value of named parameters into the THD memory. More... | |
bool | dispatch_command (THD *thd, const COM_DATA *com_data, enum enum_server_command command) |
Perform one connection-level (COM_XXXX) command. More... | |
bool | shutdown (THD *thd, enum mysql_enum_shutdown_level level) |
Shutdown the mysqld server. More... | |
int | prepare_schema_table (THD *thd, LEX *lex, Table_ident *table_ident, enum enum_schema_tables schema_table_idx) |
Create a Table_ref object for an INFORMATION_SCHEMA table. More... | |
bool | alloc_query (THD *thd, const char *packet, size_t packet_length) |
Read query from packet and store in thd->query. More... | |
static bool | sp_process_definer (THD *thd) |
static bool | lock_tables_open_and_lock_tables (THD *thd, Table_ref *tables) |
Auxiliary call that opens and locks tables for LOCK TABLES statement and initializes the list of locked tables. More... | |
static void | binlog_gtid_end_transaction (THD *thd) |
This is a wrapper for MYSQL_BIN_LOG::gtid_end_transaction. More... | |
int | mysql_execute_command (THD *thd, bool first_level) |
Execute command saved in thd and lex->sql_command. More... | |
bool | show_precheck (THD *thd, LEX *lex, bool lock) |
Do special checking for SHOW statements. More... | |
bool | my_yyoverflow (short **yyss, MY_SQL_PARSER_STYPE **yyvs, POS **yyls, ulong *yystacksize) |
void | mysql_reset_thd_for_next_command (THD *thd) |
Reset the part of THD responsible for the state of command processing. More... | |
void | statement_id_to_session (THD *thd) |
void | dispatch_sql_command (THD *thd, Parser_state *parser_state) |
Parse an SQL command from a text string and pass the resulting AST to the query executor. More... | |
bool | mysql_test_parse_for_slave (THD *thd) |
Usable by the replication SQL thread only: just parse a query to know if it can be ignored because of replicate-*-table rules. More... | |
void | add_to_list (SQL_I_List< ORDER > &list, ORDER *order) |
save order by and tables in own lists. More... | |
static bool | reparse_common_table_expr (THD *thd, const char *text, size_t text_length, uint text_offset, PT_subquery **node) |
Produces a PT_subquery object from a subquery's text. More... | |
Table_ref * | nest_join (THD *thd, Query_block *select, Table_ref *embedding, mem_root_deque< Table_ref * > *jlist, size_t table_cnt, const char *legend) |
Plumbing for nest_last_join, q.v. More... | |
bool | push_new_name_resolution_context (Parse_context *pc, Table_ref *left_op, Table_ref *right_op) |
Push a new name resolution context for a JOIN ... ON clause to the context stack of a query block. More... | |
void | add_join_on (Table_ref *b, Item *expr) |
Add an ON condition to the second operand of a JOIN ... ON. More... | |
const CHARSET_INFO * | get_bin_collation (const CHARSET_INFO *cs) |
static uint | kill_one_thread (THD *thd, my_thread_id id, bool only_kill_query) |
kill on thread. More... | |
void | killall_non_super_threads (THD *thd) |
bool | prepare_index_and_data_dir_path (THD *thd, const char **data_file_name, const char **index_file_name, const char *table_name) |
prepares the index and data directory path. More... | |
int | append_file_to_dir (THD *thd, const char **filename_ptr, const char *table_name) |
If pointer is not a null pointer, append filename to it. More... | |
Comp_creator * | comp_eq_creator (bool invert) |
Comp_creator * | comp_equal_creator (bool invert) |
Comp_creator * | comp_ge_creator (bool invert) |
Comp_creator * | comp_gt_creator (bool invert) |
Comp_creator * | comp_le_creator (bool invert) |
Comp_creator * | comp_lt_creator (bool invert) |
Comp_creator * | comp_ne_creator (bool invert) |
Item * | all_any_subquery_creator (Item *left_expr, chooser_compare_func_creator cmp, bool all, Query_block *query_block) |
Construct ALL/ANY/SOME subquery Item. More... | |
void | create_table_set_open_action_and_adjust_tables (LEX *lex) |
Set proper open mode and table type for element representing target table of CREATE TABLE statement, also adjust statement table list if necessary. More... | |
void | get_default_definer (THD *thd, LEX_USER *definer) |
Set the specified definer to the default value, which is the current user in the thread. More... | |
LEX_USER * | create_default_definer (THD *thd) |
Create default definer for the specified THD. More... | |
LEX_USER * | get_current_user (THD *thd, LEX_USER *user) |
Returns information about user or current user. More... | |
static bool | check_string_byte_length (const LEX_CSTRING &str, const char *err_msg, size_t max_byte_length) |
Check that byte length of a string does not exceed some limit. More... | |
bool | check_string_char_length (const LEX_CSTRING &str, const char *err_msg, size_t max_char_length, const CHARSET_INFO *cs, bool no_error) |
int | test_if_data_home_dir (const char *dir) |
bool | check_host_name (const LEX_CSTRING &str) |
Check that host name string is valid. More... | |
bool | parse_sql (THD *thd, Parser_state *parser_state, Object_creation_ctx *creation_ctx) |
Transform an SQL statement into an AST that is ready for resolving, using the supplied parser state and object creation context. More... | |
static const std::string & | Command_names::translate (const System_variables &sysvars) |
Given a system_variable object, returns the string to use for m_replace_com, according to the setting of terminology_use_previous stored in the object. More... | |
static const std::string & | Command_names::str_session (enum_server_command cmd) |
Return a description string for a given enum_server_command. More... | |
static const std::string & | Command_names::str_global (enum_server_command cmd) |
Return a description string for a given enum_server_command. More... | |
void | THD::reset_for_next_command () |
bool | Alter_info::add_field (THD *thd, const LEX_STRING *field_name, enum enum_field_types type, const char *length, const char *decimal, uint type_modifier, Item *default_value, Item *on_update_value, LEX_CSTRING *comment, const char *change, List< String > *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, uint uint_geom_type, Value_generator *gcol_info, Value_generator *default_val_expr, const char *opt_after, std::optional< gis::srid_t > srid, Sql_check_constraint_spec_list *check_cons_list, dd::Column::enum_hidden_type hidden, bool is_array=false) |
Store field definition for create. More... | |
bool | PT_common_table_expr::make_subquery_node (THD *thd, PT_subquery **node) |
bool | Query_block::find_common_table_expr (THD *thd, Table_ident *table_id, Table_ref *tl, Parse_context *pc, bool *found) |
Tries to match an identifier to the CTEs in scope; if matched, it modifies *table_name, *tl', and the matched with-list-element. More... | |
bool | PT_with_clause::lookup (Table_ref *tl, PT_common_table_expr **found) |
Looks up a table reference into the list of CTEs. More... | |
bool | PT_common_table_expr::match_table_ref (Table_ref *tl, bool in_self, bool *found) |
Table_ref * | Query_block::add_table_to_list (THD *thd, Table_ident *table, const char *alias, ulong table_options, thr_lock_type flags=TL_UNLOCK, enum_mdl_type mdl_type=MDL_SHARED_READ, List< Index_hint > *hints=nullptr, List< String > *partition_names=nullptr, LEX_STRING *option=nullptr, Parse_context *pc=nullptr) |
Add a table to list of used tables. More... | |
bool | Query_block::init_nested_join (THD *thd) |
Initialize a new table list for a nested join. More... | |
Table_ref * | Query_block::end_nested_join () |
End a nested join table list. More... | |
Table_ref * | Query_block::nest_last_join (THD *thd, size_t table_cnt=2) |
Nest last join operations. More... | |
bool | Query_block::add_joined_table (Table_ref *table) |
Add a table to the current join list. More... | |
void | Query_block::set_lock_for_table (const Lock_descriptor &descriptor, Table_ref *table) |
void | Query_block::set_lock_for_tables (thr_lock_type lock_type) |
Set lock for all tables in current query block. More... | |
Variables | |
uint | sql_command_flags [SQLCOM_END+1] |
Mark all commands that somehow changes a table. More... | |
uint | server_command_flags [COM_END+1] |
static std::atomic< gr_incoming_connection_cb > | com_incoming_gr_stream_cb |
static const std::string | Command_names::m_names [] |
Array indexed by enum_server_command, where each element is a description string. More... | |
static const std::string | Command_names::m_replace_str {"Register Slave"} |
Name to use when compatibility is enabled. More... | |
#define MY_YACC_INIT 1000 |
#define MY_YACC_MAX 32000 |
#define SP_COM_STRING | ( | LP | ) |
bool Alter_info::add_field | ( | THD * | thd, |
const LEX_STRING * | field_name, | ||
enum enum_field_types | type, | ||
const char * | length, | ||
const char * | decimals, | ||
uint | type_modifier, | ||
Item * | default_value, | ||
Item * | on_update_value, | ||
LEX_CSTRING * | comment, | ||
const char * | change, | ||
List< String > * | interval_list, | ||
const CHARSET_INFO * | cs, | ||
bool | has_explicit_collation, | ||
uint | uint_geom_type, | ||
Value_generator * | gcol_info, | ||
Value_generator * | default_val_expr, | ||
const char * | opt_after, | ||
std::optional< gis::srid_t > | srid, | ||
Sql_check_constraint_spec_list * | col_check_const_spec_list, | ||
dd::Column::enum_hidden_type | hidden, | ||
bool | is_array = false |
||
) |
Store field definition for create.
thd | The thread handler. |
field_name | The field name. |
type | The type of the field. |
length | The length of the field or NULL. |
decimals | The length of a decimal part or NULL. |
type_modifier | Type modifiers & constraint flags of the field. |
default_value | The default value or NULL. |
on_update_value | The ON UPDATE expression or NULL. |
comment | The comment. |
change | The old column name (if renaming) or NULL. |
interval_list | The list of ENUM/SET values or NULL. |
cs | The character set of the field. |
has_explicit_collation | Column has an explicit COLLATE attribute. |
uint_geom_type | The GIS type of the field. |
gcol_info | The generated column data or NULL. |
default_val_expr | The expression for generating default values, if there is one, or nullptr. |
opt_after | The name of the field to add after or the |
srid | The SRID for this column (only relevant if this is a geometry column). |
col_check_const_spec_list | List of column check constraints. |
hidden | Column hidden type. |
is_array | Whether it's a typed array field |
Add an ON condition to the second operand of a JOIN ... ON.
Add an ON condition to the right operand of a JOIN ... ON clause.
b | the second operand of a JOIN ... ON |
expr | the condition to be added to the ON clause |
bool Query_block::add_joined_table | ( | Table_ref * | table | ) |
Add a table to the current join list.
The function puts a table in front of the current join list of Query_block object. Thus, joined tables are put into this list in the reverse order (the most outer join operation follows first).
table | The table to add. |
Table_ref * Query_block::add_table_to_list | ( | THD * | thd, |
Table_ident * | table_name, | ||
const char * | alias, | ||
ulong | table_options, | ||
thr_lock_type | lock_type = TL_UNLOCK , |
||
enum_mdl_type | mdl_type = MDL_SHARED_READ , |
||
List< Index_hint > * | index_hints_arg = nullptr , |
||
List< String > * | partition_names = nullptr , |
||
LEX_STRING * | option = nullptr , |
||
Parse_context * | pc = nullptr |
||
) |
Add a table to list of used tables.
thd | Current session. |
table_name | Table to add |
alias | alias for table (or null if no alias) |
table_options | A set of the following bits:
|
lock_type | How table should be locked |
mdl_type | Type of metadata lock to acquire on the table. |
index_hints_arg | a list of index hints(FORCE/USE/IGNORE INDEX). |
partition_names | List to carry partition names from PARTITION (...) clause in statement |
option | Used by cache index |
pc | Current parsing context, if available. |
0 | Error |
void add_to_list | ( | SQL_I_List< ORDER > & | list, |
ORDER * | order | ||
) |
save order by and tables in own lists.
Item * all_any_subquery_creator | ( | Item * | left_expr, |
chooser_compare_func_creator | cmp, | ||
bool | all, | ||
Query_block * | query_block | ||
) |
Construct ALL/ANY/SOME subquery Item.
left_expr | pointer to left expression |
cmp | compare function creator |
all | true if we create ALL subquery |
query_block | pointer on parsed subquery structure |
Returns true if all tables should be ignored.
bool alloc_query | ( | THD * | thd, |
const char * | packet, | ||
size_t | packet_length | ||
) |
Read query from packet and store in thd->query.
Used in COM_QUERY and COM_STMT_PREPARE.
Sets the following THD variables:
false | ok |
true | error; In this case thd->fatal_error is set |
int append_file_to_dir | ( | THD * | thd, |
const char ** | filename_ptr, | ||
const char * | table_name | ||
) |
If pointer is not a null pointer, append filename to it.
void bind_fields | ( | Item * | first | ) |
Bind Item fields to Field objects.
first | Pointer to first item, follow "next" chain to visit all items |
|
inlinestatic |
This is a wrapper for MYSQL_BIN_LOG::gtid_end_transaction.
For normal statements, the function gtid_end_transaction is called in the commit handler. However, if the statement is filtered out or not written to the binary log, the commit handler is not invoked. Therefore, this wrapper calls gtid_end_transaction in case the current statement is committing but was not written to the binary log. (The function gtid_end_transaction ensures that gtid-related end-of-transaction operations are performed; this includes generating an empty transaction and calling Gtid_state::update_gtids_impl.)
thd | Thread (session) context. |
int call_gr_incoming_connection_cb | ( | THD * | thd, |
int | fd, | ||
SSL * | ssl_ctx | ||
) |
Call the registered GR callback that delegates an incoming connection which is destined to GR.
thd | Connection THD |
fd | Connection file descriptor |
ssl_ctx | Connection SSL Context |
|
static |
This function determines if the current statement parsed violates the require_row_format check.
Given a parsed context within the THD object, this function will infer whether the require row format check is violated or not. If it is, this function returns true, false otherwise. Note that this function can be called from both, normal sessions and replication applier, execution paths.
thd | The session context holding the parsed statement. |
|
inline |
Checks whether the event for the given database, db, should be ignored or not.
This is done by checking whether there are active rules in ignore_db or in do_db containers. If there are, then check if there is a match, if not then check the wild_do rules.
NOTE: This means that when using this function replicate-do-db and replicate-ignore-db take precedence over wild do rules.
thd | Thread handle. |
db | Database name used while evaluating the filtering rules. |
sql_cmd | Represents the current query that needs to be verified against the database filter rules. |
bool check_host_name | ( | const LEX_CSTRING & | str | ) |
Check that host name string is valid.
[in] | str | string to be checked |
false | host name is ok |
true | host name string is longer than max_length or has invalid symbols |
|
static |
Check if a failed statement should be restarted in another storage engine, and restart the statement if needed.
thd | the session |
parser_state | the parser state |
query_string | the query to reprepare and execute |
query_length | the length of the query |
|
static |
Check that byte length of a string does not exceed some limit.
str | string to be checked |
err_msg | error message to be displayed if the string is too long |
max_byte_length | max length |
false | the passed string is not longer than max_length |
true | the passed string is longer than max_length |
NOTE The function is not used in existing code but can be useful later?
bool check_string_char_length | ( | const LEX_CSTRING & | str, |
const char * | err_msg, | ||
size_t | max_char_length, | ||
const CHARSET_INFO * | cs, | ||
bool | no_error | ||
) |
void cleanup_items | ( | Item * | item | ) |
This works because items are allocated with (*THR_MALLOC)->Alloc().
bool command_satisfy_acl_cache_requirement | ( | unsigned | command | ) |
Comp_creator * comp_eq_creator | ( | bool | invert | ) |
Comp_creator * comp_equal_creator | ( | bool | invert | ) |
Comp_creator * comp_ge_creator | ( | bool | invert | ) |
Comp_creator * comp_gt_creator | ( | bool | invert | ) |
Comp_creator * comp_le_creator | ( | bool | invert | ) |
Comp_creator * comp_lt_creator | ( | bool | invert | ) |
Comp_creator * comp_ne_creator | ( | bool | invert | ) |
|
static |
Deep copy the name and value of named parameters into the THD memory.
We need to do this since the packet bytes will go away during query processing. It doesn't need to be done for the unnamed ones since they're being copied by and into Item_param. So we don't want to duplicate this.
thd | the thread to copy the parameters to. |
parameters | the values to copy |
count | the number of parameters to copy |
Create default definer for the specified THD.
[in] | thd | thread handler |
void create_table_set_open_action_and_adjust_tables | ( | LEX * | lex | ) |
Set proper open mode and table type for element representing target table of CREATE TABLE statement, also adjust statement table list if necessary.
Determine if an attempt to update a non-temporary table while the read-only option was enabled has been made.
This is a helper function to mysql_execute_command.
true | The statement should be denied. |
false | The statement isn't updating any relevant tables. |
bool dispatch_command | ( | THD * | thd, |
const COM_DATA * | com_data, | ||
enum enum_server_command | command | ||
) |
Perform one connection-level (COM_XXXX) command.
thd | connection handle |
command | type of command to perform |
com_data | com_data union to store the generated command |
0 | ok |
1 | request of thread shutdown, i. e. if command is COM_QUIT |
Clear the set of flags that are expected to be cleared at the beginning of each command.
Enforce password expiration for all RPC commands, except the following:
COM_QUERY/COM_STMT_PREPARE and COM_STMT_EXECUTE do a more fine-grained check later. COM_STMT_CLOSE and COM_STMT_SEND_LONG_DATA don't return anything. COM_PING only discloses information that the server is running, and that's available through other means. COM_QUIT should work even for expired statements.
void dispatch_sql_command | ( | THD * | thd, |
Parser_state * | parser_state | ||
) |
Parse an SQL command from a text string and pass the resulting AST to the query executor.
thd | Current session. |
parser_state | Parser state. |
bool do_command | ( | THD * | thd | ) |
Read one command from connection and execute it (query or simple command).
This function is called in loop from thread function.
For profiling to work, it must never be called recursively.
0 | success |
1 | request of thread shutdown (see dispatch_command() description) |
Table_ref * Query_block::end_nested_join | ( | ) |
End a nested join table list.
The function returns to the previous join nest level. If the current level contains only one member, the function moves it one level up, eliminating the nest.
void execute_init_command | ( | THD * | thd, |
LEX_STRING * | init_command, | ||
mysql_rwlock_t * | var_lock | ||
) |
|
private |
Tries to match an identifier to the CTEs in scope; if matched, it modifies *table_name, *tl', and the matched with-list-element.
thd | Thread handler | |
[out] | table_name | Identifier |
[in,out] | tl | Table_ref for the identifier |
pc | Current parsing context, if available | |
[out] | found | Is set to true if found. |
void free_items | ( | Item * | item | ) |
const CHARSET_INFO * get_bin_collation | ( | const CHARSET_INFO * | cs | ) |
Returns information about user or current user.
[in] | thd | thread handler |
[in] | user | user |
Set the specified definer to the default value, which is the current user in the thread.
[in] | thd | thread handler |
[out] | definer | definer |
gr_incoming_connection_cb get_gr_incoming_connection | ( | ) |
bool Query_block::init_nested_join | ( | THD * | thd | ) |
Initialize a new table list for a nested join.
The function initializes a structure of the Table_ref type for a nested join. It sets up its nested join list as empty. The created structure is added to the front of the current join list in the Query_block object. Then the function changes the current nest level for joins to refer to the newly created empty list after having saved the info on the old level in the initialized structure.
thd | current thread |
0 | if success |
1 | otherwise |
void init_sql_command_flags | ( | void | ) |
ACL DDLs do not access data-dictionary tables. However, they still need to be marked to avoid autocommit. This is necessary because code which saves GTID state or slave state in the system tables at commit time does statement commit on low-level (see System_table_access::close_table()) and thus can pre-maturely commit DDL otherwise.
Some statements doesn't if the ACL CACHE is disabled using the –skip-grant-tables server option.
bool is_explainable_query | ( | enum enum_sql_command | command | ) |
bool is_log_table_write_query | ( | enum enum_sql_command | command | ) |
Check if a sql command is allowed to write to log tables.
command | The SQL command |
bool is_normal_transaction_boundary_stmt | ( | enum enum_sql_command | command | ) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of a transaction.
command | The parsed SQL_COMM to check. |
bool is_update_query | ( | enum enum_sql_command | command | ) |
bool is_xa_transaction_boundary_stmt | ( | enum enum_sql_command | command | ) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of an XA transaction.
It does not consider PREPARE statements.
command | The parsed SQL_COMM to check. |
|
static |
kill on thread.
thd | Thread class |
id | Thread id |
only_kill_query | Should it kill the query or the connection |
void killall_non_super_threads | ( | THD * | thd | ) |
Auxiliary call that opens and locks tables for LOCK TABLES statement and initializes the list of locked tables.
thd | Thread context. |
tables | List of tables to be locked. |
bool PT_with_clause::lookup | ( | Table_ref * | tl, |
PT_common_table_expr ** | found | ||
) |
Looks up a table reference into the list of CTEs.
tl | Table reference to look up | |
[out] | found | Is set to true/false if found or not |
bool PT_common_table_expr::make_subquery_node | ( | THD * | thd, |
PT_subquery ** | node | ||
) |
thd | Thread handler | |
[out] | node | PT_subquery |
bool PT_common_table_expr::match_table_ref | ( | Table_ref * | tl, |
bool | in_self, | ||
bool * | found | ||
) |
tl | Table reference to match | |
in_self | If this is a recursive reference | |
[out] | found | Is set to true/false if matches or not |
bool my_yyoverflow | ( | short ** | yyss, |
MY_SQL_PARSER_STYPE ** | yyvs, | ||
POS ** | yyls, | ||
ulong * | yystacksize | ||
) |
int mysql_execute_command | ( | THD * | thd, |
bool | first_level | ||
) |
Execute command saved in thd and lex->sql_command.
thd | Thread handle |
first_level | whether invocation of the mysql_execute_command() is a top level query or sub query. At the highest level, first_level value is true. Stored procedures can execute sub queries. In such cases first_level (recursive mysql_execute_command() call) will be false. |
false | OK |
true | Error |
void mysql_reset_thd_for_next_command | ( | THD * | thd | ) |
Reset the part of THD responsible for the state of command processing.
This needs to be called before execution of every statement (prepared or conventional). It is not called by substatements of routines.
bool mysql_test_parse_for_slave | ( | THD * | thd | ) |
Usable by the replication SQL thread only: just parse a query to know if it can be ignored because of replicate-*-table rules.
0 | cannot be ignored |
1 | can be ignored |
Table_ref * nest_join | ( | THD * | thd, |
Query_block * | select, | ||
Table_ref * | embedding, | ||
mem_root_deque< Table_ref * > * | jlist, | ||
size_t | table_cnt, | ||
const char * | legend | ||
) |
Plumbing for nest_last_join, q.v.
Nest last join operations.
The function nest last table_cnt join operations as if they were the components of a cross join operation.
thd | current thread |
table_cnt | 2 for regular joins: t1 JOIN t2. N for the MySQL join-like extension: (t1, t2, ... tN). |
0 | Error |
bool parse_sql | ( | THD * | thd, |
Parser_state * | parser_state, | ||
Object_creation_ctx * | creation_ctx | ||
) |
Transform an SQL statement into an AST that is ready for resolving, using the supplied parser state and object creation context.
This is a wrapper() for THD::sql_parser() and should generally be used for AST construction.
The function may optionally generate a query digest, invoke this function as follows:
THD *thd = ...; const char *query_text = ...; uint query_length = ...; Object_creation_ctx *ctx = ...; bool rc; Parser_state parser_state; if (parser_state.init(thd, query_text, query_length) { ... handle error } parser_state.m_input.m_has_digest= true; parser_state.m_input.m_compute_digest= true; rc= parse_sql(the, &parser_state, ctx); if (! rc) { unsigned char md5[MD5_HASH_SIZE]; char digest_text[1024]; bool truncated; const sql_digest_storage *digest= & thd->m_digest->m_digest_storage; compute_digest_md5(digest, & md5[0]); compute_digest_text(digest, & digest_text[0], sizeof(digest_text), & truncated); }
thd | Thread context. |
parser_state | Parser state. |
creation_ctx | Object creation context. |
false | on success. |
true | on parsing error. |
bool prepare_index_and_data_dir_path | ( | THD * | thd, |
const char ** | data_file_name, | ||
const char ** | index_file_name, | ||
const char * | table_name | ||
) |
prepares the index and data directory path.
thd | Thread handle |
data_file_name | Pathname for data directory |
index_file_name | Pathname for index directory |
table_name | Table name to be appended to the pathname specified |
int prepare_schema_table | ( | THD * | thd, |
LEX * | lex, | ||
Table_ident * | table_ident, | ||
enum enum_schema_tables | schema_table_idx | ||
) |
Create a Table_ref object for an INFORMATION_SCHEMA table.
This function is used in the parser to convert a SHOW or DESCRIBE table_name command to a SELECT from INFORMATION_SCHEMA. It prepares a Query_block and a Table_ref object to represent the given command as a SELECT parse tree.
thd | thread handle |
lex | current lex |
table_ident | table alias if it's used |
schema_table_idx | the type of the INFORMATION_SCHEMA table to be created |
0 | success |
1 | out of memory or SHOW commands are not allowed in this version of the server. |
bool push_new_name_resolution_context | ( | Parse_context * | pc, |
Table_ref * | left_op, | ||
Table_ref * | right_op | ||
) |
Push a new name resolution context for a JOIN ... ON clause to the context stack of a query block.
Create a new name resolution context for a JOIN ... ON clause, set the first and last leaves of the list of table references to be used for name resolution, and push the newly created context to the stack of contexts of the query.
pc | current parse context |
left_op | left operand of the JOIN |
right_op | right operand of the JOIN |
false | if all is OK |
true | if a memory allocation error occurred |
|
static |
Produces a PT_subquery object from a subquery's text.
thd | Thread handler | |
text | Subquery's text | |
text_length | Length of 'text' | |
text_offset | Offset in bytes of 'text' in the original statement | |
[out] | node | Produced PT_subquery object |
void THD::reset_for_next_command | ( | ) |
|
static |
Iterates over all post replication filter actions registered and executes them.
All actions registered will be executed at most once. They are executed in the order that they were registered. Shall there be an error while iterating through the list of actions and executing them, then the process stops and an error is returned immediately. This means that in that case, some actions may have executed successfully and some not. In other words, this procedure is not atomic.
This function will consume all actions from the list if there is no error. This means that actions run only once per statement. Should there be any sub-statements then actions only run on the top level statement execution.
thd | The thread context. |
void set_gr_incoming_connection | ( | gr_incoming_connection_cb | x | ) |
void Query_block::set_lock_for_table | ( | const Lock_descriptor & | descriptor, |
Table_ref * | table | ||
) |
void Query_block::set_lock_for_tables | ( | thr_lock_type | lock_type | ) |
Set lock for all tables in current query block.
lock_type | Lock to set for tables. |
Do special checking for SHOW statements.
thd | Thread context. |
lex | LEX for SHOW statement. |
lock | If true, lock metadata for schema objects |
bool shutdown | ( | THD * | thd, |
enum mysql_enum_shutdown_level | level | ||
) |
Shutdown the mysqld server.
thd | Thread (session) context. |
level | Shutdown level. |
true | success |
false | When user has insufficient privilege or unsupported shutdown level |
|
static |
|
static |
bool sqlcom_can_generate_row_events | ( | enum enum_sql_command | command | ) |
|
static |
Check if statement (typically DDL) needs auto-commit mode temporarily turned off.
void statement_id_to_session | ( | THD * | thd | ) |
bool stmt_causes_implicit_commit | ( | const THD * | thd, |
uint | mask | ||
) |
Returns whether the command in thd->lex->sql_command should cause an implicit commit.
An active transaction should be implicitly committed if the statement requires so.
thd | Thread handle. |
mask | Bitmask used for the SQL command match. |
true | This statement shall cause an implicit commit. |
false | This statement shall not cause an implicit commit. |
|
static |
Return a description string for a given enum_server_command.
This takes @global.terminology_use_previous into account, and returns an old name if one has been defined and the option is enabled.
cmd | The enum_server_command |
The | description string |
|
static |
Return a description string for a given enum_server_command.
This takes @session.terminology_use_previous into account, and returns an old name if one has been defined and the option is enabled.
cmd | The enum_server_command |
The | description string |
int test_if_data_home_dir | ( | const char * | dir | ) |
|
staticprivate |
Given a system_variable object, returns the string to use for m_replace_com, according to the setting of terminology_use_previous stored in the object.
sysvars | The System_variables object holding the configuration that should be considered when doing the translation. |
void wait_for_gr_connection_end | ( | THD * | thd | ) |
Wait for a delegated connection to GR, until it ends or GR is shutdown.
thd | THD of the delegated connection. |
|
static |
|
staticprivate |
Array indexed by enum_server_command, where each element is a description string.
|
staticprivate |
Name to use when compatibility is enabled.
uint server_command_flags[COM_END+1] |
uint sql_command_flags[SQLCOM_END+1] |
Mark all commands that somehow changes a table.
This is used to check number of updates / hour.
sql_command is actually set to SQLCOM_END sometimes so we need the +1 to include it in the array.
See COMMAND_FLAG_xxx for different type of commands 2 - query that returns meaningful ROW_COUNT() - a number of modified rows