MySQL 5.6.14 Source Code Document
|
Public Member Functions | |
Item (THD *thd, Item *item) | |
void | rename (char *new_name) |
void | init_make_field (Send_field *tmp_field, enum enum_field_types type) |
virtual void | cleanup () |
virtual void | make_field (Send_field *field) |
virtual Field * | make_string_field (TABLE *table) |
virtual bool | fix_fields (THD *, Item **) |
virtual void | fix_after_pullout (st_select_lex *parent_select, st_select_lex *removed_select) |
void | quick_fix_field () |
type_conversion_status | save_in_field_no_warnings (Field *field, bool no_conversions) |
virtual type_conversion_status | save_in_field (Field *field, bool no_conversions) |
virtual void | save_org_in_field (Field *field) |
virtual type_conversion_status | save_safe_in_field (Field *field) |
virtual bool | send (Protocol *protocol, String *str) |
virtual bool | eq (const Item *, bool binary_cmp) const |
virtual Item_result | result_type () const |
virtual enum Item_result | numeric_context_result_type () const |
enum Item_result | temporal_with_date_as_number_result_type () const |
virtual Item_result | cast_to_int_type () const |
virtual enum_field_types | string_field_type () const |
virtual enum_field_types | field_type () const |
virtual enum Type | type () const =0 |
virtual enum_monotonicity_info | get_monotonicity_info () const |
virtual longlong | val_int_endpoint (bool left_endp, bool *incl_endp) |
virtual double | val_real ()=0 |
virtual longlong | val_int ()=0 |
virtual longlong | val_date_temporal () |
virtual longlong | val_time_temporal () |
longlong | val_temporal_by_field_type () |
longlong | val_temporal_with_round (enum_field_types type, uint8 dec) |
ulonglong | val_uint () |
virtual String * | val_str (String *str)=0 |
virtual String * | val_str_ascii (String *str) |
virtual my_decimal * | val_decimal (my_decimal *decimal_buffer)=0 |
virtual bool | val_bool () |
virtual String * | val_nodeset (String *) |
type_conversion_status | save_time_in_field (Field *field) |
type_conversion_status | save_date_in_field (Field *field) |
type_conversion_status | save_str_value_in_field (Field *field, String *result) |
virtual Field * | get_tmp_table_field () |
virtual Field * | tmp_table_field (TABLE *t_arg) |
virtual const char * | full_name () const |
virtual double | val_result () |
virtual longlong | val_int_result () |
virtual longlong | val_time_temporal_result () |
virtual longlong | val_date_temporal_result () |
virtual String * | str_result (String *tmp) |
virtual my_decimal * | val_decimal_result (my_decimal *val) |
virtual bool | val_bool_result () |
virtual bool | is_null_result () |
virtual table_map | used_tables () const |
virtual table_map | resolved_used_tables () const |
virtual table_map | not_null_tables () const |
virtual bool | basic_const_item () const |
virtual Item * | clone_item () |
virtual cond_result | eq_cmp_result () const |
uint | float_length (uint decimals_par) const |
virtual uint | decimal_precision () const |
int | decimal_int_part () const |
virtual uint | time_precision () |
virtual uint | datetime_precision () |
virtual bool | const_item () const |
virtual bool | const_during_execution () const |
virtual void | print (String *str, enum_query_type query_type) |
void | print_item_w_name (String *, enum_query_type query_type) |
void | print_for_order (String *str, enum_query_type query_type, bool used_alias) |
virtual void | update_used_tables () |
virtual void | split_sum_func (THD *thd, Ref_ptr_array ref_pointer_array, List< Item > &fields) |
void | split_sum_func2 (THD *thd, Ref_ptr_array ref_pointer_array, List< Item > &fields, Item **ref, bool skip_registered) |
virtual bool | get_date (MYSQL_TIME *ltime, uint fuzzydate)=0 |
virtual bool | get_time (MYSQL_TIME *ltime)=0 |
virtual bool | get_timeval (struct timeval *tm, int *warnings) |
virtual bool | get_date_result (MYSQL_TIME *ltime, uint fuzzydate) |
virtual bool | is_null () |
virtual void | update_null_value () |
virtual void | top_level_item () |
virtual void | set_result_field (Field *field) |
virtual bool | is_result_field () |
virtual bool | is_bool_func () |
virtual void | save_in_result_field (bool no_conversions) |
virtual void | no_rows_in_result () |
virtual Item * | copy_or_same (THD *thd) |
virtual Item * | copy_andor_structure (THD *thd, bool real_items=false) |
virtual Item * | real_item () |
virtual Item * | get_tmp_table_item (THD *thd) |
virtual const CHARSET_INFO * | compare_collation () |
virtual const CHARSET_INFO * | charset_for_protocol (void) const |
virtual bool | walk (Item_processor processor, bool walk_subquery, uchar *arg) |
virtual Item * | transform (Item_transformer transformer, uchar *arg) |
virtual Item * | compile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) |
virtual void | traverse_cond (Cond_traverser traverser, void *arg, traverse_order order) |
virtual bool | intro_version (uchar *int_arg) |
virtual bool | remove_dependence_processor (uchar *arg) |
virtual bool | remove_fixed (uchar *arg) |
virtual bool | cleanup_processor (uchar *arg) |
virtual bool | collect_item_field_processor (uchar *arg) |
virtual bool | add_field_to_set_processor (uchar *arg) |
virtual bool | remove_column_from_bitmap (uchar *arg) |
virtual bool | find_item_in_field_list_processor (uchar *arg) |
virtual bool | change_context_processor (uchar *context) |
virtual bool | reset_query_id_processor (uchar *query_id_arg) |
virtual bool | find_item_processor (uchar *arg) |
virtual bool | register_field_in_read_map (uchar *arg) |
virtual bool | inform_item_in_cond_of_tab (uchar *join_tab_index) |
virtual bool | clean_up_after_removal (uchar *arg) |
virtual bool | cache_const_expr_analyzer (uchar **arg) |
virtual Item * | cache_const_expr_transformer (uchar *arg) |
virtual bool | item_field_by_name_analyzer (uchar **arg) |
virtual Item * | item_field_by_name_transformer (uchar *arg) |
virtual bool | equality_substitution_analyzer (uchar **arg) |
virtual Item * | equality_substitution_transformer (uchar *arg) |
virtual bool | check_partition_func_processor (uchar *bool_arg) |
virtual bool | subst_argument_checker (uchar **arg) |
virtual bool | explain_subquery_checker (uchar **arg) |
virtual Item * | explain_subquery_propagator (uchar *arg) |
virtual Item * | equal_fields_propagator (uchar *arg) |
virtual bool | set_no_const_sub (uchar *arg) |
virtual Item * | replace_equal_field (uchar *arg) |
virtual bool | check_valid_arguments_processor (uchar *bool_arg) |
virtual bool | find_function_processor (uchar *arg) |
virtual Item * | this_item () |
virtual const Item * | this_item () const |
virtual Item ** | this_item_addr (THD *thd, Item **addr_arg) |
virtual uint | cols () |
virtual Item * | element_index (uint i) |
virtual Item ** | addr (uint i) |
virtual bool | check_cols (uint c) |
virtual bool | null_inside () |
virtual void | bring_value () |
Field * | tmp_table_field_from_field_type (TABLE *table, bool fixed_length) |
virtual Item_field * | field_for_view_update () |
virtual Item * | neg_transformer (THD *thd) |
virtual Item * | update_value_transformer (uchar *select_arg) |
virtual Item * | safe_charset_converter (const CHARSET_INFO *tocs) |
void | delete_self () |
virtual bool | is_splocal () |
virtual Settable_routine_parameter * | get_settable_routine_parameter () |
bool | is_temporal_with_date () const |
bool | is_temporal_with_date_and_time () const |
bool | is_temporal_with_time () const |
bool | is_temporal () const |
bool | has_compatible_context (Item *item) const |
virtual Field::geometry_type | get_geometry_type () const |
String * | check_well_formed_result (String *str, bool send_error=0) |
bool | eq_by_collation (Item *item, bool binary_cmp, const CHARSET_INFO *cs) |
virtual bool | is_expensive () |
virtual bool | can_be_evaluated_now () const |
uint32 | max_char_length () const |
void | fix_length_and_charset (uint32 max_char_length_arg, const CHARSET_INFO *cs) |
void | fix_char_length (uint32 max_char_length_arg) |
void | fix_char_length_ulonglong (ulonglong max_char_length_arg) |
void | fix_length_and_charset_datetime (uint32 max_char_length_arg) |
void | fix_length_and_dec_and_charset_datetime (uint32 max_char_length_arg, uint8 dec_arg) |
virtual bool | is_outer_field () const |
bool | is_blob_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. |
Static Public Member Functions | |
static void * | operator new (size_t size) throw () |
static void * | operator new (size_t size, MEM_ROOT *mem_root) throw () |
static void | operator delete (void *ptr, size_t size) |
static void | operator delete (void *ptr, MEM_ROOT *mem_root) |
static const CHARSET_INFO * | default_charset () |
Public Attributes | |
uint | rsize |
String | str_value |
Item_name_string | item_name |
Item_name_string | orig_name |
Item * | next |
uint32 | max_length |
int | marker |
uint8 | decimals |
my_bool | maybe_null |
my_bool | null_value |
my_bool | unsigned_flag |
my_bool | with_sum_func |
my_bool | fixed |
DTCollation | collation |
Item_result | cmp_context |
Protected Member Functions | |
String * | val_string_from_real (String *str) |
String * | val_string_from_int (String *str) |
String * | val_string_from_decimal (String *str) |
String * | val_string_from_date (String *str) |
String * | val_string_from_datetime (String *str) |
String * | val_string_from_time (String *str) |
my_decimal * | val_decimal_from_real (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_int (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_string (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_date (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_time (my_decimal *decimal_value) |
longlong | val_int_from_decimal () |
longlong | val_int_from_date () |
longlong | val_int_from_time () |
longlong | val_int_from_datetime () |
double | val_real_from_decimal () |
bool | get_date_from_string (MYSQL_TIME *ltime, uint flags) |
bool | get_date_from_real (MYSQL_TIME *ltime, uint flags) |
bool | get_date_from_decimal (MYSQL_TIME *ltime, uint flags) |
bool | get_date_from_int (MYSQL_TIME *ltime, uint flags) |
bool | get_date_from_time (MYSQL_TIME *ltime) |
bool | get_date_from_numeric (MYSQL_TIME *ltime, uint fuzzydate) |
bool | get_date_from_non_temporal (MYSQL_TIME *ltime, uint fuzzydate) |
bool | get_time_from_string (MYSQL_TIME *ltime) |
bool | get_time_from_real (MYSQL_TIME *ltime) |
bool | get_time_from_decimal (MYSQL_TIME *ltime) |
bool | get_time_from_int (MYSQL_TIME *ltime) |
bool | get_time_from_date (MYSQL_TIME *ltime) |
bool | get_time_from_datetime (MYSQL_TIME *ltime) |
bool | get_time_from_numeric (MYSQL_TIME *ltime) |
bool | get_time_from_non_temporal (MYSQL_TIME *ltime) |
Protected Attributes | |
my_bool | with_subselect |
my_bool | with_stored_program |
bool | tables_locked_cache |
Item::Item | ( | THD * | thd, |
Item * | item | ||
) |
Constructor used by Item_field, Item_ref & aggregate (sum) functions.
Used for duplicating lists in processing queries with temporary tables.
|
virtual |
|
virtual |
|
virtual |
Check if it is OK to evaluate the item now.
true | The item can be evaluated now. |
false | The item can not be evaluated now, (i.e. depend on non locked table). |
Definition at line 5962 of file item.cc.
|
inlinevirtual |
Clean up after removing the item from the item tree.
arg | Pointer to the st_select_lex from which the walk started, i.e., the st_select_lex that contained the clause that was removed. |
Reimplemented in Item_sum, and Item_subselect.
|
virtual |
|
inlinevirtual |
Reimplemented in Item_cond_or, and Item_cond_and.
Definition at line 1346 of file item.h.
|
virtual |
DATETIME precision of the item: 0..6
Reimplemented in Item_temporal_func.
Definition at line 656 of file item.cc.
|
virtual |
This function is called when:
Reimplemented in Item_cache, Item_insert_value, Item_default_value, Item_direct_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_int, Item_null, Item_field, Item_func_match, Item_func_get_system_var, Item_extract, Item_date_add_interval, Item_func_date_format, Item_datetime_literal, Item_time_literal, Item_date_literal, Item_func_set_collation, Item_char_typecast, Item_func_opt_neg, and Item_func.
Definition at line 1035 of file item.cc.
|
inlinevirtual |
Find a function of a given type
arg | the function type to search (enum Item_func::Functype) |
TRUE | the function type we're searching for is found |
FALSE | the function type wasn't found |
This function can be used (together with Item::walk()) to find functions in an item tree fragment.
Reimplemented in Item_func.
|
inlinevirtual |
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 in Item_outer_ref, Item_ref, Item_ident, Item_cond, Item_in_subselect, Item_in_optimizer, Item_subselect, Item_func, and Item_row.
Definition at line 779 of file item.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
Get timestamp in "struct timeval" format.
false | on success |
true | on error |
Reimplemented in Item_field.
Definition at line 1451 of file item.cc.
|
inline |
Check whether this and the given item has compatible comparison context. Used by the equality propagation. See Item_field::equal_fields_propagator.
Definition at line 1631 of file item.h.
|
inlinevirtual |
bool Item::is_blob_field | ( | ) | const |
Check if an item either is a blob field, or will be represented as a BLOB field if a field is created based on this item.
TRUE | If a field based on this item will be a BLOB field, |
FALSE | Otherwise. |
Definition at line 1504 of file item.cc.
|
inlinevirtual |
Analyzer for finding Item_field by name
arg | Field name to search for |
Reimplemented in Item_field.
|
inlinevirtual |
Simple transformer that returns the argument if this is an Item_field. The new item will inherit it's name to maintain aliases.
arg | Item to replace Item_field |
Reimplemented in Item_field.
Create a field to hold a string value from an item.
If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob
If max_length > 0 create a varchar
If max_length == 0 create a CHAR(0)
table | Table for which the field is created |
Reimplemented in Item_func_group_concat.
Definition at line 5989 of file item.cc.
|
inlinevirtual |
Result type when an item appear in a numeric context. See Field::numeric_context_result_type() for more comments.
Reimplemented in Item_field.
Definition at line 810 of file item.h.
|
inlinevirtual |
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 in Item_cache, Item_insert_value, Item_default_value, Item_temporal_with_ref, Item_ref_null_helper, Item_ref, Item_hex_string, Item_static_string_func, Item_string, Item_static_float_func, Item_float, Item_decimal, Item_uint, Item_int, Item_null, Item_field, Item_ident, Item_name_const, Item_case_expr, Item_aggregate_ref, Item_func_match, Item_func_get_system_var, Item_equal, Item_user_var_as_out_param, Item_func_set_user_var, Item_cond, Item_func_regex, Item_func_isnotnull, Item_func_get_format, Item_func_timestamp_diff, Item_func_group_concat, Item_func_add_time, Item_func_in, Item_datetime_typecast, Item_time_typecast, Item_date_typecast, Item_func_case, Item_extract, Item_date_add_interval, Item_func_benchmark, Item_func_bit_neg, Item_func_bit, Item_func_locate, Item_datetime_literal, Item_time_literal, Item_func_set_collation, Item_func_nullif, Item_func_conv_charset, Item_date_literal, Item_func_binary, Item_char_typecast, Item_func_strcmp, Item_func_between, Item_func_int_div, Item_func_format, Item_decimal_typecast, Item_func_make_set, Item_func_unsigned, Item_func_not_all, Item_func_signed, Item_func_trig_cond, Item_allany_subselect, Item_num_op, Item_in_subselect, Item_func_not, Item_sum, Item_bool_func2, Item_exists_subselect, Item_func_trim, Item_maxmin_subselect, Item_func_truth, Item_func, Item_subselect, and Item_row.
Definition at line 1270 of file item.h.
void Item::print_for_order | ( | String * | str, |
enum_query_type | query_type, | ||
bool | used_alias | ||
) |
Prints the item when it's part of ORDER BY and GROUP BY.
str | String to print to |
query_type | How to format the item |
used_alias | Whether item was referenced with alias. |
"SELECT (subq) GROUP BY (same_subq)" confuses ONLY_FULL_GROUP_BY (it does not see that both subqueries are the same, raises an error). To avoid hitting this problem, if the original query was: "SELECT expression AS x GROUP BY x", we print "GROUP BY x", not "GROUP BY expression". Same for ORDER BY. This has practical importance for views created as "CREATE VIEW v SELECT (subq) AS x GROUP BY x" (print_order() is used to write the view's definition in the frm file).
Definition at line 698 of file item.cc.
|
inlinevirtual |
Visitor interface for removing all column expressions (Item_field) in this expression tree from a bitmap. walk()
arg | A MY_BITMAP* cast to unsigned char*, where the bits represent Field::field_index values. |
Reimplemented in Item_field.
Definition at line 1427 of file item.h.
void Item::rename | ( | char * | new_name | ) |
|
inlinevirtual |
Return used table information for the level this item is resolved on.
Reimplemented in Item_cache, Item_ref, and Item_field.
Definition at line 1200 of file item.h.
|
virtual |
Save a temporal value in packed longlong format into a Field. Used in optimizer.
OUT | field The field to set the value to. |
0 | On success. |
>0 | In error. |
Reimplemented in Item_cache_str, Item_insert_value, Item_default_value, Item_copy_decimal, Item_copy_float, Item_copy_int, Item_copy_string, Item_copy, Item_int_with_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_uint, Item_temporal, Item_int, Item_null, Item_field, Item_name_const, Item_sp_variable, Item_func_set_user_var, Item_func_now, Item_time_func, Item_datetime_func, Item_date_func, Item_temporal_hybrid_func, and Item_func_user.
Definition at line 6235 of file item.cc.
This is only called from items that is not of type item_field.
Reimplemented in Item_ref, Item_null, Item_field, Item_name_const, Item_sp_variable, and Item_func_set_user_var.
Definition at line 6770 of file item.cc.
void Item::split_sum_func2 | ( | THD * | thd, |
Ref_ptr_array | ref_pointer_array, | ||
List< Item > & | fields, | ||
Item ** | ref, | ||
bool | skip_registered | ||
) |
Move SUM items out from item tree and replace with reference.
thd | Thread handler |
ref_pointer_array | Pointer to array of reference fields |
fields | All fields in select |
ref | Pointer to item |
skip_registered | <=> function be must skipped for registered SUM items |
All found SUM items are added FIRST in the fields list and we replace the item with a reference.
thd->fatal_error() may be called if we are out of memory
Definition at line 1946 of file item.cc.
|
inline |
|
virtual |
TIME precision of the item: 0..6
Reimplemented in Item_temporal_func.
Definition at line 639 of file item.cc.
Create a field based on field_type of argument.
For now, this is only used to create a field for IFNULL(x,something) and time functions
NULL | error |
\:: | Created field |
Definition at line 6022 of file item.cc.
|
virtual |
Traverse item tree possibly transforming it (replacing items).
This function is designed to ease transformation of Item trees. Re-execution note: every such transformation is registered for rollback by THD::change_item_tree() and is rolled back at the end of execution by THD::rollback_item_tree_changes().
Therefore:
If you don't need to transform an item tree, but only traverse it, please use Item::walk() instead.
transformer | functor that performs transformation of a subtree |
arg | opaque argument passed to the functor |
Reimplemented in Item_default_value, Item_ref, Item_equal, Item_cond, Item_func_make_set, Item_in_optimizer, Item_func, and Item_row.
Definition at line 786 of file item.cc.
|
virtual |
Reimplemented in Item_ref_null_helper, Item_direct_ref, Item_ref, Item_in_subselect, Item_exists_subselect, Item_singlerow_subselect, and Item_func_truth.
Definition at line 199 of file item.cc.
|
virtual |
Return date value of item in packed longlong format.
Reimplemented in Item_cache_datetime, Item_cache_int, Item_time_with_ref, Item_datetime_with_ref, Item_ref_null_helper, Item_direct_ref, Item_ref, Item_temporal, Item_null, Item_field, Item_func_now, Item_func_curdate, Item_sum_hybrid, Item_datetime_literal, Item_date_literal, Item_datetime_func, and Item_date_func.
Definition at line 396 of file item.cc.
|
inlinevirtual |
Get date value in packed longlong format. NULL is converted to 0.
Reimplemented in Item_field.
Definition at line 1181 of file item.h.
|
inline |
longlong Item::val_temporal_with_round | ( | enum_field_types | type, |
uint8 | dec | ||
) |
|
virtual |
Return time value of item in packed longlong format.
Reimplemented in Item_cache_datetime, Item_cache_int, Item_time_with_ref, Item_datetime_with_ref, Item_ref_null_helper, Item_direct_ref, Item_ref, Item_temporal, Item_null, Item_field, Item_sum_hybrid, Item_func_curtime, Item_time_literal, and Item_time_func.
Definition at line 387 of file item.cc.
|
inlinevirtual |
Get time value in packed longlong format. NULL is converted to 0.
Reimplemented in Item_field.
Definition at line 1177 of file item.h.
int Item::marker |
This member has several successive meanings, depending on the phase we're in:
Item* Item::next |
|
protected |
This variable is a cache of 'Needed tables are locked'. True if either 'No tables locks is needed' or 'Needed tables are locked'. If tables are used, then it will be set to current_thd->lex->is_query_tables_locked().
It is used when checking const_item()/can_be_evaluated_now().