MySQL 9.1.0
Source Code Documentation
ReverseIndexRangeScanIterator Class Reference

An iterator much like IndexRangeScanIterator, but it scans in the reverse order. More...

#include <reverse_index_range_scan.h>

Inheritance diagram for ReverseIndexRangeScanIterator:
[legend]

Public Member Functions

 ReverseIndexRangeScanIterator (THD *thd, TABLE *table, ha_rows *examined_rows, double expected_rows, uint index, MEM_ROOT *return_mem_root, uint mrr_flags, Bounds_checked_array< QUICK_RANGE * > ranges, bool using_extended_key_parts)
 
 ~ReverseIndexRangeScanIterator () override
 
int Read () override
 Read a single row. More...
 
bool Init () override
 Initialize or reinitialize the iterator. More...
 
- Public Member Functions inherited from TableRowIterator
 TableRowIterator (THD *thd, TABLE *table)
 
void UnlockRow () override
 The default implementation of unlock-row method of RowIterator, used in all access methods except EQRefIterator. More...
 
void SetNullRowFlag (bool is_null_row) override
 Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag is true, you'll get only NULLs no matter what is actually in the buffer (typically some old leftover row). More...
 
void StartPSIBatchMode () override
 Start performance schema batch mode, if supported (otherwise ignored). More...
 
void EndPSIBatchModeIfStarted () override
 Ends performance schema batch mode, if started. More...
 
- Public Member Functions inherited from RowIterator
 RowIterator (THD *thd)
 
virtual ~RowIterator ()=default
 
 RowIterator (const RowIterator &)=delete
 
 RowIterator (RowIterator &&)=default
 
virtual const IteratorProfilerGetProfiler () const
 Get profiling data for this iterator (for 'EXPLAIN ANALYZE'). More...
 
virtual void SetOverrideProfiler (const IteratorProfiler *profiler)
 
virtual RowIteratorreal_iterator ()
 If this iterator is wrapping a different iterator (e.g. More...
 
virtual const RowIteratorreal_iterator () const
 

Private Member Functions

bool range_reads_after_key (QUICK_RANGE *range)
 
int cmp_prev (QUICK_RANGE *range)
 

Static Private Member Functions

static range_seq_t quick_range_rev_seq_init (void *init_param, uint, uint)
 

Private Attributes

const uint m_index
 
const double m_expected_rows
 
ha_rowsm_examined_rows
 
MEM_ROOTmem_root
 
bool inited = false
 
MY_BITMAP column_bitmap
 
uint m_mrr_flags
 
Bounds_checked_array< QUICK_RANGE * > ranges
 
QUICK_RANGE_SEQ_CTX qr_traversal_ctx
 
QUICK_RANGElast_range
 
int current_range_idx
 
KEY_PART_INFOkey_part_info
 
bool m_using_extended_key_parts {false}
 

Additional Inherited Members

- Protected Member Functions inherited from TableRowIterator
int HandleError (int error)
 
void PrintError (int error)
 
TABLEtable () const
 
- Protected Member Functions inherited from RowIterator
THDthd () const
 

Detailed Description

An iterator much like IndexRangeScanIterator, but it scans in the reverse order.

This makes it at times more complicated, but since it doesn't support being a part of a ROR scan, it is also less complicated in many ways.

One could argue that this and IndexRangeScanIterator should be factored into a common base class with separate _ASC and _DESC classes, but they don't actually duplicate that much code.

Constructor & Destructor Documentation

◆ ReverseIndexRangeScanIterator()

ReverseIndexRangeScanIterator::ReverseIndexRangeScanIterator ( THD thd,
TABLE table,
ha_rows examined_rows,
double  expected_rows,
uint  index,
MEM_ROOT return_mem_root,
uint  mrr_flags,
Bounds_checked_array< QUICK_RANGE * >  ranges,
bool  using_extended_key_parts 
)

◆ ~ReverseIndexRangeScanIterator()

ReverseIndexRangeScanIterator::~ReverseIndexRangeScanIterator ( )
override

Member Function Documentation

◆ cmp_prev()

int ReverseIndexRangeScanIterator::cmp_prev ( QUICK_RANGE range)
private

◆ Init()

bool ReverseIndexRangeScanIterator::Init ( )
overridevirtual

Initialize or reinitialize the iterator.

You must always call Init() before trying a Read() (but Init() does not imply Read()).

You can call Init() multiple times; subsequent calls will rewind the iterator (or reposition it, depending on whether the iterator takes in e.g. a Index_lookup) and allow you to read the records anew.

Implements RowIterator.

◆ quick_range_rev_seq_init()

range_seq_t ReverseIndexRangeScanIterator::quick_range_rev_seq_init ( void *  init_param,
uint  ,
uint   
)
staticprivate

◆ range_reads_after_key()

bool ReverseIndexRangeScanIterator::range_reads_after_key ( QUICK_RANGE range)
private

◆ Read()

int ReverseIndexRangeScanIterator::Read ( )
overridevirtual

Read a single row.

The row data is not actually returned from the function; it is put in the table's (or tables', in case of a join) record buffer, ie., table->records[0].

Return values
0OK
-1End of records
1Error

Implements RowIterator.

Member Data Documentation

◆ column_bitmap

MY_BITMAP ReverseIndexRangeScanIterator::column_bitmap
private

◆ current_range_idx

int ReverseIndexRangeScanIterator::current_range_idx
private

◆ inited

bool ReverseIndexRangeScanIterator::inited = false
private

◆ key_part_info

KEY_PART_INFO* ReverseIndexRangeScanIterator::key_part_info
private

◆ last_range

QUICK_RANGE* ReverseIndexRangeScanIterator::last_range
private

◆ m_examined_rows

ha_rows* ReverseIndexRangeScanIterator::m_examined_rows
private

◆ m_expected_rows

const double ReverseIndexRangeScanIterator::m_expected_rows
private

◆ m_index

const uint ReverseIndexRangeScanIterator::m_index
private

◆ m_mrr_flags

uint ReverseIndexRangeScanIterator::m_mrr_flags
private

◆ m_using_extended_key_parts

bool ReverseIndexRangeScanIterator::m_using_extended_key_parts {false}
private

◆ mem_root

MEM_ROOT* ReverseIndexRangeScanIterator::mem_root
private

◆ qr_traversal_ctx

QUICK_RANGE_SEQ_CTX ReverseIndexRangeScanIterator::qr_traversal_ctx
private

◆ ranges

Bounds_checked_array<QUICK_RANGE *> ReverseIndexRangeScanIterator::ranges
private

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