MySQL 8.0.40
Source Code Documentation
Field_iterator_table_ref Class Reference

Generic iterator over the fields of an arbitrary table reference. More...

#include <table.h>

Inheritance diagram for Field_iterator_table_ref:
[legend]

Public Member Functions

 Field_iterator_table_ref ()
 
void set (Table_ref *table) override
 
void next () override
 
bool end_of_fields () override
 
const char * name () override
 
const char * get_table_name ()
 
const char * get_db_name ()
 
GRANT_INFOgrant ()
 
Itemcreate_item (THD *thd) override
 
Fieldfield () override
 
Natural_join_columnget_or_create_column_ref (THD *thd, Table_ref *parent_table_ref)
 Create new or return existing column reference to a column of a natural/using join. More...
 
Natural_join_columnget_natural_column_ref ()
 Return an existing reference to a column of a natural/using join. More...
 
- Public Member Functions inherited from Field_iterator
virtual ~Field_iterator ()=default
 

Private Member Functions

void set_field_iterator ()
 

Private Attributes

Table_reftable_ref
 
Table_reffirst_leaf
 
Table_reflast_leaf
 
Field_iterator_table table_field_it
 
Field_iterator_view view_field_it
 
Field_iterator_natural_join natural_join_it
 
Field_iteratorfield_it
 

Detailed Description

Generic iterator over the fields of an arbitrary table reference.

This class unifies the various ways of iterating over the columns of a table reference depending on the type of SQL entity it represents. If such an entity represents a nested table reference, this iterator encapsulates the iteration over the columns of the members of the table reference.

The implementation assumes that all underlying NATURAL/USING table references already contain their result columns and are linked into the list Table_ref::next_name_resolution_table.

Constructor & Destructor Documentation

◆ Field_iterator_table_ref()

Field_iterator_table_ref::Field_iterator_table_ref ( )
inline

Member Function Documentation

◆ create_item()

Item * Field_iterator_table_ref::create_item ( THD thd)
inlineoverridevirtual

Implements Field_iterator.

◆ end_of_fields()

bool Field_iterator_table_ref::end_of_fields ( )
inlineoverridevirtual

Implements Field_iterator.

◆ field()

Field * Field_iterator_table_ref::field ( )
inlineoverridevirtual

Implements Field_iterator.

◆ get_db_name()

const char * Field_iterator_table_ref::get_db_name ( )

◆ get_natural_column_ref()

Natural_join_column * Field_iterator_table_ref::get_natural_column_ref ( )

Return an existing reference to a column of a natural/using join.

The method should be called in contexts where it is expected that all natural join columns are already created, and that the column being retrieved is a Natural_join_column.

Return values
otherPointer to a column of a natural join (or its operand)
NULLNo memory to allocate the column

◆ get_or_create_column_ref()

Natural_join_column * Field_iterator_table_ref::get_or_create_column_ref ( THD thd,
Table_ref parent_table_ref 
)

Create new or return existing column reference to a column of a natural/using join.

Parameters
thdSession.
parent_table_refthe parent table reference over which the iterator is iterating

Create a new natural join column for the current field of the iterator if no such column was created, or return an already created natural join column. The former happens for base tables or views, and the latter for natural/using joins. If a new field is created, then the field is added to 'parent_table_ref' if it is given, or to the original table reference of the field if parent_table_ref == NULL.

Note
This method is designed so that when a Field_iterator_table_ref walks through the fields of a table reference, all its fields are created and stored as follows:
  • If the table reference being iterated is a stored table, view or natural/using join, store all natural join columns in a list attached to that table reference.
  • If the table reference being iterated is a nested join that is not natural/using join, then do not materialize its result fields. This is OK because for such table references Field_iterator_table_ref iterates over the fields of the nested table references (recursively). In this way we avoid the storage of unnecessay copies of result columns of nested joins.
Return values
otherPointer to a column of a natural join (or its operand)
NULLNo memory to allocate the column

◆ get_table_name()

const char * Field_iterator_table_ref::get_table_name ( )

◆ grant()

GRANT_INFO * Field_iterator_table_ref::grant ( )

◆ name()

const char * Field_iterator_table_ref::name ( )
inlineoverridevirtual

Implements Field_iterator.

◆ next()

void Field_iterator_table_ref::next ( void  )
overridevirtual

Implements Field_iterator.

◆ set()

void Field_iterator_table_ref::set ( Table_ref table)
overridevirtual

Implements Field_iterator.

◆ set_field_iterator()

void Field_iterator_table_ref::set_field_iterator ( )
private

Member Data Documentation

◆ field_it

Field_iterator* Field_iterator_table_ref::field_it
private

◆ first_leaf

Table_ref * Field_iterator_table_ref::first_leaf
private

◆ last_leaf

Table_ref * Field_iterator_table_ref::last_leaf
private

◆ natural_join_it

Field_iterator_natural_join Field_iterator_table_ref::natural_join_it
private

◆ table_field_it

Field_iterator_table Field_iterator_table_ref::table_field_it
private

◆ table_ref

Table_ref* Field_iterator_table_ref::table_ref
private

◆ view_field_it

Field_iterator_view Field_iterator_table_ref::view_field_it
private

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