MySQL 8.4.2
Source Code Documentation
|
Representation of an SQL command. More...
#include <sql_cmd.h>
Public Member Functions | |
virtual enum_sql_command | sql_command_code () const =0 |
Return the command code for this statement. More... | |
bool | needs_explicit_preparation () const |
bool | is_regular () const |
bool | is_prepared () const |
virtual bool | prepare (THD *) |
Prepare this SQL statement. More... | |
virtual bool | execute (THD *thd)=0 |
Execute this SQL statement. More... | |
virtual void | cleanup (THD *) |
Command-specific reinitialization before execution of prepared statement. More... | |
void | set_owner (Prepared_statement *stmt) |
Set the owning prepared statement. More... | |
Prepared_statement * | owner () const |
Get the owning prepared statement. More... | |
void | set_as_part_of_sp () |
Mark statement as part of procedure. More... | |
bool | is_part_of_sp () const |
virtual enum enum_sql_cmd_type | sql_cmd_type () const |
virtual bool | is_single_table_plan () const |
virtual bool | accept (THD *, Select_lex_visitor *) |
virtual const MYSQL_LEX_CSTRING * | eligible_secondary_storage_engine (THD *) const |
Is this statement of a type and on a form that makes it eligible for execution in a secondary storage engine? More... | |
virtual bool | is_bulk_load () const |
void | disable_secondary_storage_engine () |
Disable use of secondary storage engines in this statement. More... | |
void | enable_secondary_storage_engine () |
bool | secondary_storage_engine_disabled () const |
Has use of secondary storage engines been disabled for this statement? More... | |
void | use_secondary_storage_engine (const handlerton *hton) |
Mark the current statement as using a secondary storage engine. More... | |
bool | using_secondary_storage_engine () const |
Is this statement using a secondary storage engine? More... | |
const handlerton * | secondary_engine () const |
Get the handlerton of the secondary engine that is used for executing this statement, or nullptr if a secondary engine is not used. More... | |
void | set_optional_transform_prepared (bool value) |
bool | is_optional_transform_prepared () |
Protected Member Functions | |
Sql_cmd () | |
virtual | ~Sql_cmd () |
void | set_prepared () |
Set this statement as prepared. More... | |
Private Member Functions | |
Sql_cmd (const Sql_cmd &) | |
void | operator= (Sql_cmd &) |
Private Attributes | |
Prepared_statement * | m_owner |
bool | m_part_of_sp |
Owning prepared statement, NULL if non-prep. More... | |
bool | m_prepared |
True when statement is part of stored proc. More... | |
bool | m_secondary_engine_enabled {true} |
True when statement has been prepared. More... | |
bool | m_prepared_with_optional_transform {false} |
Keeps track of whether the statement was prepared optional transformation. More... | |
const handlerton * | m_secondary_engine {nullptr} |
The secondary storage engine to use for execution of this statement, if any, or nullptr if the primary engine is used. More... | |
Representation of an SQL command.
This class is an interface between the parser and the runtime. The parser builds the appropriate derived classes of Sql_cmd to represent a SQL statement in the parsed tree. The execute() method in the derived classes of Sql_cmd contain the runtime implementation. Note that this interface is used for SQL statements recently implemented, the code for older statements tend to load the LEX structure with more attributes instead. Implement new statements by sub-classing Sql_cmd, as this improves code modularity (see the 'big switch' in dispatch_command()), and decreases the total size of the LEX structure (therefore saving memory in stored programs). The recommended name of a derived class of Sql_cmd is Sql_cmd_<derived>.
Notice that the Sql_cmd class should not be confused with the Statement class. Statement is a class that is used to manage an SQL command or a set of SQL commands. When the SQL statement text is analyzed, the parser will create one or more Sql_cmd objects to represent the actual SQL commands.
|
private |
|
inlineprotected |
|
inlineprotectedvirtual |
|
inlinevirtual |
Reimplemented in Sql_cmd_delete, Sql_cmd_insert_base, Sql_cmd_select, and Sql_cmd_update.
|
inlinevirtual |
Command-specific reinitialization before execution of prepared statement.
param thd Current THD.
|
inline |
Disable use of secondary storage engines in this statement.
After a call to this function, the statement will not try to use a secondary storage engine until it is reprepared.
|
inlinevirtual |
Is this statement of a type and on a form that makes it eligible for execution in a secondary storage engine?
Reimplemented in Sql_cmd_do, Sql_cmd_create_table, Sql_cmd_insert_select, and Sql_cmd_select.
|
inline |
|
pure virtual |
Execute this SQL statement.
thd | the current thread. |
Implemented in Sql_cmd_create_tablespace, Sql_cmd_drop_tablespace, Sql_cmd_alter_tablespace_add_datafile, Sql_cmd_alter_tablespace_drop_datafile, Sql_cmd_alter_tablespace_rename, Sql_cmd_create_undo_tablespace, Sql_cmd_alter_undo_tablespace, Sql_cmd_drop_undo_tablespace, Sql_cmd_truncate_table, Sql_cmd_create_trigger, Sql_cmd_drop_trigger, Sql_cmd_explain_other_thread, resourcegroups::Sql_cmd_create_resource_group, resourcegroups::Sql_cmd_alter_resource_group, resourcegroups::Sql_cmd_drop_resource_group, resourcegroups::Sql_cmd_set_resource_group, Sql_cmd_change_repl_filter, Sql_cmd_analyze_table, Sql_cmd_check_table, Sql_cmd_optimize_table, Sql_cmd_repair_table, Sql_cmd_shutdown, Sql_cmd_set_role, Sql_cmd_create_role, Sql_cmd_drop_role, Sql_cmd_grant_roles, Sql_cmd_revoke_roles, Sql_cmd_alter_user_default_role, Sql_cmd_alter_instance, Sql_cmd_clone, Sql_cmd_alter_table, Sql_cmd_discard_import_tablespace, Sql_cmd_secondary_load_unload, Sql_cmd_lock_instance, Sql_cmd_unlock_instance, Sql_cmd_dcl_dummy, Sql_cmd_ddl_dummy, Sql_cmd_create_table, Sql_cmd_create_or_drop_index_base, Sql_cmd_drop_table, Sql_cmd_cache_index, Sql_cmd_load_index, Sql_cmd_dml, Sql_cmd_create_srs, Sql_cmd_drop_srs, Sql_cmd_install_component, Sql_cmd_uninstall_component, Sql_cmd_get_diagnostics, Sql_cmd_handler_open, Sql_cmd_handler_read, Sql_cmd_handler_close, Sql_cmd_import_table, Sql_cmd_load_table, Sql_cmd_alter_table_exchange_partition, Sql_cmd_alter_table_analyze_partition, Sql_cmd_alter_table_check_partition, Sql_cmd_alter_table_optimize_partition, Sql_cmd_alter_table_repair_partition, Sql_cmd_alter_table_truncate_partition, Sql_cmd_install_plugin, Sql_cmd_uninstall_plugin, Sql_cmd_restart_server, Sql_cmd_create_server, Sql_cmd_alter_server, Sql_cmd_drop_server, Sql_cmd_show, Sql_cmd_show_noplan, Sql_cmd_show_status, Sql_cmd_signal, Sql_cmd_resignal, Sql_cmd_alter_tablespace, Sql_cmd_logfile_group, Sql_cmd_xa_commit, Sql_cmd_xa_end, Sql_cmd_xa_prepare, Sql_cmd_xa_recover, Sql_cmd_xa_rollback, and Sql_cmd_xa_start.
|
inlinevirtual |
Reimplemented in Sql_cmd_load_table.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented in Sql_cmd_dml, Sql_cmd_delete, Sql_cmd_insert_values, and Sql_cmd_update.
|
inline |
|
private |
|
inline |
Get the owning prepared statement.
|
inlinevirtual |
Prepare this SQL statement.
param thd the current thread
Reimplemented in resourcegroups::Sql_cmd_set_resource_group, Sql_cmd_create_table, and Sql_cmd_dml.
|
inline |
Get the handlerton of the secondary engine that is used for executing this statement, or nullptr if a secondary engine is not used.
|
inline |
Has use of secondary storage engines been disabled for this statement?
|
inline |
Mark statement as part of procedure.
Such statements can be executed multiple times, the first execute() call will also prepare it.
|
inline |
|
inline |
Set the owning prepared statement.
|
inlineprotected |
Set this statement as prepared.
|
inlinevirtual |
Reimplemented in Sql_cmd_dcl, Sql_cmd_ddl, and Sql_cmd_dml.
|
pure virtual |
Return the command code for this statement.
Implemented in Sql_cmd_common_alter_table, Sql_cmd_tablespace, Sql_cmd_create_trigger, Sql_cmd_drop_trigger, Sql_cmd_explain_other_thread, resourcegroups::Sql_cmd_create_resource_group, resourcegroups::Sql_cmd_alter_resource_group, resourcegroups::Sql_cmd_drop_resource_group, resourcegroups::Sql_cmd_set_resource_group, Sql_cmd_change_repl_filter, Sql_cmd_analyze_table, Sql_cmd_check_table, Sql_cmd_optimize_table, Sql_cmd_repair_table, Sql_cmd_shutdown, Sql_cmd_set_role, Sql_cmd_create_role, Sql_cmd_drop_role, Sql_cmd_grant_roles, Sql_cmd_revoke_roles, Sql_cmd_alter_user_default_role, Sql_cmd_alter_instance, Sql_cmd_clone, Sql_cmd_lock_instance, Sql_cmd_unlock_instance, Sql_cmd_call, Sql_cmd_dcl_dummy, Sql_cmd_ddl_dummy, Sql_cmd_create_table, Sql_cmd_create_index, Sql_cmd_drop_table, Sql_cmd_drop_index, Sql_cmd_cache_index, Sql_cmd_load_index, Sql_cmd_create_srs, Sql_cmd_drop_srs, Sql_cmd_install_component, Sql_cmd_uninstall_component, Sql_cmd_delete, Sql_cmd_do, Sql_cmd_get_diagnostics, Sql_cmd_handler_open, Sql_cmd_handler_read, Sql_cmd_handler_close, Sql_cmd_import_table, Sql_cmd_insert_values, Sql_cmd_insert_select, Sql_cmd_load_table, Sql_cmd_alter_table_analyze_partition, Sql_cmd_alter_table_check_partition, Sql_cmd_alter_table_optimize_partition, Sql_cmd_alter_table_repair_partition, Sql_cmd_alter_table_truncate_partition, Sql_cmd_install_plugin, Sql_cmd_uninstall_plugin, Sql_cmd_restart_server, Sql_cmd_select, Sql_cmd_create_server, Sql_cmd_alter_server, Sql_cmd_drop_server, Sql_cmd_show, Sql_cmd_signal, Sql_cmd_resignal, Sql_cmd_create_undo_tablespace, Sql_cmd_alter_undo_tablespace, Sql_cmd_drop_undo_tablespace, Sql_cmd_logfile_group, Sql_cmd_truncate_table, Sql_cmd_update, Sql_cmd_xa_commit, Sql_cmd_xa_end, Sql_cmd_xa_prepare, Sql_cmd_xa_recover, Sql_cmd_xa_rollback, and Sql_cmd_xa_start.
|
inline |
Mark the current statement as using a secondary storage engine.
This function must be called before the statement starts opening tables in a secondary engine.
|
inline |
Is this statement using a secondary storage engine?
|
private |
|
private |
Owning prepared statement, NULL if non-prep.
|
private |
True when statement is part of stored proc.
|
private |
Keeps track of whether the statement was prepared optional transformation.
|
private |
The secondary storage engine to use for execution of this statement, if any, or nullptr if the primary engine is used.
This property is reset at the start of each execution.
|
private |
True when statement has been prepared.
Tells if a secondary storage engine can be used for this statement. If it is false, use of a secondary storage engine will not be considered for executing this statement.