My Project
|
Public Member Functions | |
virtual enum_sql_command | sql_command_code () const =0 |
Return the command code for this statement. | |
virtual bool | execute (THD *thd)=0 |
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.
virtual bool Sql_cmd::execute | ( | THD * | thd | ) | [pure virtual] |
Execute this SQL statement.
thd | the current thread. |
false | on success. |
true | on error |
Implemented in Sql_cmd_discard_import_tablespace, Sql_cmd_alter_table, Sql_cmd_resignal, Sql_cmd_handler_close, Sql_cmd_repair_table, Sql_cmd_signal, Sql_cmd_optimize_table, Sql_cmd_handler_read, Sql_cmd_check_table, Sql_cmd_get_diagnostics, Sql_cmd_handler_open, Sql_cmd_truncate_table, Sql_cmd_analyze_table, and Sql_cmd_partition_unsupported.