MySQL 8.4.2
Source Code Documentation
|
#include <sql_insert.h>
Public Member Functions | |
Query_result_insert (Table_ref *table_list_par, mem_root_deque< Item * > *target_columns, mem_root_deque< Item * > *target_or_source_columns, mem_root_deque< Item * > *update_fields, mem_root_deque< Item * > *update_values, enum_duplicates duplic) | |
bool | need_explain_interceptor () const override |
bool | prepare (THD *thd, const mem_root_deque< Item * > &list, Query_expression *u) override |
Perform preparation specific to the query expression or DML statement. More... | |
bool | start_execution (THD *thd) override |
Set up the target table for execution. More... | |
bool | send_data (THD *thd, const mem_root_deque< Item * > &items) override |
virtual void | store_values (THD *thd, const mem_root_deque< Item * > &values) |
bool | send_eof (THD *thd) override |
void | abort_result_set (THD *thd) override |
void | cleanup () override |
Cleanup after this execution. More... | |
Public Member Functions inherited from Query_result_interceptor | |
Query_result_interceptor () | |
uint | field_count (const mem_root_deque< Item * > &) const override |
bool | send_result_set_metadata (THD *, const mem_root_deque< Item * > &, uint) override |
Public Member Functions inherited from Query_result | |
Query_result () | |
virtual | ~Query_result ()=default |
virtual bool | needs_file_privilege () const |
virtual bool | change_query_result (THD *, Query_result *) |
Change wrapped Query_result. More... | |
virtual bool | create_table_for_query_block (THD *) |
Create table, only needed to support CREATE TABLE ... SELECT. More... | |
virtual bool | check_supports_cursor () const |
Check if this query result set supports cursors. More... | |
virtual bool | reset () |
Cleanup after one execution of the unit, to be ready for a next execution inside the same statement. More... | |
virtual bool | use_protocol_adapter () const |
virtual bool | use_protocol_wrapper () const |
virtual void | set_limit (ha_rows) |
Only overridden (and non-empty) for Query_result_union, q.v. More... | |
virtual Server_side_cursor * | cursor () const |
Public Attributes | |
Table_ref * | table_list |
The table used for insertion of rows. More... | |
TABLE * | table {nullptr} |
ulonglong | autoinc_value_of_last_inserted_row {0} |
COPY_INFO | info |
COPY_INFO | update |
the UPDATE part of "info" More... | |
bool | insert_into_view |
Public Attributes inherited from Query_result | |
ha_rows | estimated_rowcount |
Number of records estimated in this result. More... | |
double | estimated_cost |
Cost to execute the subquery which produces this result. More... | |
Protected Attributes | |
bool | bulk_insert_started {false} |
ha_start_bulk_insert has been called. Never cleared. More... | |
Protected Attributes inherited from Query_result | |
Query_expression * | unit |
Private Member Functions | |
virtual bool | stmt_binlog_is_trans () const |
Indicates whether this statement should be written to binary log's transactional cache in statement mode. More... | |
Private Attributes | |
mem_root_deque< Item * > * | fields |
The columns of the table to be inserted into, or the columns of the table from which values are selected. More... | |
|
inline |
Creates a Query_result_insert for routing a result set to an existing table. @param table_list_par The table reference for the destination table. @param target_columns See details. @param target_or_source_columns See details. @param update_fields The columns to be updated in case of duplicate keys. May be NULL. @param update_values The values to be assigned in case of duplicate keys. May be NULL. @param duplic The policy for handling duplicates. @todo This constructor takes 8 arguments, 6 of which are used to immediately construct a COPY_INFO object. Obviously the constructor should take the COPY_INFO object as argument instead. Also, some Query_result_insert members initialized here are totally redundant, as they
are found inside the COPY_INFO.
The target_columns and target_or_source_columns arguments are set by callers as follows: @li if CREATE SELECT: - target_columns == NULL, - target_or_source_columns == expressions listed after SELECT, as in CREATE ... SELECT expressions @li if INSERT SELECT: target_columns == target_or_source_columns == columns listed between INSERT and SELECT, as in INSERT INTO t (columns) SELECT ... We set the manage_defaults argument of info's constructor as follows ([...] denotes something optional): @li If target_columns==NULL, the statement is
CREATE TABLE a_table [(columns1)] SELECT expressions2
so 'info' must manage defaults of columns1.
INSERT INTO a_table [(columns1)] SELECT ...target_columns is columns1, if not empty then 'info' must manage defaults of other columns than columns1.
|
overridevirtual |
Reimplemented from Query_result.
Reimplemented in Query_result_create.
|
overridevirtual |
Cleanup after this execution.
Completes the execution and resets object before next execution of a prepared statement/stored procedure.
Reimplemented from Query_result.
|
inlineoverridevirtual |
Reimplemented from Query_result.
|
overridevirtual |
Perform preparation specific to the query expression or DML statement.
Reimplemented from Query_result.
Reimplemented in Query_result_create.
|
overridevirtual |
Implements Query_result.
|
overridevirtual |
Implements Query_result.
Reimplemented in Query_result_create.
|
overridevirtual |
Set up the target table for execution.
If the target table is the same as one of the source tables (INSERT SELECT), the target table is not finally set up in the join optimization phase. Do the final setup now.
Reimplemented from Query_result.
Reimplemented in Query_result_create.
|
privatevirtual |
Indicates whether this statement should be written to binary log's transactional cache in statement mode.
Reimplemented in Query_result_create.
|
virtual |
Reimplemented in Query_result_create.
ulonglong Query_result_insert::autoinc_value_of_last_inserted_row {0} |
|
protected |
ha_start_bulk_insert has been called. Never cleared.
|
private |
The columns of the table to be inserted into, or the columns of the table from which values are selected.
For legacy reasons both are allowed.
COPY_INFO Query_result_insert::info |
bool Query_result_insert::insert_into_view |
Table_ref* Query_result_insert::table_list |
The table used for insertion of rows.
COPY_INFO Query_result_insert::update |
the UPDATE part of "info"