MySQL  8.0.21
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:
Query_result_send Query_result

Public Member Functions

 Query_result_explain (SELECT_LEX_UNIT *unit_arg, Query_result *interceptor_arg)
 
- Public Member Functions inherited from Query_result_send
 Query_result_send ()
 
bool send_result_set_metadata (THD *thd, List< Item > &list, uint flags) override
 
bool send_data (THD *thd, List< Item > &items) override
 
bool send_eof (THD *thd) override
 
bool check_simple_select () const override
 Check if this query returns a result set and therefore is allowed in cursors and set an error message if it is not the case. More...
 
void abort_result_set (THD *thd) override
 
void cleanup (THD *) override
 Cleanup after this execution. More...
 
- Public Member Functions inherited from Query_result
 Query_result ()
 
virtual ~Query_result ()
 
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 uint field_count (List< Item > &fields) const
 
virtual void send_error (THD *, uint errcode, const char *err)
 
virtual bool reset ()
 Cleanup after one execution of the unit, to be ready for a next execution inside the same statement. More...
 
void begin_dataset ()
 
virtual const ha_rowsrow_count () const
 
virtual bool is_interceptor () const
 Checks if this Query_result intercepts and transforms the result set. More...
 
virtual bool immediate_update (TABLE_LIST *t) const
 If this Query_result performs modifications to tables: tells if it modifies the given table's row as it's read (a.k.a. More...
 

Protected Member Functions

bool prepare (THD *thd, List< Item > &list, SELECT_LEX_UNIT *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...
 
bool optimize () override
 Optimize the result processing of a query expression, applicable to data change operation (not simple select queries). More...
 
void cleanup (THD *thd) 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
SELECT_LEX_UNITunit
 

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 ( SELECT_LEX_UNIT unit_arg,
Query_result interceptor_arg 
)
inline

Member Function Documentation

◆ cleanup()

void Query_result_explain::cleanup ( THD )
inlineoverrideprotectedvirtual

Cleanup after this execution.

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

Reimplemented from Query_result.

◆ optimize()

bool Query_result_explain::optimize ( )
inlineoverrideprotectedvirtual

Optimize the result processing of a query expression, applicable to data change operation (not simple select queries).

Returns
false if success, true if error

Reimplemented from Query_result.

◆ prepare()

bool Query_result_explain::prepare ( THD ,
List< Item > &  ,
SELECT_LEX_UNIT 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 SELECT_LEX 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: