My Project
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
Item Class Reference
Inheritance diagram for Item:
Item_basic_constant Item_copy Item_ident Item_ident_for_show Item_name_const Item_param Item_proc Item_result_field Item_row Item_sp_variable Item_type_holder Item_user_var_as_out_param

List of all members.

Public Types

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, TRIGGER_FIELD_ITEM, DECIMAL_ITEM,
  XPATH_NODESET, XPATH_NODESET_CMP, VIEW_FIXER_ITEM
}
enum  cond_result { COND_UNDEF, COND_OK, COND_TRUE, COND_FALSE }
enum  traverse_order { POSTFIX, PREFIX }

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 Fieldmake_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 Stringval_str (String *str)=0
virtual Stringval_str_ascii (String *str)
virtual my_decimalval_decimal (my_decimal *decimal_buffer)=0
virtual bool val_bool ()
virtual Stringval_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 Fieldget_tmp_table_field ()
virtual Fieldtmp_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 Stringstr_result (String *tmp)
virtual my_decimalval_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 Itemclone_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 Itemcopy_or_same (THD *thd)
virtual Itemcopy_andor_structure (THD *thd, bool real_items=false)
virtual Itemreal_item ()
virtual Itemsubstitutional_item ()
virtual void set_runtime_created ()
virtual Itemget_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 Itemtransform (Item_transformer transformer, uchar *arg)
virtual Itemcompile (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 Itemcache_const_expr_transformer (uchar *arg)
virtual bool item_field_by_name_analyzer (uchar **arg)
virtual Itemitem_field_by_name_transformer (uchar *arg)
virtual bool equality_substitution_analyzer (uchar **arg)
virtual Itemequality_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 Itemexplain_subquery_propagator (uchar *arg)
virtual Itemequal_fields_propagator (uchar *arg)
virtual bool set_no_const_sub (uchar *arg)
virtual Itemreplace_equal_field (uchar *arg)
virtual bool check_valid_arguments_processor (uchar *bool_arg)
virtual bool find_function_processor (uchar *arg)
virtual Itemthis_item ()
virtual const Itemthis_item () const
virtual Item ** this_item_addr (THD *thd, Item **addr_arg)
virtual uint cols ()
virtual Itemelement_index (uint i)
virtual Item ** addr (uint i)
virtual bool check_cols (uint c)
virtual bool null_inside ()
virtual void bring_value ()
Fieldtmp_table_field_from_field_type (TABLE *table, bool fixed_length)
virtual Item_fieldfield_for_view_update ()
virtual Itemneg_transformer (THD *thd)
virtual Itemupdate_value_transformer (uchar *select_arg)
virtual Itemsafe_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
Stringcheck_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
Itemnext
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
bool runtime_item

Protected Member Functions

Stringval_string_from_real (String *str)
Stringval_string_from_int (String *str)
Stringval_string_from_decimal (String *str)
Stringval_string_from_date (String *str)
Stringval_string_from_datetime (String *str)
Stringval_string_from_time (String *str)
my_decimalval_decimal_from_real (my_decimal *decimal_value)
my_decimalval_decimal_from_int (my_decimal *decimal_value)
my_decimalval_decimal_from_string (my_decimal *decimal_value)
my_decimalval_decimal_from_date (my_decimal *decimal_value)
my_decimalval_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

Constructor & Destructor Documentation

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.


Member Function Documentation

bool Item::cache_const_expr_analyzer ( uchar **  arg) [virtual]

Check if an item is a constant one and can be cached.

Parameters:
arg[out] != NULL <=> Cache this item.
Returns:
TRUE Go deeper in item tree.
FALSE Don't go deeper in item tree.
Item * Item::cache_const_expr_transformer ( uchar *  arg) [virtual]

Cache item if needed.

Parameters:
arg!= NULL <=> Cache this item.
Returns:
cache if cache needed.
this otherwise.
bool Item::can_be_evaluated_now ( ) const [virtual]

Check if it is OK to evaluate the item now.

Returns:
true if the item can be evaluated in the current statement state.
Return values:
trueThe item can be evaluated now.
falseThe item can not be evaluated now, (i.e. depend on non locked table).
Note:
Help function to avoid optimize or exec call during prepare phase.
String * Item::check_well_formed_result ( String str,
bool  send_error = 0 
)

Verifies that the input string is well-formed according to its character set.

Parameters:
send_errorIf true, call my_error if string is not well-formed.

Will truncate input string if it is not well-formed.

Returns:
If well-formed: input string. If not well-formed: if strict mode: NULL pointer and we set this Item's value to NULL if not strict mode: input string truncated up to last good character
virtual bool Item::clean_up_after_removal ( uchar *  arg) [inline, virtual]

Clean up after removing the item from the item tree.

Parameters:
argPointer 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.

bool Item::cleanup_processor ( uchar *  arg) [virtual]

cleanup() item if it is 'fixed'.

Parameters:
arga dummy parameter, is not used here
virtual Item* Item::copy_andor_structure ( THD *  thd,
bool  real_items = false 
) [inline, virtual]
Parameters:
real_itemsTrue <=> in the copy, replace any Item_ref with its real_item()
Todo:
this argument should be always false and removed in WL#7082.

Reimplemented in Item_cond_or, and Item_cond_and.

uint Item::datetime_precision ( ) [virtual]

DATETIME precision of the item: 0..6

Reimplemented in Item_temporal_func.

bool Item::eq ( const Item item,
bool  binary_cmp 
) const [virtual]

This function is called when:

  • Comparing items in the WHERE clause (when doing where optimization)
  • When trying to find an ORDER BY/GROUP BY item in the SELECT part
  • When matching fields in multiple equality objects (Item_equal)

Reimplemented in Item_cache, Item_trigger_field, Item_insert_value, Item_default_value, Item_direct_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_int, Item_param, Item_null, Item_field, Item_func_match, Item_func_get_system_var, Item_func_get_user_var, Item_extract, Item_date_add_interval, Item_func_date_format, Item_datetime_literal, Item_time_literal, Item_func_set_collation, Item_date_literal, Item_char_typecast, Item_func_opt_neg, and Item_func.

virtual bool Item::find_function_processor ( uchar *  arg) [inline, virtual]

Find a function of a given type

Parameters:
argthe function type to search (enum Item_func::Functype)
Returns:
Return values:
TRUEthe function type we're searching for is found
FALSEthe 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.

virtual void Item::fix_after_pullout ( st_select_lex *  parent_select,
st_select_lex *  removed_select 
) [inline, 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.

Parameters:
parent_selectselect_lex that tables are moved to.
removed_selectselect_lex that tables are moved away from, child of parent_select.

Reimplemented in Item_outer_ref, Item_ref, Item_ident, Item_cond, Item_func_in, Item_func_if, Item_func_between, Item_in_subselect, Item_in_optimizer, Item_subselect, Item_func, and Item_row.

bool Item::get_date_from_decimal ( MYSQL_TIME *  ltime,
uint  flags 
) [protected]

Convert val_decimal() to date in MYSQL_TIME

bool Item::get_date_from_int ( MYSQL_TIME *  ltime,
uint  flags 
) [protected]

Convert val_int() to date in MYSQL_TIME

bool Item::get_date_from_non_temporal ( MYSQL_TIME *  ltime,
uint  fuzzydate 
) [protected]

Convert a non-temporal type to date

Get the value of the function as a MYSQL_TIME structure. As a extra convenience the time structure is reset on error!

bool Item::get_date_from_numeric ( MYSQL_TIME *  ltime,
uint  fuzzydate 
) [protected]

Convert a numeric type to date

bool Item::get_date_from_real ( MYSQL_TIME *  ltime,
uint  flags 
) [protected]

Convert val_real() to date in MYSQL_TIME

bool Item::get_date_from_string ( MYSQL_TIME *  ltime,
uint  flags 
) [protected]

Convert val_str() to date in MYSQL_TIME

bool Item::get_date_from_time ( MYSQL_TIME *  ltime) [protected]

Convert get_time() from time to date in MYSQL_TIME

bool Item::get_time_from_date ( MYSQL_TIME *  ltime) [protected]

Convert date to time

bool Item::get_time_from_datetime ( MYSQL_TIME *  ltime) [protected]

Convert datetime to time

bool Item::get_time_from_decimal ( MYSQL_TIME *  ltime) [protected]

Convert val_decimal() to time in MYSQL_TIME

bool Item::get_time_from_int ( MYSQL_TIME *  ltime) [protected]

Convert val_int() to time in MYSQL_TIME

bool Item::get_time_from_non_temporal ( MYSQL_TIME *  ltime) [protected]

Convert a non-temporal type to time

Get time value from int, real, decimal or string.

As a extra convenience the time structure is reset on error!

bool Item::get_time_from_numeric ( MYSQL_TIME *  ltime) [protected]

Convert a numeric type to time

bool Item::get_time_from_real ( MYSQL_TIME *  ltime) [protected]

Convert val_real() to time in MYSQL_TIME

bool Item::get_time_from_string ( MYSQL_TIME *  ltime) [protected]

Convert val_str() to time in MYSQL_TIME

bool Item::get_timeval ( struct timeval *  tm,
int *  warnings 
) [virtual]

Get timestamp in "struct timeval" format.

Return values:
falseon success
trueon error

If argument is NULL, sets null_value. Otherwise: if invalid DATETIME value, or a valid DATETIME value but which is out of the supported Unix timestamp range, sets 'tm' to 0.

Reimplemented in Item_field.

bool Item::has_compatible_context ( Item item) const [inline]

Check whether this and the given item has compatible comparison context. Used by the equality propagation. See Item_field::equal_fields_propagator.

Returns:
TRUE if the context is the same or if fields could be compared as DATETIME values by the Arg_comparator. FALSE otherwise.
virtual bool Item::has_subquery ( ) const [inline, virtual]

Checks if this item or any of its decendents contains a subquery.

Reimplemented in Item_ref.

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.

Return values:
TRUEIf a field based on this item will be a BLOB field,
FALSEOtherwise.
virtual bool Item::item_field_by_name_analyzer ( uchar **  arg) [inline, virtual]

Analyzer for finding Item_field by name

Parameters:
argField name to search for
Returns:
TRUE Go deeper in item tree. (Found Item or not an Item_field)
FALSE Don't go deeper in item tree. (Item_field with other name)

Reimplemented in Item_field.

virtual Item* Item::item_field_by_name_transformer ( uchar *  arg) [inline, virtual]

Simple transformer that returns the argument if this is an Item_field. The new item will inherit it's name to maintain aliases.

Parameters:
argItem to replace Item_field
Returns:
argument if this is an Item_field
this otherwise.

Reimplemented in Item_field.

Field * Item::make_string_field ( TABLE table) [virtual]

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) (or VARCHAR(0) if we are grouping)

Parameters:
tableTable for which the field is created

Reimplemented in Item_func_group_concat.

virtual enum Item_result Item::numeric_context_result_type ( ) const [inline, virtual]

Result type when an item appear in a numeric context. See Field::numeric_context_result_type() for more comments.

Reimplemented in Item_field.

virtual void Item::print ( String str,
enum_query_type  query_type 
) [inline, virtual]

This method is used for to:

  • to generate a view definition query (SELECT-statement);
  • to generate a SQL-query for EXPLAIN EXTENDED;
  • to generate a SQL-query to be shown in INFORMATION_SCHEMA;
  • debug.

For more information about view definition query, INFORMATION_SCHEMA query and why they should be generated from the Item-tree,

See also:
mysql_register_view().

Reimplemented in Item_cache, Item_trigger_field, 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_param, Item_null, Item_field, Item_ident, Item_name_const, Item_case_expr, Item_aggregate_ref, Item_func_match, Item_splocal, Item_func_get_system_var, Item_equal, Item_user_var_as_out_param, Item_func_get_user_var, Item_func_set_user_var, Item_cond, Item_func_regex, Item_func_isnotnull, Item_func_get_format, Item_func_group_concat, Item_func_timestamp_diff, 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_conv_charset, Item_func_nullif, Item_date_literal, Item_func_binary, Item_char_typecast, Item_func_strcmp, Item_func_between, Item_func_int_div, Item_func_format, Item_func_make_set, Item_decimal_typecast, 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.

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.

Parameters:
strString to print to
query_typeHow to format the item
used_aliasWhether 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). We make one exception: if the view is merge-able, its ORDER clause will be merged into the parent query's. If an identifier in the merged ORDER clause is allowed to be either an alias or an expression of the view's underlying tables, resolution is difficult: it may be to be found in the underlying tables of the view, or in the SELECT list of the view; unlike other ORDER elements directly originating from the parent query. To avoid this problem, if the view is merge-able, we print the expression. This does not cause problems with only_full_group_by, because a merge-able view never has GROUP BY.

See also:
mysql_register_view().
virtual bool Item::remove_column_from_bitmap ( uchar *  arg) [inline, virtual]

Visitor interface for removing all column expressions (Item_field) in this expression tree from a bitmap. walk()

Parameters:
argA MY_BITMAP* cast to unsigned char*, where the bits represent Field::field_index values.

Reimplemented in Item_field.

void Item::rename ( char *  new_name)

rename item (used for views, cleanup() return original name).

Parameters:
new_namenew name of item;
virtual table_map Item::resolved_used_tables ( ) const [inline, virtual]

Return used table information for the level this item is resolved on.

  • For fields, this returns the table the item is resolved from.
  • For all other items, this behaves like used_tables().
Note:
: Use this function with caution. External calls to this function should only be made for class objects derived from Item_ident. Item::resolved_used_tables is for internal use only, in order to process fields underlying a view column reference.

Reimplemented in Item_cache, Item_ref, and Item_field.

type_conversion_status Item::save_in_field ( Field field,
bool  no_conversions 
) [virtual]
bool Item::send ( Protocol protocol,
String buffer 
) [virtual]

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.

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.

Parameters:
thdThread handler
ref_pointer_arrayPointer to array of reference fields
fieldsAll fields in select
refPointer to item
skip_registered<=> function be must skipped for registered SUM items
Note:
This is from split_sum_func2() for items that should be split

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

