MySQL 8.4.3
Source Code Documentation
Query_result_update Class Referencefinal

#include <sql_update.h>

Inheritance diagram for Query_result_update:
[legend]

Public Member Functions

 Query_result_update (mem_root_deque< Item * > *field_list, mem_root_deque< Item * > *value_list)
 
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 optimize ()
 Set up data structures for multi-table UPDATE. More...
 
bool start_execution (THD *thd) override
 Prepare for execution of the query expression or DML statement. More...
 
bool send_data (THD *thd, const mem_root_deque< Item * > &items) override
 
bool do_updates (THD *thd)
 
bool send_eof (THD *thd) override
 
void cleanup () override
 Cleanup after this execution. More...
 
unique_ptr_destroy_only< RowIteratorcreate_iterator (THD *thd, MEM_ROOT *mem_root, unique_ptr_destroy_only< RowIterator > source)
 
- 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 void abort_result_set (THD *)
 
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_cursorcursor () const
 

Private Attributes

uint update_table_count {0}
 Number of tables being updated. More...
 
Table_refupdate_tables {nullptr}
 Pointer to list of updated tables, linked via 'next_local'. More...
 
TABLE ** tmp_tables {nullptr}
 Array of references to temporary tables used to store cached updates. More...
 
Temp_table_paramtmp_table_param {nullptr}
 Array of parameter structs for creation of temporary tables. More...
 
TABLEmain_table {nullptr}
 The first table in the join operation. More...
 
TABLEtable_to_update {nullptr}
 In a multi-table update, this is equal to the first table in the join operation (main_table) if that table can be updated on the fly while scanning it. More...
 
const mem_root_deque< Item * > * fields
 List of pointers to fields to update, in order from statement. More...
 
const mem_root_deque< Item * > * values
 List of pointers to values to update with, in order from statement. More...
 
mem_root_deque< Item * > ** fields_for_table
 The fields list decomposed into separate lists per table. More...
 
mem_root_deque< Item * > ** values_for_table
 The values list decomposed into separate lists per table. More...
 
List< TABLEunupdated_check_opt_tables
 List of tables referenced in the CHECK OPTION condition of the updated view excluding the updated table. More...
 
Copy_fieldcopy_field {nullptr}
 ??? More...
 
COPY_INFO ** update_operations {nullptr}
 Array of update operations, arranged per updated table. More...
 

Additional Inherited Members

- 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 inherited from Query_result
Query_expressionunit
 

Constructor & Destructor Documentation

◆ Query_result_update()

Query_result_update::Query_result_update ( mem_root_deque< Item * > *  field_list,
mem_root_deque< Item * > *  value_list 
)
inline

Member Function Documentation

◆ cleanup()

void Query_result_update::cleanup ( void  )
overridevirtual

Cleanup after this execution.

Completes the execution and resets object before next execution of a prepared statement/stored procedure.

Reimplemented from Query_result.

◆ create_iterator()

unique_ptr_destroy_only< RowIterator > Query_result_update::create_iterator ( THD thd,
MEM_ROOT mem_root,
unique_ptr_destroy_only< RowIterator source 
)

◆ do_updates()

bool Query_result_update::do_updates ( THD thd)

◆ need_explain_interceptor()

bool Query_result_update::need_explain_interceptor ( ) const
inlineoverridevirtual
Returns
true if an interceptor object is needed for EXPLAIN

Reimplemented from Query_result.

◆ optimize()

bool Query_result_update::optimize ( )

Set up data structures for multi-table UPDATE.

IMPLEMENTATION

  • Update first table in join on the fly, if possible
  • Create temporary tables to store changed values for all other tables that are updated (and main_table if the above doesn't hold).

◆ prepare()

bool Query_result_update::prepare ( THD ,
const mem_root_deque< Item * > &  ,
Query_expression u 
)
overridevirtual

Perform preparation specific to the query expression or DML statement.

Returns
false if success, true if error

Reimplemented from Query_result.

◆ send_data()

bool Query_result_update::send_data ( THD thd,
const mem_root_deque< Item * > &  items 
)
overridevirtual

Implements Query_result.

◆ send_eof()

bool Query_result_update::send_eof ( THD thd)
overridevirtual

Implements Query_result.

◆ start_execution()

bool Query_result_update::start_execution ( THD )
overridevirtual

Prepare for execution of the query expression or DML statement.

Generally, this will have an implementation only for outer-most Query_block objects, such as data change statements (for preparation of the target table(s)) or dump statements (for preparation of target file).

Returns
false if success, true if error

Reimplemented from Query_result.

Member Data Documentation

◆ copy_field

Copy_field* Query_result_update::copy_field {nullptr}
private

???

◆ fields

const mem_root_deque<Item *>* Query_result_update::fields
private

List of pointers to fields to update, in order from statement.

◆ fields_for_table

mem_root_deque<Item *>** Query_result_update::fields_for_table
private

The fields list decomposed into separate lists per table.

◆ main_table

TABLE* Query_result_update::main_table {nullptr}
private

The first table in the join operation.

◆ table_to_update

TABLE* Query_result_update::table_to_update {nullptr}
private

In a multi-table update, this is equal to the first table in the join operation (main_table) if that table can be updated on the fly while scanning it.

It is nullptr otherwise.

See also
safe_update_on_fly

◆ tmp_table_param

Temp_table_param* Query_result_update::tmp_table_param {nullptr}
private

Array of parameter structs for creation of temporary tables.

◆ tmp_tables

TABLE** Query_result_update::tmp_tables {nullptr}
private

Array of references to temporary tables used to store cached updates.

◆ unupdated_check_opt_tables

List<TABLE> Query_result_update::unupdated_check_opt_tables
private

List of tables referenced in the CHECK OPTION condition of the updated view excluding the updated table.

◆ update_operations

COPY_INFO** Query_result_update::update_operations {nullptr}
private

Array of update operations, arranged per updated table.

For each updated table in the multiple table update statement, a COPY_INFO pointer is present at the table's position in this array.

The array is allocated and populated during Query_result_update::prepare(). The position that each table is assigned is also given here and is stored in the member TABLE::pos_in_table_list::shared. However, this is a publicly available field, so nothing can be trusted about its integrity.

This member is NULL when the Query_result_update is created.

See also
Query_result_update::prepare

◆ update_table_count

uint Query_result_update::update_table_count {0}
private

Number of tables being updated.

◆ update_tables

Table_ref* Query_result_update::update_tables {nullptr}
private

Pointer to list of updated tables, linked via 'next_local'.

◆ values

const mem_root_deque<Item *>* Query_result_update::values
private

List of pointers to values to update with, in order from statement.

◆ values_for_table

mem_root_deque<Item *>** Query_result_update::values_for_table
private

The values list decomposed into separate lists per table.


The documentation for this class was generated from the following files: