|
| enum | Ref_Type { REF
, DIRECT_REF
, OUTER_REF
} |
| enum | Type {
FIELD_ITEM = 0
, FUNC_ITEM
, SUM_FUNC_ITEM
, STRING_ITEM
,
INT_ITEM
, REAL_ITEM
, NULL_ITEM
, VARBIN_ITEM
,
COPY_STR_ITEM
, FIELD_AVG_ITEM
, DEFAULT_VALUE_ITEM
, PROC_ITEM
,
COND_ITEM
, REF_ITEM
, FIELD_STD_ITEM
, FIELD_VARIANCE_ITEM
,
INSERT_VALUE_ITEM
, SUBSELECT_ITEM
, ROW_ITEM
, CACHE_ITEM
,
TYPE_HOLDER
, PARAM_ITEM
, BOOLEAN_ITEM
, DECIMAL_ITEM
} |
| enum | traverse_order { T_POSTFIX
, T_PREFIX
} |
| enum | cond_result { COND_UNDEF
, COND_OK
, COND_TRUE
, COND_FALSE
} |
|
| | 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 (Session *session, Item_ref *item) |
| enum Type | type () const |
| bool | eq (const Item *item, bool binary_cmp) const |
| double | val_real () |
| int64_t | val_int () |
| type::Decimal * | val_decimal (type::Decimal *) |
| bool | val_bool () |
| String * | val_str (String *tmp) |
| bool | is_null () |
| bool | get_date (type::Time <ime, uint32_t fuzzydate) |
| double | val_result () |
| int64_t | val_int_result () |
| String * | str_result (String *tmp) |
| type::Decimal * | val_decimal_result (type::Decimal *) |
| bool | val_bool_result () |
| void | send (plugin::Client *client, String *tmp) |
| void | make_field (SendField *field) |
| bool | fix_fields (Session *, Item **) |
| void | fix_after_pullout (Select_Lex *new_parent, Item **ref) |
| int | 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 (Session *session) |
| table_map | used_tables () const |
| void | update_used_tables () |
| 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 (void) |
| const Item * | real_item (void) const |
| bool | walk (Item_processor processor, bool walk_subquery, unsigned char *arg) |
| virtual void | print (String *str) |
| bool | result_as_int64_t () |
| void | cleanup () |
| virtual Ref_Type | ref_type () |
| uint32_t | cols () |
| Item * | element_index (uint32_t i) |
| Item ** | addr (uint32_t i) |
| bool | check_cols (uint32_t c) |
| bool | null_inside () |
| void | bring_value () |
| bool | basic_const_item () const |
| | Item_ident (Name_resolution_context *context_arg, const char *db_name_arg, const char *table_name_arg, const char *field_name_arg) |
| | Item_ident (Session *session, Item_ident *item) |
| const char * | full_name () const |
| bool | remove_dependence_processor (unsigned char *arg) |
| virtual bool | change_context_processor (unsigned char *cntx) |
| bool | is_unsigned () const |
| virtual bool | negative () const |
| | Item () |
| | Item (Session *session, Item *item) |
| void | set_name (str_ref arg) |
| void | set_name (const char *arg) |
| void | set_name (const char *str, uint32_t length, const charset_info_st *cs=system_charset_info) |
| void | init_make_field (SendField *tmp_field, enum_field_types type) |
| Field * | make_string_field (Table *table) |
| void | quick_fix_field () |
| virtual int | save_safe_in_field (Field *field) |
| virtual Item_result | cast_to_int_type () const |
| virtual enum_field_types | string_field_type () const |
| virtual int64_t | val_int_endpoint (bool left_endp, bool *incl_endp) |
| uint64_t | val_uint () |
| String * | val_string_from_real (String *str) |
| String * | val_string_from_int (String *str) |
| String * | val_string_from_decimal (String *str) |
| type::Decimal * | val_decimal_from_real (type::Decimal *decimal_value) |
| type::Decimal * | val_decimal_from_int (type::Decimal *decimal_value) |
| type::Decimal * | val_decimal_from_string (type::Decimal *decimal_value) |
| type::Decimal * | val_decimal_from_date (type::Decimal *decimal_value) |
| type::Decimal * | val_decimal_from_time (type::Decimal *decimal_value) |
| int64_t | val_int_from_decimal () |
| double | val_real_from_decimal () |
| bool | save_time_in_field (Field *field) |
| bool | save_date_in_field (Field *field) |
| int | save_str_value_in_field (Field *field, String *result) |
| virtual Field * | tmp_table_field (Table *t_arg) |
| virtual Item * | clone_item () |
| virtual cond_result | eq_cmp_result () const |
| uint32_t | float_length (uint32_t decimals_par) const |
| virtual uint32_t | decimal_precision () const |
| int | decimal_int_part () const |
| virtual bool | const_item () const |
| virtual bool | const_during_execution () const |
| void | print_item_w_name (String *) |
| virtual void | split_sum_func (Session *session, Item **ref_pointer_array, List< Item > &fields) |
| void | split_sum_func (Session *session, Item **ref_pointer_array, List< Item > &fields, Item **ref, bool skip_registered) |
| virtual bool | get_time (type::Time <ime) |
| virtual bool | get_date_result (type::Time <ime, uint32_t fuzzydate) |
| virtual void | update_null_value () |
| virtual void | top_level_item (void) |
| virtual bool | is_bool_func (void) |
| virtual void | no_rows_in_result (void) |
| virtual Item * | copy_or_same (Session *session) |
| virtual Item * | copy_andor_structure (Session *session) |
| virtual const charset_info_st * | compare_collation () |
| virtual Item * | transform (Item_transformer transformer, unsigned char *arg) |
| virtual Item * | compile (Item_analyzer analyzer, unsigned char **arg_p, Item_transformer transformer, unsigned char *arg_t) |
| virtual void | traverse_cond (Cond_traverser traverser, void *arg, traverse_order order) |
| virtual bool | collect_item_field_processor (unsigned char *arg) |
| virtual bool | find_item_in_field_list_processor (unsigned char *arg) |
| virtual bool | register_field_in_read_map (unsigned char *arg) |
| virtual bool | subst_argument_checker (unsigned char **arg) |
| virtual bool | cache_const_expr_analyzer (unsigned char **arg) |
| virtual Item * | cache_const_expr_transformer (unsigned char *arg) |
| virtual Item * | equal_fields_propagator (unsigned char *arg) |
| virtual bool | set_no_const_sub (unsigned char *arg) |
| virtual Item * | replace_equal_field (unsigned char *arg) |
| Field * | tmp_table_field_from_field_type (Table *table, bool fixed_length) |
| virtual Item * | neg_transformer (Session *session) |
| virtual Item * | update_value_transformer (unsigned char *select_arg) |
| virtual Item * | safe_charset_converter (const charset_info_st *const tocs) |
| void | delete_self () |
| bool | is_datetime () |
| virtual bool | is_expensive () |
| String * | check_well_formed_result (String *str, bool send_error=0) |
| bool | eq_by_collation (Item *item, bool binary_cmp, const charset_info_st *const cs) |
| uint32_t | char_to_byte_length_safe (uint32_t char_length_arg, uint32_t mbmaxlen_arg) |
| uint32_t | max_char_length () const |
| void | fix_char_length (uint32_t max_char_length_arg) |
Definition at line 26 of file ref.h.
| bool drizzled::Item_ref::fix_fields |
( |
Session * | session, |
|
|
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.
- Note
- The name resolution algorithm used is (where [T_j] is an optional table name that qualifies the column name):
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
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.
- Parameters
-
| [in] | session | current thread |
| [in,out] | reference | view column if this item was resolved to a view column |
- Todo
- Here we could first find the field anyway, and then test this condition, so that we can give a better error message - ER_WRONG_FIELD_WITH_GROUP, instead of the less informative ER_BAD_FIELD_ERROR which we produce now.
- Return values
-
| true | if error |
| false | on success |
Reimplemented from drizzled::Item.
Definition at line 113 of file ref.cc.
Return string representation of this item object.
- Parameters
-
| an | allocated buffer this or any nested Item object can use to store return value of this method. |
- Note
Buffer passed via argument should only be used if the item itself doesn't have an own String buffer. In case when the item maintains it's own string buffer, it's preferable to return it instead to minimize number of mallocs/memcpys.
The caller of this method can modify returned string, but only in case when it was allocated on heap, (is_alloced() is true). This allows the caller to efficiently use a buffer allocated by a child without having to allocate a buffer of it's own. The buffer, given to val_str() as argument, belongs to the caller and is later used by the caller at it's own choosing.
A few implications from the above:
- unless you return a string object which only points to your buffer but doesn't manages it you should be ready that it will be modified.
- even for not allocated strings (is_alloced() == false) the caller can change charset (see Item_func_{typecast/binary}. XXX: is this a bug?
- still you should try to minimize data copying and return internal object whenever possible.
- Return values
-
| In | case of NULL value return 0 (NULL pointer) and set null_value flag to true. If value is not null null_value flag will be reset to false. |
Implements drizzled::Item.
Reimplemented in drizzled::Item_ref_null_helper.
Definition at line 497 of file ref.cc.