MySQL 8.0.37
Source Code Documentation
SubqueryWithResult Class Reference

#include <item_subselect.h>

Public Member Functions

 SubqueryWithResult (Query_expression *u, Query_result_interceptor *res, Item_subselect *si)
 
void cleanup ()
 Cleanup subquery after complete query execution, free all resources. More...
 
bool prepare (THD *thd)
 Prepare the query expression underlying the subquery. More...
 
void fix_length_and_dec (Item_cache **row)
 
bool exec (THD *thd)
 Execute the subquery. More...
 
void print (const THD *thd, String *str, enum_query_type query_type)
 
bool change_query_result (THD *thd, Item_subselect *si, Query_result_subquery *result)
 change query result object of subquery. More...
 
Query_blocksingle_query_block () const
 
enum Item_result type () const
 
enum_field_types field_type () const
 
bool may_be_null () const
 
const Item_subselectget_item () const
 

Private Member Functions

void set_row (const mem_root_deque< Item * > &item_list, Item_cache **row, bool never_empty)
 Makes storage for the output values for a scalar or row subquery and calculates their data and column types and their nullability. More...
 

Private Attributes

Query_result_interceptorresult
 
Item_subselectitem
 
enum Item_result res_type
 
enum_field_types res_field_type
 
bool maybe_null
 True if at least one of the columns returned by the subquery may be null, or if a single-row subquery may return zero rows. More...
 
Query_expressionunit
 

Friends

class subselect_hash_sj_engine
 

Constructor & Destructor Documentation

◆ SubqueryWithResult()

SubqueryWithResult::SubqueryWithResult ( Query_expression u,
Query_result_interceptor res,
Item_subselect si 
)

Member Function Documentation

◆ change_query_result()

bool SubqueryWithResult::change_query_result ( THD thd,
Item_subselect si,
Query_result_subquery res 
)

change query result object of subquery.

Parameters
thdthread handle
sinew subselect Item
resnew Query_result object
Return values
falseOK
trueerror

◆ cleanup()

void SubqueryWithResult::cleanup ( )

Cleanup subquery after complete query execution, free all resources.

◆ exec()

bool SubqueryWithResult::exec ( THD thd)

Execute the subquery.

SYNOPSIS exec()

DESCRIPTION Execute the subquery. The result of execution is subquery value that is captured by previously set up Query_result-based 'sink'.

RETURN false - OK true - Execution error.

◆ field_type()

enum_field_types SubqueryWithResult::field_type ( ) const
inline

◆ fix_length_and_dec()

void SubqueryWithResult::fix_length_and_dec ( Item_cache **  row)

◆ get_item()

const Item_subselect * SubqueryWithResult::get_item ( ) const
inline
Returns
the internal Item. Defined only in debug builds, because should be used only for debug asserts.

◆ may_be_null()

bool SubqueryWithResult::may_be_null ( ) const
inline

◆ prepare()

bool SubqueryWithResult::prepare ( THD thd)

Prepare the query expression underlying the subquery.

This function is called from Item_subselect::fix_fields. If the subquery is transformed with an Item_in_optimizer object, this function may be called twice, hence we need the check on 'is_prepared()' at the start, to avoid redoing the preparation.

Returns
false if success, true if error

◆ print()

void SubqueryWithResult::print ( const THD thd,
String str,
enum_query_type  query_type 
)

◆ set_row()

void SubqueryWithResult::set_row ( const mem_root_deque< Item * > &  item_list,
Item_cache **  row,
bool  possibly_empty 
)
private

Makes storage for the output values for a scalar or row subquery and calculates their data and column types and their nullability.

Parameters
item_listlist of items in the select list of the subquery
rowcache objects to hold the result row of the subquery
possibly_emptytrue if the subquery could return empty result

◆ single_query_block()

Query_block * SubqueryWithResult::single_query_block ( ) const

◆ type()

enum Item_result SubqueryWithResult::type ( ) const
inline

Friends And Related Function Documentation

◆ subselect_hash_sj_engine

friend class subselect_hash_sj_engine
friend

Member Data Documentation

◆ item

Item_subselect* SubqueryWithResult::item
private

◆ maybe_null

bool SubqueryWithResult::maybe_null
private

True if at least one of the columns returned by the subquery may be null, or if a single-row subquery may return zero rows.

◆ res_field_type

enum_field_types SubqueryWithResult::res_field_type
private

◆ res_type

enum Item_result SubqueryWithResult::res_type
private

◆ result

Query_result_interceptor* SubqueryWithResult::result
private

◆ unit

Query_expression* SubqueryWithResult::unit
private

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