enum Item_result Item::temporal_with_date_as_number_result_type ( ) const [inline]

Similar to result_type() but makes DATE, DATETIME, TIMESTAMP pretend to be numbers rather than strings.

uint Item::time_precision ( ) [virtual]

TIME precision of the item: 0..6

Reimplemented in Item_temporal_func.

Field * Item::tmp_table_field_from_field_type ( TABLE table,
bool  fixed_length 
)

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

Return values:
NULLerror
\::Created field
Item * Item::transform ( Item_transformer  transformer,
uchar *  arg 
) [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:

  • this function can not be used at prepared statement prepare (in particular, in fix_fields!), as only permanent transformation of Item trees are allowed at prepare.
  • the transformer function shall allocate new Items in execution memory root (thd->mem_root) and not anywhere else: allocated items will be gone in the end of execution.

If you don't need to transform an item tree, but only traverse it, please use Item::walk() instead.

Parameters:
transformerfunctor that performs transformation of a subtree
argopaque argument passed to the functor
Returns:
Returns pointer to the new subtree root. THD::change_item_tree() should be called for it if transformation took place, i.e. if a pointer to newly allocated item is returned.

Reimplemented in Item_default_value, Item_ref, Item_equal, Item_cond, Item_func_make_set, Item_in_optimizer, Item_func, and Item_row.

bool Item::val_bool ( ) [virtual]
longlong Item::val_date_temporal ( ) [virtual]
virtual longlong Item::val_date_temporal_result ( ) [inline, virtual]

Get date value in packed longlong format. NULL is converted to 0.

Reimplemented in Item_field.

longlong Item::val_temporal_by_field_type ( ) [inline]

Return date or time value of item in packed longlong format, depending on item field type.

longlong Item::val_temporal_with_round ( enum_field_types  type,
uint8  dec 
)

Get date or time value in packed longlong format. Before conversion from MYSQL_TIME to packed format, the MYSQL_TIME value is rounded to "dec" fractional digits.

longlong Item::val_time_temporal ( ) [virtual]
virtual longlong Item::val_time_temporal_result ( ) [inline, virtual]

Get time value in packed longlong format. NULL is converted to 0.

Reimplemented in Item_field.


Member Data Documentation

This member has several successive meanings, depending on the phase we're in:

  • during field resolution: it contains the index, in the "all_fields" list, of the expression to which this field belongs; or a special constant UNDEF_POS; see st_select_lex::cur_pos_in_all_fields and match_exprs_for_only_full_group_by().
  • when attaching conditions to tables: it says whether some condition needs to be attached or can be omitted (for example because it is already implemented by 'ref' access)
  • when pushing index conditions: it says whether a condition uses only indexed columns
  • when creating an internal temporary table: it says how to store BIT fields
  • when we change DISTINCT to GROUP BY: it is used for book-keeping of fields.

Intrusive list pointer for free list. If not null, points to the next Item on some Query_arena's free list. For instance, stored procedures have their own Query_arena's.

See also:
Query_arena::free_list

Reimplemented in Item_sum.

bool Item::tables_locked_cache [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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines