MySQL 8.4.2
Source Code Documentation
Query_result_max_min_subquery Class Referencefinal
Inheritance diagram for Query_result_max_min_subquery:
[legend]

Public Member Functions

 Query_result_max_min_subquery (Item_subselect *item_arg, bool mx, bool ignore_nulls)
 
void cleanup () override
 Cleanup after this execution. More...
 
bool send_data (THD *thd, const mem_root_deque< Item * > &items) override
 
- Public Member Functions inherited from Query_result_subquery
 Query_result_subquery (Item_subselect *item_arg)
 
bool send_eof (THD *) override
 
- Public Member Functions inherited from Query_result_interceptor
 Query_result_interceptor ()
 
uint field_count (const mem_root_deque< Item * > &) const override
 
bool send_result_set_metadata (THD *, const mem_root_deque< Item * > &, uint) override
 
- 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 prepare (THD *, const mem_root_deque< Item * > &, Query_expression *u)
 Perform preparation specific to the query expression or DML statement. 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 bool check_supports_cursor () const
 Check if this query result set supports cursors. 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 bool use_protocol_adapter () const
 
virtual bool use_protocol_wrapper () const
 
virtual void set_limit (ha_rows)
 Only overridden (and non-empty) for Query_result_union, q.v. More...
 
virtual Server_side_cursorcursor () const
 

Private Member Functions

bool cmp_real ()
 Compare two floating point numbers for MAX or MIN. More...
 
bool cmp_int ()
 Compare two integer numbers for MAX or MIN. More...
 
bool cmp_decimal ()
 Compare two decimal numbers for MAX or MIN. More...
 
bool cmp_str ()
 Compare two strings for MAX or MIN. More...
 

Private Attributes

Item_cachecache
 
bool(Query_result_max_min_subquery::* op )()
 
bool fmax
 
bool ignore_nulls
 If ignoring NULLs, comparisons will skip NULL values. More...
 

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...
 
- Protected Attributes inherited from Query_result_subquery
Item_subselectitem
 
- Protected Attributes inherited from Query_result
Query_expressionunit
 

Constructor & Destructor Documentation

◆ Query_result_max_min_subquery()

Query_result_max_min_subquery::Query_result_max_min_subquery ( Item_subselect item_arg,
bool  mx,
bool  ignore_nulls 
)
inline

Member Function Documentation

◆ cleanup()

void Query_result_max_min_subquery::cleanup ( )
overridevirtual

Cleanup after this execution.

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

Reimplemented from Query_result.

◆ cmp_decimal()

bool Query_result_max_min_subquery::cmp_decimal ( )
private

Compare two decimal numbers for MAX or MIN.

See also
Query_result_max_min_subquery::cmp_real()

◆ cmp_int()

bool Query_result_max_min_subquery::cmp_int ( )
private

Compare two integer numbers for MAX or MIN.

See also
Query_result_max_min_subquery::cmp_real()

◆ cmp_real()

bool Query_result_max_min_subquery::cmp_real ( )
private

Compare two floating point numbers for MAX or MIN.

Compare two numbers and decide if the number should be cached as the maximum/minimum number seen this far. If fmax==true, this is a comparison for MAX, otherwise it is a comparison for MIN.

val1 is the new number to compare against the current maximum/minimum. val2 is the current maximum/minimum.

ignore_nulls is used to control behavior when comparing with a NULL value. If ignore_nulls==false, the behavior is to store the first NULL value discovered (i.e, return true, that it is larger than the current maximum) and never replace it. If ignore_nulls==true, NULL values are not stored. ANY subqueries use ignore_nulls==true, ALL subqueries use ignore_nulls==false.

Return values
trueif the new number should be the new maximum/minimum.
falseif the maximum/minimum should stay unchanged.

◆ cmp_str()

bool Query_result_max_min_subquery::cmp_str ( )
private

Compare two strings for MAX or MIN.

See also
Query_result_max_min_subquery::cmp_real()

◆ send_data()

bool Query_result_max_min_subquery::send_data ( THD thd,
const mem_root_deque< Item * > &  items 
)
overridevirtual

Implements Query_result_subquery.

Member Data Documentation

◆ cache

Item_cache* Query_result_max_min_subquery::cache
private

◆ fmax

bool Query_result_max_min_subquery::fmax
private

◆ ignore_nulls

bool Query_result_max_min_subquery::ignore_nulls
private

If ignoring NULLs, comparisons will skip NULL values.

If not ignoring NULLs, the first (if any) NULL value discovered will be returned as the maximum/minimum value.

◆ op

bool(Query_result_max_min_subquery::* Query_result_max_min_subquery::op) ()
private

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