My Project
|
Public Member Functions | |
Item_outer_ref (Name_resolution_context *context_arg, Item_field *outer_field_arg) | |
Item_outer_ref (Name_resolution_context *context_arg, Item **item, const char *table_name_arg, const char *field_name_arg, bool alias_name_used_arg) | |
void | save_in_result_field (bool no_conversions) |
bool | fix_fields (THD *, Item **) |
void | fix_after_pullout (st_select_lex *parent_select, st_select_lex *removed_select) |
table_map | used_tables () const |
table_map | not_null_tables () const |
virtual Ref_Type | ref_type () |
Public Attributes | |
Item * | outer_ref |
Item_sum * | in_sum_func |
bool | found_in_select_list |
void Item_outer_ref::fix_after_pullout | ( | st_select_lex * | parent_select, |
st_select_lex * | removed_select | ||
) | [virtual] |
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion. Basically re-calculate all attributes dependent on the tables.
parent_select | select_lex that tables are moved to. |
removed_select | select_lex that tables are moved away from, child of parent_select. |
Reimplemented from Item_ref.
bool Item_outer_ref::fix_fields | ( | THD * | thd, |
Item ** | reference | ||
) | [virtual] |
Resolve the name of a reference to a column reference.
The method resolves the column reference represented by 'this' as a column present in one of: GROUP BY clause, SELECT clause, outer queries. It is used typically for columns in the HAVING clause which are not under aggregate functions.
POSTCONDITION
Item_ref::ref is 0 or points to a valid item.
resolve_extended([T_j].col_ref_i) { Search for a column or derived column named col_ref_i [in table T_j] in the SELECT and GROUP clauses of Q. if such a column is NOT found AND // Lookup in outer queries. there are outer queries { for each outer query Q_k beginning from the inner-most one { Search for a column or derived column named col_ref_i [in table T_j] in the SELECT and GROUP clauses of Q_k. if such a column is not found AND - Q_k is not a group query AND - Q_k is not inside an aggregate function OR - Q_(k-1) is not in a HAVING or SELECT clause of Q_k { search for a column or derived column named col_ref_i [in table T_j] in the FROM clause of Q_k; } } } }
This procedure treats GROUP BY and SELECT clauses as one namespace for column references in HAVING. Notice that compared to Item_field::fix_fields, here we first search the SELECT and GROUP BY clauses, and then we search the FROM clause.
[in] | thd | current thread |
[in,out] | reference | view column if this item was resolved to a view column |
TRUE | if error |
FALSE | on success |
Reimplemented from Item_ref.