MySQL 8.0.39
Source Code Documentation
Query_result_explain Class Referencefinal

EXPLAIN functionality for Query_result_insert, Query_result_update and Query_result_delete. More...

#include <opt_explain.h>

Inheritance diagram for Query_result_explain:
[legend]

Public Member Functions

 Query_result_explain (Query_expression *unit_arg, Query_result *interceptor_arg)
 
- Public Member Functions inherited from Query_result_send
 Query_result_send ()
 
bool send_result_set_metadata (THD *thd, const mem_root_deque< Item * > &list, uint flags) override
 
bool send_data (THD *thd, const mem_root_deque< Item * > &items) override
 
bool send_eof (THD *thd) override
 
bool check_supports_cursor () const override
 Check if this query result set supports cursors. More...
 
void abort_result_set (THD *thd) override
 
void cleanup () override
 Cleanup after this execution. More...
 
- 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 need_explain_interceptor () const
 
virtual bool create_table_for_query_block (THD *)
 Create table, only needed to support CREATE TABLE ... SELECT. More...
 
virtual uint field_count (const mem_root_deque< Item * > &fields) const
 
virtual bool reset ()
 Cleanup after one execution of the unit, to be ready for a next execution inside the same statement. More...
 
virtual bool is_interceptor () const
 Checks if this Query_result intercepts and transforms the result set. More...
 
virtual void set_limit (ha_rows)
 Only overridden (and non-empty) for Query_result_union, q.v. More...
 
virtual Server_side_cursorcursor () const
 

Protected Member Functions

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
 Prepare for execution of the query expression or DML statement. More...
 
void cleanup () override
 Cleanup after this execution. More...
 

Protected Attributes

Query_resultinterceptor
 Pointer to underlying Query_result_insert, Query_result_update or Query_result_delete object. More...
 
- Protected Attributes inherited from Query_result
Query_expressionunit
 

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...
 

Detailed Description

EXPLAIN functionality for Query_result_insert, Query_result_update and Query_result_delete.

This class objects substitute Query_result_insert, Query_result_update and Query_result_delete data interceptor objects to implement EXPLAIN for INSERT, REPLACE and multi-table UPDATE and DELETE queries. Query_result_explain class object initializes tables like Query_result_insert, Query_result_update or Query_result_delete data interceptor do, but it suppresses table data modification by the underlying interceptor object. Thus, we can use Query_result_explain object in the context of EXPLAIN INSERT/ REPLACE/UPDATE/DELETE query like we use Query_result_send in the context of EXPLAIN SELECT command: 1) in presence of lex->describe flag, pass Query_result_explain object to execution function, 2) it calls prepare(), optimize() and start_execution() functions to mark modified tables etc.

Constructor & Destructor Documentation

◆ Query_result_explain()

Query_result_explain::Query_result_explain ( Query_expression unit_arg,
Query_result interceptor_arg 
)
inline

Member Function Documentation

◆ cleanup()

void Query_result_explain::cleanup ( )
inlineoverrideprotectedvirtual

Cleanup after this execution.

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

Reimplemented from Query_result.

◆ prepare()

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

Perform preparation specific to the query expression or DML statement.

Returns
false if success, true if error

Reimplemented from Query_result.

◆ start_execution()

bool Query_result_explain::start_execution ( THD )
inlineoverrideprotectedvirtual

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

◆ interceptor

Query_result* Query_result_explain::interceptor
protected

Pointer to underlying Query_result_insert, Query_result_update or Query_result_delete object.


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