MySQL  8.0.16
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_delete Query_result_insert Query_result_subquery Query_result_to_file Query_result_union Query_result_update sp_cursor::Query_fetch_into_spvars Query_fetch_protocol_binary Query_result_explain

Public Member Functions

 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 bool prepare (THD *, List< Item > &, SELECT_LEX_UNIT *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 uint field_count (List< Item > &fields) const
 
virtual bool send_result_set_metadata (THD *thd, List< Item > &list, uint flags)=0
 
virtual bool send_data (THD *thd, List< Item > &items)=0
 
virtual void send_error (THD *, uint errcode, const char *err)
 
virtual bool send_eof (THD *thd)=0
 
virtual bool check_simple_select () 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...
 

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

SELECT_LEX_UNITunit
 

Constructor & Destructor Documentation

◆ Query_result()

Query_result::Query_result ( )
inline

◆ ~Query_result()

virtual Query_result::~Query_result ( )
inlinevirtual

Member Function Documentation

◆ abort_result_set()

virtual void Query_result::abort_result_set ( THD )
inlinevirtual

◆ 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_select()

virtual bool Query_result::check_simple_select ( ) 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_dumpvar, Query_result_union_direct, Query_result_send, and Query_result_do.

◆ cleanup()

virtual void Query_result::cleanup ( THD )
inlinevirtual

Cleanup after this execution.

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

Reimplemented in Query_result_max_min_subquery, Query_dumpvar, Query_result_export, Query_result_union_direct, Query_result_to_file, Query_result_send, Query_result_explain, Query_result_insert, Query_result_update, Query_result_delete, Query_result_materialize, Query_result_union, and Query_result_do.

◆ field_count()

virtual uint Query_result::field_count ( List< Item > &  fields) const
inlinevirtual

◆ 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_insert, Query_result_update, and 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_union_direct, Query_result_explain, Query_result_update, and Query_result_delete.

◆ prepare()

virtual bool Query_result::prepare ( THD ,
List< Item > &  ,
SELECT_LEX_UNIT u 
)
inlinevirtual

Perform preparation specific to the query expression or DML statement.

Returns
false if success, true if error

Reimplemented in sp_cursor::Query_fetch_into_spvars, Query_dumpvar, Query_result_dump, Query_result_export, Query_result_create, Query_result_explain, Query_result_insert, Query_result_update, Query_result_delete, and Query_result_union.

◆ 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,
List< 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 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 in Query_result_dump, Query_result_export, Query_result_union_direct, Query_result_create, Query_result_explain, Query_result_insert, Query_result_update, and 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

SELECT_LEX_UNIT* Query_result::unit
protected

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