MySQL  8.0.28
Source Code Documentation
Query_result Class Referenceabstract

#include <query_result.h>

Inheritance diagram for Query_result:
Query_result_do Query_result_interceptor Query_result_send Query_dumpvar Query_result_insert Query_result_null Query_result_subquery Query_result_to_file Query_result_union Query_result_update anonymous_namespace{sql_delete.cc}::Query_result_delete sp_cursor::Query_fetch_into_spvars Query_result_explain anonymous_namespace{sql_prepare.cc}::Query_fetch_protocol_binary

Public Member Functions

 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 prepare (THD *, const mem_root_deque< Item * > &, Query_expression *u)
 Perform preparation specific to the query expression or DML statement. More...
 
virtual bool optimize ()
 Optimize the result processing of a query expression, applicable to data change operation (not simple select queries). More...
 
virtual bool start_execution (THD *)
 Prepare for execution of the query expression or DML statement. More...
 
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 send_result_set_metadata (THD *thd, const mem_root_deque< Item * > &list, uint flags)=0
 
virtual bool send_data (THD *thd, const mem_root_deque< Item * > &items)=0
 
virtual void send_error (THD *, uint errcode, const char *err)
 
virtual bool send_eof (THD *thd)=0
 
virtual bool check_simple_query_block () const
 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...
 
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 void cleanup (THD *)
 Cleanup after this execution. 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[[maybe_unused]]) 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...
 

Public Attributes

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

Query_expressionunit
 

Constructor & Destructor Documentation

◆ Query_result()

Query_result::Query_result ( )
inline

◆ ~Query_result()

virtual Query_result::~Query_result ( )
virtualdefault

Member Function Documentation

◆ abort_result_set()

◆ begin_dataset()

void Query_result::begin_dataset ( )
inline

◆ change_query_result()

virtual bool Query_result::change_query_result ( THD ,
Query_result  
)
inlinevirtual

Change wrapped Query_result.

Replace the wrapped query result object with new_result and call prepare() on new_result.

This base class implementation doesn't wrap other Query_results.

Return values
falseSuccess
trueError

Reimplemented in Query_result_union_direct.

◆ check_simple_query_block()

virtual bool Query_result::check_simple_query_block ( ) const
inlinevirtual

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.

Return values
falsesuccess
trueerror, an error message is set

Reimplemented in Query_result_union_direct, Query_result_do, Query_result_materialize, Query_dumpvar, and Query_result_send.

◆ cleanup()

virtual void Query_result::cleanup ( THD )
inlinevirtual

◆ create_table_for_query_block()

virtual bool Query_result::create_table_for_query_block ( THD )
inlinevirtual

Create table, only needed to support CREATE TABLE ... SELECT.

Reimplemented in Query_result_create.

◆ field_count()

uint Query_result::field_count ( const mem_root_deque< Item * > &  fields) const
virtual

◆ immediate_update()

virtual bool Query_result::immediate_update ( TABLE_LIST *t]  [[maybe_unused]) const
inlinevirtual

If this Query_result performs modifications to tables: tells if it modifies the given table's row as it's read (a.k.a.

"on the fly"), or rather buffers it to a temporary structure and modifies it in a post-all-reads phase.

Parameters
tTABLE to answer for
Returns
true if "on the fly"

◆ is_interceptor()

virtual bool Query_result::is_interceptor ( ) const
inlinevirtual

Checks if this Query_result intercepts and transforms the result set.

Returns
true if it is an interceptor, false otherwise

Reimplemented in Query_result_interceptor.

◆ need_explain_interceptor()

virtual bool Query_result::need_explain_interceptor ( ) const
inlinevirtual
Returns
true if an interceptor object is needed for EXPLAIN

Reimplemented in Query_result_update, Query_result_insert, and anonymous_namespace{sql_delete.cc}::Query_result_delete.

◆ needs_file_privilege()

virtual bool Query_result::needs_file_privilege ( ) const
inlinevirtual

Reimplemented in Query_result_to_file.

◆ optimize()

virtual bool Query_result::optimize ( )
inlinevirtual

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 in Query_result_update, Query_result_union_direct, anonymous_namespace{sql_delete.cc}::Query_result_delete, and Query_result_explain.

◆ prepare()

virtual bool Query_result::prepare ( THD ,
const mem_root_deque< Item * > &  ,
Query_expression u 
)
inlinevirtual

◆ reset()

virtual bool Query_result::reset ( void  )
inlinevirtual

Cleanup after one execution of the unit, to be ready for a next execution inside the same statement.

Returns
true if error

Reimplemented in Query_result_union.

◆ row_count()

virtual const ha_rows* Query_result::row_count ( ) const
inlinevirtual
Returns
Pointer to count of rows retained by this result.

Reimplemented in Query_result_union.

◆ send_data()

◆ send_eof()

◆ send_error()

virtual void Query_result::send_error ( THD ,
uint  errcode,
const char *  err 
)
inlinevirtual

◆ send_result_set_metadata()

virtual bool Query_result::send_result_set_metadata ( THD thd,
const mem_root_deque< Item * > &  list,
uint  flags 
)
pure virtual

◆ start_execution()

virtual bool Query_result::start_execution ( THD )
inlinevirtual

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 in Query_result_update, Query_result_union_direct, Query_result_create, Query_result_insert, Query_result_materialize, Query_result_dump, Query_result_export, Query_result_explain, and anonymous_namespace{sql_delete.cc}::Query_result_delete.

Member Data Documentation

◆ estimated_cost

double Query_result::estimated_cost

Cost to execute the subquery which produces this result.

Valid only for materialized derived tables/views.

◆ estimated_rowcount

ha_rows Query_result::estimated_rowcount

Number of records estimated in this result.

Valid only for materialized derived tables/views.

◆ unit

Query_expression* Query_result::unit
protected

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