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.
Create new or return existing column reference to a column of a natural/using join.
- Parameters
-
thd | Session. |
parent_table_ref | the 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
-
other | Pointer to a column of a natural join (or its operand) |
NULL | No memory to allocate the column |