My Project
|
Public Types | |
enum | Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF, AGGREGATE_REF } |
Public Member Functions | |
Item_ref (Name_resolution_context *context_arg, const char *db_arg, const char *table_name_arg, const char *field_name_arg) | |
Item_ref (Name_resolution_context *context_arg, Item **item, const char *table_name_arg, const char *field_name_arg, bool alias_name_used_arg=FALSE) | |
Item_ref (THD *thd, Item_ref *item) | |
enum Type | type () const |
bool | eq (const Item *item, bool binary_cmp) const |
double | val_real () |
longlong | val_int () |
longlong | val_time_temporal () |
longlong | val_date_temporal () |
my_decimal * | val_decimal (my_decimal *) |
bool | val_bool () |
String * | val_str (String *tmp) |
bool | is_null () |
bool | get_date (MYSQL_TIME *ltime, uint fuzzydate) |
double | val_result () |
longlong | val_int_result () |
String * | str_result (String *tmp) |
my_decimal * | val_decimal_result (my_decimal *) |
bool | val_bool_result () |
bool | is_null_result () |
bool | send (Protocol *prot, String *tmp) |
void | make_field (Send_field *field) |
bool | fix_fields (THD *, Item **) |
void | fix_after_pullout (st_select_lex *parent_select, st_select_lex *removed_select) |
type_conversion_status | save_in_field (Field *field, bool no_conversions) |
void | save_org_in_field (Field *field) |
enum Item_result | result_type () const |
enum_field_types | field_type () const |
Field * | get_tmp_table_field () |
Item * | get_tmp_table_item (THD *thd) |
bool | const_item () const |
table_map | used_tables () const |
void | update_used_tables () |
virtual table_map | resolved_used_tables () const |
table_map | not_null_tables () const |
void | set_result_field (Field *field) |
bool | is_result_field () |
void | save_in_result_field (bool no_conversions) |
Item * | real_item () |
bool | walk (Item_processor processor, bool walk_subquery, uchar *arg) |
virtual Item * | transform (Item_transformer, uchar *arg) |
virtual Item * | compile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) |
virtual bool | explain_subquery_checker (uchar **arg) |
virtual void | print (String *str, enum_query_type query_type) |
void | cleanup () |
Item_field * | field_for_view_update () |
virtual Ref_Type | ref_type () |
uint | cols () |
Item * | element_index (uint i) |
Item ** | addr (uint i) |
bool | check_cols (uint c) |
bool | null_inside () |
void | bring_value () |
bool | get_time (MYSQL_TIME *ltime) |
virtual bool | basic_const_item () const |
bool | is_outer_field () const |
virtual bool | has_subquery () const |
virtual bool | has_stored_program () const |
virtual bool | created_by_in2exists () const |
Whether this Item was created by the IN->EXISTS subquery transformation. | |
Public Attributes | |
Field * | result_field |
Item ** | ref |
Protected Member Functions | |
void | set_properties () |
Item * Item_ref::compile | ( | Item_analyzer | analyzer, |
uchar ** | arg_p, | ||
Item_transformer | transformer, | ||
uchar * | arg_t | ||
) | [virtual] |
Compile an Item_ref object with a processor and a transformer callback function.
First the function applies the analyzer to the Item_ref object. Second it applies the compile function to the object the Item_ref object is referencing. If this replaces the item with a new one, this object is returned as the result of the compile. Otherwise we apply the transformer to the Item_ref object itself.
analyzer | the analyzer callback function to be applied to the nodes of the tree of the object | |
[in,out] | arg_p | parameter to be passed to the processor |
transformer | the transformer callback function to be applied to the nodes of the tree of the object | |
arg_t | parameter to be passed to the transformer |
Reimplemented from Item.
bool Item_ref::eq | ( | const Item * | item, |
bool | binary_cmp | ||
) | const [inline, virtual] |
This function is called when:
Reimplemented from Item.
Reimplemented in Item_direct_view_ref.
void Item_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_ident.
Reimplemented in Item_outer_ref.
bool Item_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.
Reimplemented in Item_outer_ref, and Item_direct_view_ref.
virtual bool Item_ref::has_stored_program | ( | ) | const [inline, virtual] |
Checks if the item tree that ref points to contains a stored program.
Reimplemented from Item.
virtual bool Item_ref::has_subquery | ( | ) | const [inline, virtual] |
Checks if the item tree that ref points to contains a subquery.
Reimplemented from Item.
void Item_ref::print | ( | String * | str, |
enum_query_type | query_type | ||
) | [virtual] |
This method is used for to:
For more information about view definition query, INFORMATION_SCHEMA query and why they should be generated from the Item-tree,
Reimplemented from Item_ident.
Reimplemented in Item_ref_null_helper, and Item_aggregate_ref.
virtual table_map Item_ref::resolved_used_tables | ( | ) | const [inline, virtual] |
Return used table information for the level this item is resolved on.
Reimplemented from Item.
type_conversion_status Item_ref::save_in_field | ( | Field * | field, |
bool | no_conversions | ||
) | [virtual] |
bool Item_ref::send | ( | Protocol * | protocol, |
String * | buffer | ||
) | [virtual] |
This is only called from items that is not of type item_field.
Reimplemented from Item.
Item * Item_ref::transform | ( | Item_transformer | transformer, |
uchar * | arg | ||
) | [virtual] |
Transform an Item_ref object with a transformer callback function.
The function first applies the transform function to the item referenced by this Item_ref object. If this replaces the item with a new one, this item object is returned as the result of the transform. Otherwise the transform function is applied to the Item_ref object itself.
transformer | the transformer callback function to be applied to the nodes of the tree of the object |
argument | parameter to be passed to the transformer |
!NULL | The transformation was successful |
NULL | Out of memory error |
Reimplemented from Item.
bool Item_ref::val_bool | ( | ) | [virtual] |
Reimplemented from Item.
Reimplemented in Item_ref_null_helper, and Item_direct_ref.
longlong Item_ref::val_date_temporal | ( | ) | [virtual] |
Return date value of item in packed longlong format.
Reimplemented from Item.
Reimplemented in Item_ref_null_helper, and Item_direct_ref.
longlong Item_ref::val_time_temporal | ( | ) | [virtual] |
Return time value of item in packed longlong format.
Reimplemented from Item.
Reimplemented in Item_ref_null_helper, and Item_direct_ref.