MySQL  8.0.15
Source Code Documentation
Item Class Referenceabstract

#include <item.h>

Inheritance diagram for Item:
Parse_tree_node_tmpl< Context > 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 Parse_tree_item

Classes

struct  Cleanup_after_removal_context
 

Public Types

enum  Type {
  INVALID_ITEM = 0, FIELD_ITEM, 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,
  FIELD_BIT_ITEM, NULL_RESULT_ITEM
}
 
enum  cond_result { COND_UNDEF, COND_OK, COND_TRUE, COND_FALSE }
 
enum  traverse_order { POSTFIX, PREFIX }
 
enum  enum_walk {
  WALK_PREFIX = 0x01, WALK_POSTFIX = 0x02, WALK_SUBQUERY = 0x04, WALK_SUBQUERY_PREFIX = 0x05,
  WALK_SUBQUERY_POSTFIX = 0x06
}
 
enum  item_marker {
  MARKER_NONE = 0, MARKER_CONST_PROPAG = 1, MARKER_BIT = 4, MARKER_FUNC_DEP_NOT_NULL = 5,
  MARKER_DISTINCT_GROUP = 6, MARKER_ICP_COND_USES_INDEX_ONLY = 10
}
 < Values for member 'marker' More...
 
- Public Types inherited from Parse_tree_node_tmpl< Context >
typedef Context context_t
 

Public Member Functions

 Item (const Item &)=delete
 
void operator= (Item &)=delete
 
 Item ()
 Item constructor for general use. More...
 
 Item (THD *thd, Item *item)
 Constructor used by Item_field, Item_ref & aggregate functions. More...
 
 Item (const POS &)
 Parse-time context-independent constructor. More...
 
virtual ~Item () override
 
virtual bool itemize (Parse_context *pc, Item **res)
 The same as contextualize()/contextualize_() but with additional parameter. More...
 
void rename (char *new_name)
 rename item (used for views, cleanup() return original name). More...
 
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)
 Create a field to hold a string value from an item. More...
 
virtual bool fix_fields (THD *, Item **)
 
virtual void fix_after_pullout (SELECT_LEX *parent_select, SELECT_LEX *removed_select)
 Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion. More...
 
void quick_fix_field ()
 
virtual void set_can_use_prefix_key ()
 
type_conversion_status save_in_field_no_warnings (Field *field, bool no_conversions)
 Save the item into a field but do not emit any warnings. More...
 
type_conversion_status save_in_field (Field *field, bool no_conversions)
 Save a temporal value in packed longlong format into a Field. More...
 
virtual void save_org_in_field (Field *field)
 
virtual bool send (Protocol *protocol, String *str)
 This is only called from items that is not of type item_field. More...
 
bool evaluate (THD *thd, String *str)
 Evaluate item, possibly using the supplied buffer. More...
 
virtual bool eq (const Item *, bool binary_cmp) const
 
virtual Item_result result_type () const
 
virtual enum Item_result numeric_context_result_type () const
 Result type when an item appear in a numeric context. More...
 
enum Item_result temporal_with_date_as_number_result_type () const
 Similar to result_type() but makes DATE, DATETIME, TIMESTAMP pretend to be numbers rather than strings. More...
 
enum_field_types data_type () const
 Retrieve the derived data type of the Item. More...
 
void set_data_type (enum_field_types data_type)
 Set the data type of the current Item. More...
 
void set_data_type_bool ()
 
void set_data_type_longlong ()
 Set the data type of the Item to be longlong. More...
 
void set_data_type_decimal (uint8 precision, uint8 dec)
 Set the data type of the Item to be decimal. More...
 
void set_data_type_double ()
 Set the data type of the Item to be double precision floating point. More...
 
void set_data_type_float ()
 Set the data type of the Item to be single precision floating point. More...
 
void set_data_type_string_init ()
 Initialize an Item to be of VARCHAR type, other properties undetermined. More...
 
void set_data_type_string (uint32 max_l)
 Set the Item to be variable length string. More...
 
void set_data_type_string (ulonglong max_char_length_arg)
 Set the Item to be variable length string. More...
 
void set_data_type_string (ulonglong max_l, const CHARSET_INFO *cs)
 Set the Item to be variable length string. More...
 
void set_data_type_string (uint32 max_l, const DTCollation &coll)
 Set the Item to be variable length string. More...
 
void set_data_type_char (uint32 max_l)
 Set the Item to be fixed length string. More...
 
void set_data_type_char (uint32 max_l, const CHARSET_INFO *cs)
 Set the Item to be fixed length string. More...
 
void set_data_type_blob (uint32 max_l)
 Set the Item to be of BLOB type. More...
 
void set_data_type_date ()
 Set all type properties for Item of DATE type. More...
 
void set_data_type_time (uint8 fsp)
 Set all type properties for Item of TIME type. More...
 
void set_data_type_datetime (uint8 fsp)
 Set all properties for Item of DATETIME type. More...
 
void set_data_type_timestamp (uint8 fsp)
 Set all properties for Item of TIMESTAMP type. More...
 
void set_data_type_json ()
 Set the data type of the Item to be JSON. More...
 
void set_data_type_year ()
 Set the data type of the Item to be YEAR. More...
 
void set_data_type_geometry ()
 Set the Item to be of GEOMETRY type. More...
 
void set_data_type_from_result (Item_result result, uint32 length)
 Set type information of Item from "result" information. More...
 
void set_data_type_from_item (Item *item)
 Set data type properties of the item from the properties of another item. More...
 
virtual Item_result cast_to_int_type () const
 
virtual enum Type type () const =0
 
void aggregate_type (Bounds_checked_array< Item * > items)
 Aggregates data types from array of items into current item. More...
 
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 ()
 Return date value of item in packed longlong format. More...
 
virtual longlong val_time_temporal ()
 Return time value of item in packed longlong format. More...
 
longlong val_temporal_by_field_type ()
 Return date or time value of item in packed longlong format, depending on item field type. More...
 
longlong val_temporal_with_round (enum_field_types type, uint8 dec)
 Get date or time value in packed longlong format. More...
 
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 bool val_json (Json_wrapper *result)
 Get a JSON value from an Item. More...
 
virtual float get_filtering_effect (THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table)
 Calculate the filter contribution that is relevant for table 'filter_for_table' for this item. More...
 
bool error_json ()
 Get the value to return from val_json() in case of errors. More...
 
bool get_date_from_non_temporal (MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
 Convert a non-temporal type to date. More...
 
bool get_time_from_non_temporal (MYSQL_TIME *ltime)
 Convert a non-temporal type to time. More...
 
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 *)
 
virtual const char * full_name () const
 
virtual table_map used_tables () const
 
virtual table_map not_null_tables () const
 
virtual bool basic_const_item () const
 
virtual Itemclone_item () const
 
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 ()
 TIME precision of the item: 0..6. More...
 
virtual uint datetime_precision ()
 DATETIME precision of the item: 0..6. More...
 
bool const_item () const
 Returns true if item is constant, regardless of query evaluation state. More...
 
bool const_for_execution () const
 Returns true if item is constant during one query execution. More...
 
bool may_evaluate_const (THD *thd) const
 Return true if this is a const item that may be evaluated in the current phase of statement processing. More...
 
virtual void print (String *str, enum_query_type)
 This method is used for to: More...
 
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)
 Prints the item when it's part of ORDER BY and GROUP BY. More...
 
virtual void update_used_tables ()
 
virtual void split_sum_func (THD *, Ref_item_array, List< Item > &)
 
void split_sum_func2 (THD *thd, Ref_item_array ref_item_array, List< Item > &fields, Item **ref, bool skip_registered)
 Move SUM items out from item tree and replace with reference. More...
 
virtual bool get_date (MYSQL_TIME *ltime, my_time_flags_t fuzzydate)=0
 
virtual bool get_time (MYSQL_TIME *ltime)=0
 
virtual bool get_timeval (struct timeval *tm, int *warnings)
 Get timestamp in "struct timeval" format. More...
 
virtual bool is_null ()
 
bool update_null_value ()
 Make sure the null_value member has a correct value. More...
 
virtual void top_level_item ()
 
virtual void set_result_field (Field *)
 
virtual bool is_result_field () const
 
virtual bool is_bool_func () const
 
virtual void save_in_result_field (bool no_conversions)
 
virtual void no_rows_in_result ()
 
virtual Itemcopy_or_same (THD *)
 
virtual Itemcopy_andor_structure (THD *)
 
virtual Itemreal_item ()
 
virtual Itemsubstitutional_item ()
 
virtual void set_runtime_created ()
 
virtual Itemget_tmp_table_item (THD *thd)
 
virtual const CHARSET_INFOcompare_collation () const
 
virtual const CHARSET_INFOcharset_for_protocol () const
 
virtual bool walk (Item_processor processor, enum_walk walk, uchar *arg)
 Traverses a tree of Items in prefix and/or postfix order. More...
 
virtual Itemtransform (Item_transformer transformer, uchar *arg)
 Perform a generic transformation of the Item tree, by adding zero or more additional Item objects to it. More...
 
virtual Itemcompile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t)
 Perform a generic "compilation" of the Item tree, ie transform the Item tree by adding zero or more Item objects to it. More...
 
virtual void traverse_cond (Cond_traverser traverser, void *arg, traverse_order)
 
virtual bool intro_version (uchar *)
 
bool cleanup_processor (uchar *)
 cleanup() item if it is resolved ('fixed'). More...
 
virtual bool collect_item_field_processor (uchar *)
 
virtual bool add_field_to_set_processor (uchar *)
 Item::walk function. More...
 
virtual bool visitor_processor (uchar *arg)
 A processor to handle the select lex visitor framework. More...
 
virtual bool add_field_to_cond_set_processor (uchar *)
 Item::walk function. More...
 
virtual bool remove_column_from_bitmap (uchar *arg)
 Visitor interface for removing all column expressions (Item_field) in this expression tree from a bitmap. More...
 
virtual bool find_item_in_field_list_processor (uchar *)
 
virtual bool change_context_processor (uchar *)
 
virtual bool find_item_processor (uchar *arg)
 
virtual bool is_non_const_over_literals (uchar *)
 
virtual bool find_field_processor (uchar *)
 Is this an Item_field which references the given Field argument? More...
 
virtual bool mark_field_in_map (uchar *arg)
 Mark underlying field in read or write map of a table. More...
 
virtual bool contains_alias_of_expr (uchar *arg)
 
virtual bool reset_wf_state (uchar *arg)
 Reset execution state for such window function types as determined by arg. More...
 
virtual bool used_tables_for_level (uchar *arg)
 Return used table information for the specified query block (level). More...
 
virtual bool check_column_privileges (uchar *thd)
 Check privileges. More...
 
virtual bool inform_item_in_cond_of_tab (uchar *)
 
virtual bool clean_up_after_removal (uchar *arg)
 Clean up after removing the item from the item tree. More...
 
bool propagate_derived_used (uchar *)
 Propagate components that use referenced columns from derived tables. More...
 
bool propagate_set_derived_used (uchar *)
 Called by Item::walk() to set all the referenced items' derived_used flag. More...
 
virtual bool aggregate_check_distinct (uchar *)
 
virtual bool aggregate_check_group (uchar *)
 
virtual bool is_strong_side_column_not_in_fd (uchar *)
 
virtual bool is_column_not_in_fd (uchar *)
 
virtual Bool3 local_column (const SELECT_LEX *) const
 
virtual bool has_aggregate_ref_in_group_by (uchar *)
 Check if an aggregate is referenced from within the GROUP BY clause of the query block in which it is aggregated. More...
 
virtual bool cache_const_expr_analyzer (uchar **cache_item)
 Check if an item is a constant one and can be cached. More...
 
Itemcache_const_expr_transformer (uchar *item)
 Cache item if needed. More...
 
virtual bool equality_substitution_analyzer (uchar **)
 
virtual Itemequality_substitution_transformer (uchar *)
 
virtual bool check_partition_func_processor (uchar *)
 Check if a partition function is allowed. More...
 
virtual bool subst_argument_checker (uchar **arg)
 
virtual bool explain_subquery_checker (uchar **)
 
virtual Itemexplain_subquery_propagator (uchar *)
 
virtual Itemequal_fields_propagator (uchar *)
 
virtual bool set_no_const_sub (uchar *)
 
virtual Itemreplace_equal_field (uchar *)
 
virtual bool check_valid_arguments_processor (uchar *)
 
virtual bool check_function_as_value_generator (uchar *args)
 Check if this item is allowed for a virtual column or inside a default expression. More...
 
virtual bool check_gcol_depend_default_processor (uchar *args)
 Check if a generated expression depends on DEFAULT function with specific column name as argument. More...
 
virtual Itemthis_item ()
 
virtual const Itemthis_item () const
 
virtual Item ** this_item_addr (THD *, Item **addr_arg)
 
virtual uint cols () const
 
virtual Itemelement_index (uint)
 
virtual Item ** addr (uint)
 
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)
 Create a field based on field_type of argument. More...
 
virtual Item_fieldfield_for_view_update ()
 
virtual Itemneg_transformer (THD *)
 
virtual Itemupdate_value_transformer (uchar *)
 
virtual Itemsafe_charset_converter (THD *thd, const CHARSET_INFO *tocs)
 
void delete_self ()
 
virtual bool is_splocal () const
 
virtual Settable_routine_parameterget_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
 Check whether this and the given item has compatible comparison context. More...
 
virtual Field::geometry_type get_geometry_type () const
 
Stringcheck_well_formed_result (String *str, bool send_error, bool truncate)
 Verifies that the input string is well-formed according to its character set. More...
 
bool eq_by_collation (Item *item, bool binary_cmp, const CHARSET_INFO *cs)
 
virtual bool is_expensive ()
 
uint32 max_char_length () const
 
void fix_char_length (uint32 max_char_length_arg)
 
virtual bool is_outer_field () const
 
bool 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. More...
 
bool has_subquery () const
 
bool has_stored_program () const
 
bool has_aggregation () const
 
void set_aggregation ()
 Set the "has aggregation" property. More...
 
void reset_aggregation ()
 Reset the "has aggregation" property. More...
 
bool has_wf () const
 
void set_wf ()
 Set the "has window function" property. More...
 
virtual bool created_by_in2exists () const
 Whether this Item was created by the IN->EXISTS subquery transformation. More...
 
bool is_derived_used () const
 
void mark_subqueries_optimized_away ()
 
virtual bool gc_subst_analyzer (uchar **)
 Analyzer function for GC substitution. More...
 
virtual Itemgc_subst_transformer (uchar *)
 Transformer function for GC substitution. More...
 
virtual bool replace_field_processor (uchar *)
 A processor that replaces any Fields with a Create_field_wrapper. More...
 
bool can_be_substituted_for_gc () const
 Check if this item is of a type that is eligible for GC substitution. More...
 
void aggregate_decimal_properties (Item **item, uint nitems)
 Set precision and decimals of function when this depends on arguments' values for these quantities. More...
 
void aggregate_float_properties (Item **item, uint nitems)
 Set max_length and decimals of function if function is floating point and result length/precision depends on argument ones. More...
 
void aggregate_char_length (Item **args, uint nitems)
 Set the maximum number of characters required by any of the items in args. More...
 
void aggregate_temporal_properties (Item **item, uint nitems)
 Set fractional seconds precision for temporal functions. More...
 
bool aggregate_string_properties (const char *name, Item **item, uint nitems)
 Aggregate string properties (character set, collation and maximum length) for string function. More...
 
void aggregate_num_type (Item_result result_type, Item **item, uint nitems)
 This function is used to resolve type for numeric result type of CASE, COALESCE, IF and LEAD/LAG. More...
 
virtual bool repoint_const_outer_ref (uchar *arg)
 This function applies only to Item_field objects referred to by an Item_ref object that has been marked as a const_item. More...
 
virtual Fieldget_orig_field ()
 
virtual void set_orig_field (Field *)
 
void set_has_rollup_field ()
 
bool has_rollup_field ()
 
virtual bool has_grouping_func_processor (uchar *)
 
virtual bool supports_partial_update (const Field_json *field) const
 Check if this expression can be used for partial update of a given JSON column. More...
 
- Public Member Functions inherited from Parse_tree_node_tmpl< Context >
virtual ~Parse_tree_node_tmpl ()
 
bool is_contextualized () const
 
virtual bool contextualize (Context *pc)
 Do all context-sensitive things and mark the node as contextualized. More...
 
virtual bool contextualize_ (Context *)
 Intermediate version of the contextualize() function. More...
 
void error (Context *pc, const POS &pos) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 
void error (Context *pc, const POS &pos, const char *msg) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 
void errorf (Context *pc, const POS &pos, const char *format,...) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 

Static Public Member Functions

static void * operator new (size_t size) noexcept
 
static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void operator delete (void *ptr, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 
static enum_field_types type_for_variable (enum_field_types src_type)
 Provide data type for a user or system variable, based on the type of the item that is assigned to the variable. More...
 
static enum_field_types string_field_type (uint32 max_bytes)
 Determine correct string field type, based on string length. More...
 
static const CHARSET_INFOdefault_charset ()
 
- Static Public Member Functions inherited from Parse_tree_node_tmpl< Context >
static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void operator delete (void *ptr, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 

Public Attributes

Itemnext_free
 Intrusive list pointer for free list. More...
 
DTCollation collation
 Character set and collation properties assigned for this Item. More...
 
Item_name_string item_name
 Name from query. More...
 
Item_name_string orig_name
 Original item name (if it was renamed) More...
 
uint32 max_length
 Maximum length of result of evaluating this item, in number of bytes. More...
 
item_marker marker
 This member has several successive meanings, depending on the phase we're in: More...
 
Item_result cmp_context
 Comparison context. More...
 
bool fixed
 True if item has been resolved. More...
 
uint8 decimals
 Number of decimals in result when evaluating this item. More...
 
bool maybe_null
 True if this item may be null. More...
 
bool null_value
 True if item is null. More...
 
bool unsigned_flag
 
bool m_is_window_function
 True if item represents window func. More...
 

Protected Member Functions

Stringmake_empty_result ()
 Sets the result value of the function an empty string, using the current character set. More...
 
bool skip_itemize (Item **res)
 Helper function to skip itemize() for grammar-allocated items. More...
 
virtual type_conversion_status save_in_field_inner (Field *field, bool no_conversions)
 Helper function which does all of the work for save_in_field(Field*, bool), except some error checking common to all subclasses, which is performed by save_in_field() itself. More...
 
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 error_bool ()
 Get the value to return from val_bool() in case of errors. More...
 
int error_int ()
 Get the value to return from val_int() in case of errors. More...
 
double error_real ()
 Get the value to return from val_real() in case of errors. More...
 
Stringerror_str ()
 Get the value to return from val_str() in case of errors. More...
 
Stringnull_return_str ()
 Gets the value to return from val_str() when returning a NULL value. More...
 
bool get_date_from_string (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_str() to date in MYSQL_TIME. More...
 
bool get_date_from_real (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_real() to date in MYSQL_TIME. More...
 
bool get_date_from_decimal (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_decimal() to date in MYSQL_TIME. More...
 
bool get_date_from_int (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_int() to date in MYSQL_TIME. More...
 
bool get_date_from_time (MYSQL_TIME *ltime)
 Convert get_time() from time to date in MYSQL_TIME. More...
 
bool get_date_from_numeric (MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
 Convert a numeric type to date. More...
 
bool get_time_from_string (MYSQL_TIME *ltime)
 Convert val_str() to time in MYSQL_TIME. More...
 
bool get_time_from_real (MYSQL_TIME *ltime)
 Convert val_real() to time in MYSQL_TIME. More...
 
bool get_time_from_decimal (MYSQL_TIME *ltime)
 Convert val_decimal() to time in MYSQL_TIME. More...
 
bool get_time_from_int (MYSQL_TIME *ltime)
 Convert val_int() to time in MYSQL_TIME. More...
 
bool get_time_from_date (MYSQL_TIME *ltime)
 Convert date to time. More...
 
bool get_time_from_datetime (MYSQL_TIME *ltime)
 Convert datetime to time. More...
 
bool get_time_from_numeric (MYSQL_TIME *ltime)
 Convert a numeric type to time. More...
 
void set_accum_properties (const Item *item)
 Set accumulated properties for an Item. More...
 
void add_accum_properties (const Item *item)
 Add more accumulated properties to an Item. More...
 
void set_subquery ()
 Set the "has subquery" property. More...
 
void set_stored_program ()
 Set the "has stored program" property. More...
 
- Protected Member Functions inherited from Parse_tree_node_tmpl< Context >
 Parse_tree_node_tmpl ()
 

Static Protected Member Functions

static bool bit_func_returns_binary (const Item *a, const Item *b)
 
static bool mark_field_in_map (Mark_field *mark_field, Field *field)
 Helper function for mark_field_in_map(uchar *arg). More...
 

Protected Attributes

String str_value
 str_values's main purpose is to cache the value in save_in_field More...
 
uint8 m_accum_properties
 

Static Protected Attributes

static constexpr uint8 PROP_SUBQUERY = 0x01
 Set of properties that are calculated by accumulation from underlying items. More...
 
static constexpr uint8 PROP_STORED_PROGRAM = 0x02
 
static constexpr uint8 PROP_AGGREGATION = 0x04
 
static constexpr uint8 PROP_WINDOW_FUNCTION = 0x08
 

Private Types

typedef Parse_tree_node super
 

Private Member Functions

virtual bool is_expensive_processor (uchar *)
 
bool contextualize (Parse_context *) override
 
bool contextualize_ (Parse_context *) override
 
virtual bool subq_opt_away_processor (uchar *)
 
void set_derived_used ()
 

Private Attributes

const bool is_parser_item
 true if allocated directly by parser More...
 
bool runtime_item
 
int8 is_expensive_cache
 Cache of result of is_expensive() More...
 
uint8 m_data_type
 Data type assigned to Item. More...
 
bool derived_used
 True if this is an expression from the select list of a derived table which is actually used by outer query. More...
 
bool m_has_rollup_field
 

Friends

class udf_handler
 

Member Typedef Documentation

◆ super

typedef Parse_tree_node Item::super
private

Member Enumeration Documentation

◆ cond_result

Enumerator
COND_UNDEF 
COND_OK 
COND_TRUE 
COND_FALSE 

◆ enum_walk

Enumerator
WALK_PREFIX 
WALK_POSTFIX 
WALK_SUBQUERY 
WALK_SUBQUERY_PREFIX 
WALK_SUBQUERY_POSTFIX 

◆ item_marker

< Values for member 'marker'

Enumerator
MARKER_NONE 
MARKER_CONST_PROPAG 
MARKER_BIT 
MARKER_FUNC_DEP_NOT_NULL 
MARKER_DISTINCT_GROUP 
MARKER_ICP_COND_USES_INDEX_ONLY 

◆ traverse_order

Enumerator
POSTFIX 
PREFIX 

◆ Type

enum Item::Type
Enumerator
INVALID_ITEM 
FIELD_ITEM 
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 
FIELD_BIT_ITEM 
NULL_RESULT_ITEM 

Constructor & Destructor Documentation

◆ Item() [1/4]

Item::Item ( const Item )
delete

◆ Item() [2/4]

Item::Item ( )

Item constructor for general use.

◆ Item() [3/4]

Item::Item ( THD thd,
Item item 
)

Constructor used by Item_field, Item_ref & aggregate functions.

Used for duplicating lists in processing queries with temporary tables.

Also used for Item_cond_and/Item_cond_or for creating top AND/OR structure of WHERE clause to protect it of optimisation changes in prepared statements

◆ Item() [4/4]

Item::Item ( const POS )
explicit

Parse-time context-independent constructor.

This constructor and caller constructors of child classes must not access/change thd->lex (including thd->lex->current_select(), thd->m_parser_state etc structures).

If we need to finalize the construction of the object, then we move all context-sensitive code to the itemize() virtual function.

The POS parameter marks this constructor and other context-independent constructors of child classes for easy recognition/separation from other (context-dependent) constructors.

◆ ~Item()

virtual Item::~Item ( )
inlineoverridevirtual

Member Function Documentation

◆ add_accum_properties()

void Item::add_accum_properties ( const Item item)
inlineprotected

Add more accumulated properties to an Item.

◆ add_field_to_cond_set_processor()

virtual bool Item::add_field_to_cond_set_processor ( uchar )
inlinevirtual

Item::walk function.

Set bit in table->cond_set for all fields of all tables that are referred to by the Item.

Reimplemented in Item_field.

◆ add_field_to_set_processor()

virtual bool Item::add_field_to_set_processor ( uchar )
inlinevirtual

Item::walk function.

Set bit in table->tmp_set for all fields in table 'arg' that are referred to by the Item.

Reimplemented in Item_field.

◆ addr()

virtual Item** Item::addr ( uint  )
inlinevirtual

◆ aggregate_char_length()

void Item::aggregate_char_length ( Item **  args,
uint  nitems 
)

Set the maximum number of characters required by any of the items in args.

◆ aggregate_check_distinct()

virtual bool Item::aggregate_check_distinct ( uchar )
inlinevirtual
See also
Distinct_check::check_query()

Reimplemented in Item_ident, Item_func_any_value, and Item_sum.

◆ aggregate_check_group()

virtual bool Item::aggregate_check_group ( uchar )
inlinevirtual
See also
Group_check::check_query()

Reimplemented in Item_ident, Item_func_grouping, Item_func_any_value, and Item_sum.

◆ aggregate_decimal_properties()

void Item::aggregate_decimal_properties ( Item **  item,
uint  nitems 
)

Set precision and decimals of function when this depends on arguments' values for these quantities.

Parameters
itemArgument array.
nitemsNumber of arguments in the array.

◆ aggregate_float_properties()

void Item::aggregate_float_properties ( Item **  item,
uint  nitems 
)

Set max_length and decimals of function if function is floating point and result length/precision depends on argument ones.

Parameters
itemArgument array.
nitemsNumber of arguments in the array.

◆ aggregate_num_type()

void Item::aggregate_num_type ( Item_result  result_type,
Item **  item,
uint  nitems 
)

This function is used to resolve type for numeric result type of CASE, COALESCE, IF and LEAD/LAG.

COALESCE is a CASE abbreviation according to the standard.

Parameters
result_typeThe desired result type
itemThe arguments of func
nitemsThe number of arguments

◆ aggregate_string_properties()

bool Item::aggregate_string_properties ( const char *  name,
Item **  items,
uint  nitems 
)

Aggregate string properties (character set, collation and maximum length) for string function.

Parameters
nameName of function
itemsArgument array.
nitemsNumber of arguments.
Return values
Falseon success, true on error.

◆ aggregate_temporal_properties()

void Item::aggregate_temporal_properties ( Item **  item,
uint  nitems 
)

Set fractional seconds precision for temporal functions.

Parameters
itemArgument array
nitemsNumber of arguments in the array.

◆ aggregate_type()

void Item::aggregate_type ( Bounds_checked_array< Item * >  items)

Aggregates data types from array of items into current item.

Parameters
itemsarray of items to aggregate the type from

This function aggregates all type information from the array of items. Found type is supposed to be used later as the result data type of a multi-argument function. Aggregation itself is performed partially by the Field::field_type_merge() function.

◆ basic_const_item()

virtual bool Item::basic_const_item ( ) const
inlinevirtual

◆ bit_func_returns_binary()

bool Item::bit_func_returns_binary ( const Item a,
const Item b 
)
staticprotected

◆ bring_value()

virtual void Item::bring_value ( )
inlinevirtual

◆ cache_const_expr_analyzer()

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

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

Parameters
[out]argIf != NULL <=> Cache this item.
Returns
true Go deeper in item tree.
false Don't go deeper in item tree.

Reimplemented in Item_name_const.

◆ cache_const_expr_transformer()

Item * Item::cache_const_expr_transformer ( uchar arg)

Cache item if needed.

Parameters
arg!= NULL <=> Cache this item.
Returns
cache if cache needed.
this otherwise.

◆ can_be_substituted_for_gc()

bool Item::can_be_substituted_for_gc ( ) const
inline

Check if this item is of a type that is eligible for GC substitution.

All items that belong to subclasses of Item_func are eligible for substitution.

See also
substitute_gc()

◆ cast_to_int_type()

virtual Item_result Item::cast_to_int_type ( ) const
inlinevirtual

◆ change_context_processor()

virtual bool Item::change_context_processor ( uchar )
inlinevirtual

◆ charset_for_protocol()

virtual const CHARSET_INFO* Item::charset_for_protocol ( void  ) const
inlinevirtual

◆ check_cols()

bool Item::check_cols ( uint  c)
virtual

◆ check_column_privileges()

virtual bool Item::check_column_privileges ( uchar thd)
inlinevirtual

Check privileges.

Parameters
thdthread handle

Reimplemented in Item_view_ref, and Item_field.

◆ check_function_as_value_generator()

bool Item::check_function_as_value_generator ( uchar args)
virtual

Check if this item is allowed for a virtual column or inside a default expression.

Should be overridden in child classes.

Parameters
[in,out]argsDue to the limitation of Item::walk() it is declared as a pointer to uchar, underneath there's a actually a structure of type Check_function_as_value_generator_parameters. It is used mainly in Item_field.
Returns
true if function is not accepted

Reimplemented in Item_type_holder, Item_cache, Item_trigger_field, Item_insert_value, Item_copy, Item_ref, Item_result_field, Item_blob, Item_static_string_func, Item_int, Item_param, Item_func_uuid_short, Item_func_found_rows, Item_func_sp, Item_func_row_count, Item_null_result, Item_func_is_used_lock, Item_func_is_free_lock, Item_field, Item_func_match, Item_basic_constant, Item_var_func, Item_master_pos_wait, Item_func_release_all_locks, Item_func_release_lock, Item_func_get_lock, Item_udf_func, Item_func_sleep, Item_func_benchmark, Item_func_last_insert_id, Item_std_field, Item_variance_field, Item_func_rand, Item_func_floor, Item_func_ceiling, Item_func_uuid, Item_func_now, Item_sum_hybrid_field, Item_func_curdate, Item_func_abs, Item_func_neg, Item_func_mod, Item_func_curtime, Item_func_int_div, Item_func_mul, Item_load_file, Item_func_additive_op, Item_func_connection_id, Item_func_user, Item_func, Item_func_sysconst, Item_nodeset_to_const_comparator, Item_func_unix_timestamp, Item_func_statement_digest_text, Item_func_statement_digest, Item_subselect, Item_nodeset_func, Item_row, Item_func_xml_update, Item_proc_int, Item_xml_str_func, and Item_proc.

◆ check_gcol_depend_default_processor()

virtual bool Item::check_gcol_depend_default_processor ( uchar args)
inlinevirtual

Check if a generated expression depends on DEFAULT function with specific column name as argument.

Parameters
[in]argsName of column used as DEFAULT function argument.
Returns
false if the function is not DEFAULT(args), otherwise true.

Reimplemented in Item_default_value.

◆ check_partition_func_processor()

virtual bool Item::check_partition_func_processor ( uchar )
inlinevirtual

Check if a partition function is allowed.

Returns
whether a partition function is not accepted

check_partition_func_processor is used to check if a partition function uses an allowed function. An allowed function will always ensure that X=Y guarantees that also part_function(X)=part_function(Y) where X is a set of partition fields and so is Y. The problems comes mainly from character sets where two equal strings can be quite unequal. E.g. the german character for double s is equal to 2 s.

The default is that an item is not allowed in a partition function. Allowed functions can never depend on server version, they cannot depend on anything related to the environment. They can also only depend on a set of fields in the table itself. They cannot depend on other tables and cannot contain any queries and cannot contain udf's or similar. If a new Item class is defined and it inherits from a class that is allowed in a partition function then it is very important to consider whether this should be inherited to the new class. If not the function below should be defined in the new Item class.

The general behaviour is that most integer functions are allowed. If the partition function contains any multi-byte collations then the function check_part_func_fields will report an error on the partition function independent of what functions are used. So the only character sets allowed are single character collation and even for those only a limited set of functions are allowed. The problem with multi-byte collations is that almost every string function has the ability to change things such that two strings that are equal will not be equal after manipulated by a string function. E.g. two strings one contains a double s, there is a special german character that is equal to two s. Now assume a string function removes one character at this place, then in one the double s will be removed and in the other there will still be one s remaining and the strings are no longer equal and thus the partition function will not sort equal strings into the same partitions.

So the check if a partition function is valid is two steps. First check that the field types are valid, next check that the partition function is valid. The current set of partition functions valid assumes that there are no multi-byte collations amongst the partition fields.

Reimplemented in Item_hex_string, Item_static_string_func, Item_string, Item_decimal, Item_int, Item_func_uuid_short, Item_null_result, Item_null, Item_field, Item_num, Item_func_microsecond, Item_extract, Item_func_from_days, Item_func_floor, Item_func_ceiling, Item_func_abs, Item_func_neg, Item_func_mod, Item_func_int_div, Item_func_mul, Item_datetime_literal, Item_func_additive_op, Item_time_literal, Item_date_literal, Item_func_time_to_sec, Item_func_unix_timestamp, Item_func_dayname, Item_func_weekday, Item_func_year, Item_func_yearweek, Item_func_second, Item_func_quarter, Item_func_minute, Item_func_hour, Item_func_dayofyear, Item_func_monthname, Item_func_month, Item_func_dayofmonth, Item_func_to_seconds, and Item_func_to_days.

◆ check_valid_arguments_processor()

◆ check_well_formed_result()

String * Item::check_well_formed_result ( String str,
bool  send_error,
bool  truncate 
)

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

Parameters
str
send_errorIf true, call my_error if string is not well-formed.
truncateIf true, set to null/truncate if not well-formed.
Returns
If well-formed: input string. If not well-formed: if truncate is true and strict mode: NULL pointer and we set this Item's value to NULL. if truncate is true and not strict mode: input string truncated up to last good character. if truncate is false: input string is returned.

◆ clean_up_after_removal()

virtual bool Item::clean_up_after_removal ( uchar arg)
inlinevirtual

Clean up after removing the item from the item tree.

Parameters
argpointer to a Cleanup_after_removal_context object

Reimplemented in Item_sum, and Item_subselect.

◆ cleanup()

◆ cleanup_processor()

bool Item::cleanup_processor ( uchar )
inline

cleanup() item if it is resolved ('fixed').

◆ clone_item()

virtual Item* Item::clone_item ( ) const
inlinevirtual
Returns
cloned item if it is constant
Return values
nullptrif this is not const

Reimplemented in Item_time_with_ref, Item_datetime_with_ref, Item_int_with_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_uint, Item_temporal, Item_int, Item_param, and Item_null.

◆ collect_item_field_processor()

virtual bool Item::collect_item_field_processor ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ cols()

virtual uint Item::cols ( ) const
inlinevirtual

◆ compare_collation()

virtual const CHARSET_INFO* Item::compare_collation ( ) const
inlinevirtual

◆ compile()

virtual Item* Item::compile ( Item_analyzer  analyzer,
uchar **  arg_p,
Item_transformer  transformer,
uchar arg_t 
)
inlinevirtual

Perform a generic "compilation" of the Item tree, ie transform the Item tree by adding zero or more Item objects to it.

Parameters
analyzerAnalyzer function, see details section
[in,out]arg_pPointer to struct used by analyzer function
transformerTransformer function, see details section
[in,out]arg_tPointer to struct used by transformer function
Returns
Returned item tree after transformation, NULL if error

The process of this transformation is assumed to be as follows:

compile() { if (this->*some_analyzer(...)) { compile children if any; return this->*some_transformer(...); } else return this; }

i.e. analysis is performed top-down while transformation is done bottom-up. If no transformation is applied, the item is returned unchanged. A transformation error is indicated by returning a NULL pointer. Notice that the analyzer function should never cause an error.

The function is supposed to be used during the optimization stage of query execution. All new allocations are recorded using THD::change_item_tree() so that they can be rolled back after execution.

Reimplemented in Item_ref, Item_cond, and Item_func.

◆ const_for_execution()

bool Item::const_for_execution ( ) const
inline

Returns true if item is constant during one query execution.

If const_for_execution() is true but const_item() is false, value is not available before tables have been locked and parameters have been assigned values. This applies to

  • statement parameters
  • non-dependent subqueries
  • deterministic stored functions that contain SQL code. For items where the default implementation of used_tables() and const_item() are effective, const_item() will always return true.

◆ const_item()

bool Item::const_item ( ) const
inline

Returns true if item is constant, regardless of query evaluation state.

An expression is constant if it:

  • refers no tables.
  • refers no subqueries that refers any tables.
  • refers no non-deterministic functions.
  • refers no statement parameters.

◆ contains_alias_of_expr()

virtual bool Item::contains_alias_of_expr ( uchar arg)
inlinevirtual
Returns
true if the expression contains a reference, through an alias, to an expression of the SELECT list of the given query block.
Parameters
argquery block to search in.

Reimplemented in Item_ref.

◆ contextualize()

bool Item::contextualize ( Parse_context )
inlineoverrideprivate

◆ contextualize_()

bool Item::contextualize_ ( Parse_context )
inlineoverrideprivate

◆ copy_andor_structure()

virtual Item* Item::copy_andor_structure ( THD )
inlinevirtual

Reimplemented in Item_cond_or, and Item_cond_and.

◆ copy_or_same()

◆ created_by_in2exists()

virtual bool Item::created_by_in2exists ( ) const
inlinevirtual

Whether this Item was created by the IN->EXISTS subquery transformation.

Reimplemented in Item_ref, and Item_bool_func.

◆ data_type()

enum_field_types Item::data_type ( ) const
inline

Retrieve the derived data type of the Item.

◆ datetime_precision()

uint Item::datetime_precision ( )
virtual

DATETIME precision of the item: 0..6.

Reimplemented in Item_temporal_func.

◆ decimal_int_part()

int Item::decimal_int_part ( ) const
inline

◆ decimal_precision()

◆ default_charset()

const CHARSET_INFO * Item::default_charset ( )
static

◆ delete_self()

void Item::delete_self ( )
inline

◆ element_index()

virtual Item* Item::element_index ( uint  )
inlinevirtual

◆ eq()

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

◆ eq_by_collation()

bool Item::eq_by_collation ( Item item,
bool  binary_cmp,
const CHARSET_INFO cs 
)

◆ eq_cmp_result()

virtual cond_result Item::eq_cmp_result ( ) const
inlinevirtual

◆ equal_fields_propagator()

virtual Item* Item::equal_fields_propagator ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ equality_substitution_analyzer()

virtual bool Item::equality_substitution_analyzer ( uchar **  )
inlinevirtual

Reimplemented in Item_equal, Item_cond, and Item_func_eq.

◆ equality_substitution_transformer()

virtual Item* Item::equality_substitution_transformer ( uchar )
inlinevirtual

Reimplemented in Item_equal, and Item_func_eq.

◆ error_bool()

bool Item::error_bool ( )
inlineprotected

Get the value to return from val_bool() in case of errors.

This function is called from val_bool() when an error has occurred and we need to return something to abort evaluation of the item. The expected pattern in val_bool() is

if (<error condition>) { my_error(...) return error_bool(); }

Returns
The value val_bool() should return.

◆ error_int()

int Item::error_int ( )
inlineprotected

Get the value to return from val_int() in case of errors.

See also
Item::error_bool
Returns
The value val_int() should return.

◆ error_json()

bool Item::error_json ( )
inline

Get the value to return from val_json() in case of errors.

See also
Item::error_bool
Returns
The value val_json() should return, which is true.

◆ error_real()

double Item::error_real ( )
inlineprotected

Get the value to return from val_real() in case of errors.

See also
Item::error_bool
Returns
The value val_real() should return.

◆ error_str()

String* Item::error_str ( )
inlineprotected

Get the value to return from val_str() in case of errors.

See also
Item::error_bool
Returns
The value val_str() should return.

◆ evaluate()

bool Item::evaluate ( THD thd,
String buffer 
)

Evaluate item, possibly using the supplied buffer.

Parameters
thdThread context
bufferBuffer, in case item needs a large one
Returns
false if success, true if error

◆ explain_subquery_checker()

virtual bool Item::explain_subquery_checker ( uchar **  )
inlinevirtual

Reimplemented in Item_ref, and Item_subselect.

◆ explain_subquery_propagator()

virtual Item* Item::explain_subquery_propagator ( uchar )
inlinevirtual

◆ field_for_view_update()

virtual Item_field* Item::field_for_view_update ( )
inlinevirtual

Reimplemented in Item_ref, Item_field, and Item_func_set_collation.

◆ find_field_processor()

virtual bool Item::find_field_processor ( uchar )
inlinevirtual

Is this an Item_field which references the given Field argument?

Reimplemented in Item_field.

◆ find_item_in_field_list_processor()

virtual bool Item::find_item_in_field_list_processor ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ find_item_processor()

virtual bool Item::find_item_processor ( uchar arg)
inlinevirtual

◆ fix_after_pullout()

virtual void Item::fix_after_pullout ( SELECT_LEX parent_select,
SELECT_LEX removed_select 
)
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.

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_cache, Item_outer_ref, Item_ref, Item_func_sp, Item_ident, Item_cond, Item_func_in, Item_func_if, Item_func_between, Item_in_subselect, Item_sum, Item_in_optimizer, Item_func, Item_subselect, and Item_row.

◆ fix_char_length()

void Item::fix_char_length ( uint32  max_char_length_arg)
inline

◆ fix_fields()

◆ float_length()

uint Item::float_length ( uint  decimals_par) const
inline

◆ full_name()

virtual const char* Item::full_name ( ) const
inlinevirtual

Reimplemented in Item_ident.

◆ gc_subst_analyzer()

virtual bool Item::gc_subst_analyzer ( uchar **  )
inlinevirtual

Analyzer function for GC substitution.

See also
substitute_gc()

Reimplemented in Item_cond_or, Item_cond_and, Item_func_in, Item_func_between, Item_func_lt, Item_func_le, Item_func_gt, Item_func_ge, and Item_func_eq.

◆ gc_subst_transformer()

virtual Item* Item::gc_subst_transformer ( uchar )
inlinevirtual

Transformer function for GC substitution.

See also
substitute_gc()

Reimplemented in Item_func.

◆ get_date()

virtual bool Item::get_date ( MYSQL_TIME ltime,
my_time_flags_t  fuzzydate 
)
pure virtual

Implemented in Item_type_holder, Item_cache_json, Item_cache_datetime, Item_cache_row, Item_cache_str, Item_cache_decimal, Item_cache_real, Item_cache_int, Item_copy_decimal, Item_copy_float, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_temporal_with_ref, Item_ref_null_helper, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_temporal, Item_int, Item_param, Item_func_sp, Item_null, Item_field, Item_ident_for_show, Item_user_var_as_out_param, Item_name_const, Item_sp_variable, Item_var_func, Item_nth_value, Item_first_last_value, Item_lead_lag, Item_non_framing_wf, Item_func_group_concat, Item_func_udf_str, Item_sum_udf_decimal, Item_func_udf_decimal, Item_sum_udf_str, Item_func_udf_int, Item_func_udf_float, Item_sum_udf_int, Item_sum_udf_float, Item_sum_bit, Item_func_internal_check_time, Item_func_internal_update_time, Item_func_bit, Item_sum_hybrid, Item_func_last_day, Item_func_case, Item_func_makedate, Item_datetime_typecast, Item_func_rollup_const, Item_date_typecast, Item_func_convert_tz, Item_func_from_unixtime, Item_func_from_days, Item_func_sysdate_local, Item_sum_json, Item_sum_bit_field, Item_func_now, Item_sum_num_field, Item_func_if, Item_func_curdate, Item_datetime_literal, Item_sum_int, Item_decimal_typecast, Item_sum_num, Item_date_literal, Item_int_func, Item_time_func, Item_func_numhybrid, Item_datetime_func, Item_real_func, Item_date_func, Item_temporal_hybrid_func, Item_timeval_func, Item_exists_subselect, Item_func_dayname, Item_func_regexp_substr, Item_func_weekday, Item_func_regexp_replace, Item_func_regexp_like, Item_singlerow_subselect, Item_func_regexp_instr, Item_json_func, Item_func_month, Item_str_func, Item_proc_string, Item_row, Parse_tree_item, and Item_proc_int.

◆ get_date_from_decimal()

bool Item::get_date_from_decimal ( MYSQL_TIME ltime,
my_time_flags_t  flags 
)
protected

Convert val_decimal() to date in MYSQL_TIME.

◆ get_date_from_int()

bool Item::get_date_from_int ( MYSQL_TIME ltime,
my_time_flags_t  flags 
)
protected

Convert val_int() to date in MYSQL_TIME.

◆ get_date_from_non_temporal()

bool Item::get_date_from_non_temporal ( MYSQL_TIME ltime,
my_time_flags_t  fuzzydate 
)

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!

◆ get_date_from_numeric()

bool Item::get_date_from_numeric ( MYSQL_TIME ltime,
my_time_flags_t  fuzzydate 
)
protected

Convert a numeric type to date.

◆ get_date_from_real()

bool Item::get_date_from_real ( MYSQL_TIME ltime,
my_time_flags_t  flags 
)
protected

Convert val_real() to date in MYSQL_TIME.

◆ get_date_from_string()

bool Item::get_date_from_string ( MYSQL_TIME ltime,
my_time_flags_t  flags 
)
protected

Convert val_str() to date in MYSQL_TIME.

◆ get_date_from_time()

bool Item::get_date_from_time ( MYSQL_TIME ltime)
protected

Convert get_time() from time to date in MYSQL_TIME.

◆ get_filtering_effect()

virtual float Item::get_filtering_effect ( THD thd,
table_map  filter_for_table,
table_map  read_tables,
const MY_BITMAP fields_to_ignore,
double  rows_in_table 
)
inlinevirtual

Calculate the filter contribution that is relevant for table 'filter_for_table' for this item.

Parameters
thdThread handler
filter_for_tableThe table we are calculating filter effect for
read_tablesTables earlier in the join sequence. Predicates for table 'filter_for_table' that rely on values from these tables can be part of the filter effect.
fields_to_ignoreFields in 'filter_for_table' that should not be part of the filter calculation. The filtering effect of these fields is already part of the calculation somehow (e.g. because there is a predicate "col = <const>", and the optimizer has decided to do ref access on 'col').
rows_in_tableThe number of rows in table 'filter_for_table'
Returns
the filtering effect (between 0 and 1) this Item contributes with.

Reimplemented in Item_field, Item_func_match, Item_cond_or, Item_cond_and, Item_equal, Item_func_like, Item_func_isnotnull, Item_func_isnull, Item_func_in, Item_func_between, Item_func_ne, Item_func_lt, Item_func_le, Item_func_gt, Item_func_ge, Item_func_equal, Item_func_eq, Item_func_not, and Item_func_xor.

◆ get_geometry_type()

◆ get_monotonicity_info()

virtual enum_monotonicity_info Item::get_monotonicity_info ( ) const
inlinevirtual

◆ get_orig_field()

virtual Field* Item::get_orig_field ( )
inlinevirtual

Reimplemented in Item_field.

◆ get_settable_routine_parameter()

virtual Settable_routine_parameter* Item::get_settable_routine_parameter ( )
inlinevirtual

◆ get_time()

virtual bool Item::get_time ( MYSQL_TIME ltime)
pure virtual

Implemented in Item_type_holder, Item_cache_json, Item_cache_datetime, Item_cache_row, Item_cache_str, Item_cache_decimal, Item_cache_real, Item_cache_int, Item_copy_decimal, Item_copy_float, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_temporal_with_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_temporal, Item_int, Item_param, Item_func_sp, Item_null, Item_field, Item_ident_for_show, Item_user_var_as_out_param, Item_name_const, Item_sp_variable, Item_var_func, Item_nth_value, Item_first_last_value, Item_lead_lag, Item_non_framing_wf, Item_func_group_concat, Item_func_udf_str, Item_sum_udf_decimal, Item_func_udf_decimal, Item_sum_udf_str, Item_func_udf_int, Item_func_udf_float, Item_sum_udf_int, Item_sum_udf_float, Item_sum_bit, Item_func_bit, Item_sum_hybrid, Item_func_case, Item_func_maketime, Item_func_timediff, Item_time_typecast, Item_func_rollup_const, Item_func_sec_to_time, Item_sum_json, Item_sum_bit_field, Item_sum_num_field, Item_func_if, Item_func_curtime, Item_sum_int, Item_time_literal, Item_decimal_typecast, Item_sum_num, Item_int_func, Item_time_func, Item_func_numhybrid, Item_datetime_func, Item_real_func, Item_date_func, Item_temporal_hybrid_func, Item_timeval_func, Item_exists_subselect, Item_func_dayname, Item_func_regexp_substr, Item_func_weekday, Item_func_regexp_replace, Item_func_regexp_like, Item_singlerow_subselect, Item_func_regexp_instr, Item_json_func, Item_func_month, Item_str_func, Item_proc_string, Item_row, Parse_tree_item, and Item_proc_int.

◆ get_time_from_date()

bool Item::get_time_from_date ( MYSQL_TIME ltime)
protected

Convert date to time.

◆ get_time_from_datetime()

bool Item::get_time_from_datetime ( MYSQL_TIME ltime)
protected

Convert datetime to time.

◆ get_time_from_decimal()

bool Item::get_time_from_decimal ( MYSQL_TIME ltime)
protected

Convert val_decimal() to time in MYSQL_TIME.

◆ get_time_from_int()

bool Item::get_time_from_int ( MYSQL_TIME ltime)
protected

Convert val_int() to time in MYSQL_TIME.

◆ get_time_from_non_temporal()

bool Item::get_time_from_non_temporal ( MYSQL_TIME ltime)

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!

◆ get_time_from_numeric()

bool Item::get_time_from_numeric ( MYSQL_TIME ltime)
protected

Convert a numeric type to time.

◆ get_time_from_real()

bool Item::get_time_from_real ( MYSQL_TIME ltime)
protected

Convert val_real() to time in MYSQL_TIME.

◆ get_time_from_string()

bool Item::get_time_from_string ( MYSQL_TIME ltime)
protected

Convert val_str() to time in MYSQL_TIME.

◆ get_timeval()

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

Get timestamp in "struct timeval" format.

If argument is NULL, sets null_value.

Return values
falseon success
trueon error

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.

◆ get_tmp_table_field()

virtual Field* Item::get_tmp_table_field ( )
inlinevirtual

◆ get_tmp_table_item()

virtual Item* Item::get_tmp_table_item ( THD thd)
inlinevirtual

◆ has_aggregate_ref_in_group_by()

virtual bool Item::has_aggregate_ref_in_group_by ( uchar )
inlinevirtual

Check if an aggregate is referenced from within the GROUP BY clause of the query block in which it is aggregated.

Such references will be rejected.

See also
Item_ref::fix_fields()
Return values
trueif this is an aggregate which is referenced from the GROUP BY clause of the aggregating query block
falseotherwise

Reimplemented in Item_sum.

◆ has_aggregation()

bool Item::has_aggregation ( ) const
inline
Returns
true if this item or any of its decendents is an aggregated func.

◆ has_compatible_context()

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.

◆ has_grouping_func_processor()

virtual bool Item::has_grouping_func_processor ( uchar )
inlinevirtual

Reimplemented in Item_func_grouping.

◆ has_rollup_field()

bool Item::has_rollup_field ( )
inline

◆ has_stored_program()

bool Item::has_stored_program ( ) const
inline
Returns
true if this item or any of its decendents refers a stored func.

◆ has_subquery()

bool Item::has_subquery ( ) const
inline
Returns
true if this item or any of its decendents contains a subquery.

◆ has_wf()

bool Item::has_wf ( ) const
inline
Returns
true if this item or any of its decendents is a window func.

◆ inform_item_in_cond_of_tab()

virtual bool Item::inform_item_in_cond_of_tab ( uchar )
inlinevirtual

Reimplemented in Item_subselect.

◆ init_make_field()

void Item::init_make_field ( Send_field tmp_field,
enum enum_field_types  type 
)

◆ intro_version()

virtual bool Item::intro_version ( uchar )
inlinevirtual

Reimplemented in Item_func_to_seconds.

◆ is_blob_field()

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.

◆ is_bool_func()

◆ is_column_not_in_fd()

virtual bool Item::is_column_not_in_fd ( uchar )
inlinevirtual
See also
Group_check::is_in_fd_of_underlying()

Reimplemented in Item_ident.

◆ is_derived_used()

bool Item::is_derived_used ( ) const
inline

◆ is_expensive()

virtual bool Item::is_expensive ( )
inlinevirtual

Reimplemented in Item_func_sp, and Item_udf_func.

◆ is_expensive_processor()

virtual bool Item::is_expensive_processor ( uchar )
inlineprivatevirtual

Reimplemented in Item_func_sp, and Item_udf_func.

◆ is_non_const_over_literals()

◆ is_null()

◆ is_outer_field()

virtual bool Item::is_outer_field ( ) const
inlinevirtual

Reimplemented in Item_ref, and Item_field.

◆ is_result_field()

virtual bool Item::is_result_field ( ) const
inlinevirtual

Reimplemented in Item_ref, Item_result_field, and Item_null_result.

◆ is_splocal()

virtual bool Item::is_splocal ( ) const
inlinevirtual
Returns
whether the item is local to a stored procedure

Reimplemented in Item_splocal.

◆ is_strong_side_column_not_in_fd()

virtual bool Item::is_strong_side_column_not_in_fd ( uchar )
inlinevirtual
See also
Group_check::analyze_conjunct()

Reimplemented in Item_ident.

◆ is_temporal()

bool Item::is_temporal ( ) const
inline

◆ is_temporal_with_date()

bool Item::is_temporal_with_date ( ) const
inline

◆ is_temporal_with_date_and_time()

bool Item::is_temporal_with_date_and_time ( ) const
inline

◆ is_temporal_with_time()

bool Item::is_temporal_with_time ( ) const
inline

◆ itemize()

bool Item::itemize ( Parse_context pc,
Item **  res 
)
virtual

The same as contextualize()/contextualize_() but with additional parameter.

This function finalize the construction of Item objects (see the Item(POS) constructor): we can access/change parser contexts from the itemize() function.

Parameters
pccurrent parse context
[out]respointer to "this" or to a newly allocated replacement object to use in the Item tree instead
Return values
falsesuccess
truesyntax/OOM/etc error

Reimplemented in Item_insert_value, Item_default_value, Item_func_version, Item_func_uuid_short, Item_func_found_rows, Item_param, Item_func_sp, Item_func_row_count, Item_func_is_used_lock, Item_func_is_free_lock, Item_field, Item_func_match, Item_ident, Item_name_const, Item_master_gtid_set_wait, Item_wait_for_executed_gtid_set, Item_master_pos_wait, Item_func_release_all_locks, Item_func_group_concat, Item_func_release_lock, Item_func_get_lock, Item_cond, Item_func_like, Item_udf_sum, Item_udf_func, Item_func_sleep, Item_func_benchmark, Item_func_last_insert_id, Item_func_rand, Item_func_uuid, Item_func_now_utc, Item_func_weight_string, Item_func_curdate, Item_func_set_collation, Item_func_curtime, Item_func_interval, Item_load_file, Item_func_connection_id, PTI_context< Context >, PTI_limit_option_param_marker, PTI_limit_option_ident, PTI_expr_with_alias, PTI_handle_sql2003_note184_exception, Item_func_make_set, PTI_odbc_date, Item_func_current_user, PTI_exists_subselect, PTI_singlerow_subselect, Item_func_user, PTI_in_sum_expr, PTI_count_sym, Item_func_database, Item_sum, Item_in_subselect, PTI_variable_aux_3d, PTI_variable_aux_ident_or_text, PTI_variable_aux_set_var, PTI_literal_underscore_charset_bin_num, PTI_literal_underscore_charset_hex_num, Item_func_unix_timestamp, PTI_temporal_literal, Item_func_icu_version, PTI_text_literal_concat, PTI_text_literal_underscore_charset, PTI_text_literal_nchar_string, PTI_text_literal_text_string, Item_func_random_bytes, Item_func_geometry_from_wkb, PTI_function_call_generic_2d, Item_func_aes_decrypt, Item_func, Item_func_aes_encrypt, Item_func_week, PTI_function_call_generic_ident_sys, PTI_udf_expr, Item_func_geometry_from_text, PTI_function_call_nonkeyword_sysdate, PTI_function_call_nonkeyword_now, PTI_simple_ident_nospvar_ident, PTI_simple_ident_q_2d, PTI_simple_ident_q_3d, PTI_simple_ident_ident, PTI_comp_op_all, PTI_comp_op, Item_row, PTI_negate_expression, and PTI_table_wild.

◆ local_column()

virtual Bool3 Item::local_column ( const SELECT_LEX ) const
inlinevirtual

Reimplemented in Item_ident.

◆ make_empty_result()

String* Item::make_empty_result ( )
inlineprotected

Sets the result value of the function an empty string, using the current character set.

No memory is allocated.

Return values
Apointer to the str_value member.

◆ make_field()

◆ make_string_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)

Parameters
tableTable for which the field is created

Reimplemented in Item_func_group_concat.

◆ mark_field_in_map() [1/2]

virtual bool Item::mark_field_in_map ( uchar arg)
inlinevirtual

Mark underlying field in read or write map of a table.

Parameters
argMark_field object

Reimplemented in Item_view_ref, Item_result_field, Item_field, and Item_sum_hybrid_field.

◆ mark_field_in_map() [2/2]

static bool Item::mark_field_in_map ( Mark_field mark_field,
Field field 
)
inlinestaticprotected

Helper function for mark_field_in_map(uchar *arg).

Parameters
mark_fieldMark_field object
fieldField to be marked for read/write

◆ mark_subqueries_optimized_away()

void Item::mark_subqueries_optimized_away ( )
inline

◆ max_char_length()

uint32 Item::max_char_length ( ) const
inline
Returns
maximum number of characters that this Item can store If Item is of string or blob type, return max string length in bytes divided by bytes per character, otherwise return max_length.

◆ may_evaluate_const()

bool Item::may_evaluate_const ( THD thd) const

Return true if this is a const item that may be evaluated in the current phase of statement processing.

  • No evaluation is performed when analyzing a view, otherwise:
  • Items that have the const_item() property can always be evaluated.
  • Items that have the const_for_execution() property can be evaluated when tables are locked (ie during optimization or execution).

This function should be used in the following circumstances:

  • during preparation to check whether an item can be permanently transformed
  • to check that an item is constant in functions that may be used in both the preparation and optimization phases.

This function should not be used by code that is called during optimization and/or execution only. Use const_for_execution() in this case.

◆ neg_transformer()

◆ no_rows_in_result()

virtual void Item::no_rows_in_result ( )
inlinevirtual

◆ not_null_tables()

◆ null_inside()

virtual bool Item::null_inside ( )
inlinevirtual

◆ null_return_str()

String* Item::null_return_str ( )
inlineprotected

Gets the value to return from val_str() when returning a NULL value.

Returns
The value val_str() should return.

◆ numeric_context_result_type()

virtual enum Item_result Item::numeric_context_result_type ( ) const
inlinevirtual

Result type when an item appear in a numeric context.

See Field::numeric_context_result_type() for more comments.

Reimplemented in Item_hex_string, and Item_field.

◆ operator delete() [1/2]

static void Item::operator delete ( void *  ptr,
size_t  size 
)
inlinestatic

◆ operator delete() [2/2]

static void Item::operator delete ( void *  ,
MEM_ROOT ,
const std::nothrow_t &   
)
inlinestaticnoexcept

◆ operator new() [1/2]

static void* Item::operator new ( size_t  size)
inlinestaticnoexcept

◆ operator new() [2/2]

static void* Item::operator new ( size_t  size,
MEM_ROOT mem_root,
const std::nothrow_t &  arg = std::nothrow 
)
inlinestaticnoexcept

◆ operator=()

void Item::operator= ( Item )
delete

◆ print()

virtual void Item::print ( String str,
enum_query_type   
)
inlinevirtual

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;
  • to generate a SQL-query that looks like a prepared statement for query_rewrite
  • 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_func_pi, Item_float, Item_decimal, Item_uint, Item_int, Item_param, Item_null, Item_field, Item_func_match, Item_func_get_system_var, Item_ident, Item_user_var_as_out_param, Item_func_get_user_var, Item_func_set_user_var, Item_name_const, Item_case_expr, Item_splocal, Item_equal, Item_func_group_concat, Item_cond, Item_udf_func, Item_udf_sum, Item_func_isnotnull, Item_aggregate_ref, Item_func_benchmark, Item_func_bit_neg, Item_func_in, Item_func_bit, Item_func_case, Item_func_get_format, Item_func_timestamp_diff, Item_func_locate, Item_func_add_time, Item_datetime_typecast, Item_time_typecast, Item_date_typecast, Item_extract, Item_date_add_interval, Item_func_weight_string, Item_func_nullif, Item_func_set_collation, Item_func_conv_charset, Item_func_int_div, Item_func_interval, Item_func_spatial_relation, Item_datetime_literal, Item_func_strcmp, Item_func_between, Item_func_binary, Item_decimal_typecast, Item_time_literal, Item_char_typecast, Item_func_unsigned, Item_func_signed, Item_func_spatial_mbr_rel, Item_date_literal, Item_num_op, Item_func_format, Item_func_make_set, Item_func_not_all, Item_func_trig_cond, Item_allany_subselect, Item_sum, Item_in_subselect, Item_func_trim, Item_func_not, Item_temporal_func, Item_bool_func2, Item_exists_subselect, Item_json_typecast, Item_func, Item_maxmin_subselect, Item_func_truth, Item_subselect, and Item_row.

◆ print_for_order()

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().

◆ print_item_w_name()

void Item::print_item_w_name ( String str,
enum_query_type  query_type 
)

◆ propagate_derived_used()

bool Item::propagate_derived_used ( uchar )
inline

Propagate components that use referenced columns from derived tables.

Some columns from derived tables may be determined to be unused, but may actually reference other columns that are used. This function will return true for such columns when called with Item::walk(), which then means that this column can also be marked as used.

See also
also SELECT_LEX::delete_unused_merged_columns().

◆ propagate_set_derived_used()

bool Item::propagate_set_derived_used ( uchar )
inline

Called by Item::walk() to set all the referenced items' derived_used flag.

◆ quick_fix_field()

void Item::quick_fix_field ( )
inline

◆ real_item()

virtual Item* Item::real_item ( )
inlinevirtual

Reimplemented in Item_int_with_ref, and Item_ref.

◆ remove_column_from_bitmap()

virtual bool Item::remove_column_from_bitmap ( uchar arg)
inlinevirtual

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

See also
walk()
Parameters
argA MY_BITMAP* cast to unsigned char*, where the bits represent Field::field_index values.

Reimplemented in Item_field.

◆ rename()

void Item::rename ( char *  new_name)

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

Parameters
new_namenew name of item;

◆ replace_equal_field()

virtual Item* Item::replace_equal_field ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ replace_field_processor()

virtual bool Item::replace_field_processor ( uchar )
inlinevirtual

A processor that replaces any Fields with a Create_field_wrapper.

This will allow us to resolve functions during CREATE TABLE, where we only have Create_field available and not Field. Used for functional index implementation.

Reimplemented in Item_field.

◆ repoint_const_outer_ref()

virtual bool Item::repoint_const_outer_ref ( uchar arg)
inlinevirtual

This function applies only to Item_field objects referred to by an Item_ref object that has been marked as a const_item.

Parameters
argKeep track of whether an Item_ref refers to an Item_field.

Reimplemented in Item_ref, and Item_field.

◆ reset_aggregation()

void Item::reset_aggregation ( )
inline

Reset the "has aggregation" property.

◆ reset_wf_state()

virtual bool Item::reset_wf_state ( uchar arg)
inlinevirtual

Reset execution state for such window function types as determined by arg.

Parameters
argpointing to a bool which, if true, says to reset state for framing window function, else for non-framing

Reimplemented in Item_sum.

◆ result_type()

◆ safe_charset_converter()

Item * Item::safe_charset_converter ( THD thd,
const CHARSET_INFO tocs 
)
virtual

◆ save_date_in_field()

type_conversion_status Item::save_date_in_field ( Field field)

◆ save_in_field()

type_conversion_status Item::save_in_field ( Field field,
bool  no_conversions 
)

Save a temporal value in packed longlong format into a Field.

Used in optimizer.

Subclasses that need to specialize this function, should override save_in_field_inner().

Parameters
[in,out]fieldthe field to save the item into
no_conversionswhether or not to allow conversions of the value
Returns
the status from saving into the field
Return values
TYPE_OKitem saved without any errors or warnings
!=TYPE_OK there were errors or warnings when saving the item

◆ save_in_field_inner()

type_conversion_status Item::save_in_field_inner ( Field field,
bool  no_conversions 
)
protectedvirtual

Helper function which does all of the work for save_in_field(Field*, bool), except some error checking common to all subclasses, which is performed by save_in_field() itself.

Subclasses that need to specialize the behaviour of save_in_field(), should override this function instead of save_in_field().

Parameters
[in,out]fieldthe field to save the item into
no_conversionswhether or not to allow conversions of the value
Returns
the status from saving into the field
Return values
TYPE_OKitem saved without any errors or warnings
!=TYPE_OK there were errors or warnings when saving the item

Reimplemented in Item_cache_str, Item_insert_value, Item_default_value, Item_copy_decimal, Item_copy_float, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_int_with_ref, Item_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_uint, Item_temporal, Item_int, Item_func_sp, Item_param, Item_null, Item_field, Item_func_set_user_var, Item_name_const, Item_sp_variable, Item_func_now, Item_time_func, Item_datetime_func, Item_func_user, Item_date_func, Item_temporal_hybrid_func, and Item_json_func.

◆ save_in_field_no_warnings()

type_conversion_status Item::save_in_field_no_warnings ( Field field,
bool  no_conversions 
)

Save the item into a field but do not emit any warnings.

Parameters
fieldfield to save the item into
no_conversionswhether or not to allow conversions of the value
Returns
the status from saving into the field
Return values
TYPE_OKitem saved without any issues
!=TYPE_OK there were issues saving the item

◆ save_in_result_field()

virtual void Item::save_in_result_field ( bool  no_conversions)
inlinevirtual

◆ save_org_in_field()

virtual void Item::save_org_in_field ( Field field)
inlinevirtual

Reimplemented in Item_ref, Item_field, and Item_func_set_user_var.

◆ save_str_value_in_field()

type_conversion_status Item::save_str_value_in_field ( Field field,
String result 
)

◆ save_time_in_field()

type_conversion_status Item::save_time_in_field ( Field field)

◆ send()

bool Item::send ( Protocol protocol,
String str 
)
virtual

This is only called from items that is not of type item_field.

Reimplemented in Item_view_ref, Item_ref, Item_null, Item_field, Item_func_set_user_var, Item_name_const, and Item_sp_variable.

◆ set_accum_properties()

void Item::set_accum_properties ( const Item item)
inlineprotected

Set accumulated properties for an Item.

◆ set_aggregation()

void Item::set_aggregation ( )
inline

Set the "has aggregation" property.

◆ set_can_use_prefix_key()

virtual void Item::set_can_use_prefix_key ( )
inlinevirtual

Reimplemented in Item_field.

◆ set_data_type()

void Item::set_data_type ( enum_field_types  data_type)
inline

Set the data type of the current Item.

It is however recommended to use one of the type-specific setters if possible.

Parameters
data_typeThe data type of this Item.

◆ set_data_type_blob()

void Item::set_data_type_blob ( uint32  max_l)
inline

Set the Item to be of BLOB type.

Parameters
max_lMaximum number of bytes in data type

◆ set_data_type_bool()

void Item::set_data_type_bool ( )
inline

◆ set_data_type_char() [1/2]

void Item::set_data_type_char ( uint32  max_l)
inline

Set the Item to be fixed length string.

Collation must have been set before calling function.

Parameters
max_lNumber of characters in string

◆ set_data_type_char() [2/2]

void Item::set_data_type_char ( uint32  max_l,
const CHARSET_INFO cs 
)
inline

Set the Item to be fixed length string.

Like function above, but will also set character set and collation.

Parameters
max_lMaximum number of characters in string
csPointer to character set and collation struct

◆ set_data_type_date()

void Item::set_data_type_date ( )
inline

Set all type properties for Item of DATE type.

◆ set_data_type_datetime()

void Item::set_data_type_datetime ( uint8  fsp)
inline

Set all properties for Item of DATETIME type.

Parameters
fspFractional seconds precision

◆ set_data_type_decimal()

void Item::set_data_type_decimal ( uint8  precision,
uint8  dec 
)
inline

Set the data type of the Item to be decimal.

The unsigned property must have been set before calling this function.

Parameters
precisionNumber of digits of precision
decNumber of digits after decimal point.

◆ set_data_type_double()

void Item::set_data_type_double ( )
inline

Set the data type of the Item to be double precision floating point.

◆ set_data_type_float()

void Item::set_data_type_float ( )
inline

Set the data type of the Item to be single precision floating point.

◆ set_data_type_from_item()

void Item::set_data_type_from_item ( Item item)
inline

Set data type properties of the item from the properties of another item.

Parameters
itemItem to set data type properties from.

◆ set_data_type_from_result()

void Item::set_data_type_from_result ( Item_result  result,
uint32  length 
)
inline

Set type information of Item from "result" information.

For String types, type is set based on maximum string size. For other types, the associated type with the largest precision is set.

Parameters
resultEither Integer, Decimal, Double or String
lengthMaximum string size, used only for String result.

◆ set_data_type_geometry()

void Item::set_data_type_geometry ( )
inline

Set the Item to be of GEOMETRY type.

◆ set_data_type_json()

void Item::set_data_type_json ( )
inline

Set the data type of the Item to be JSON.

◆ set_data_type_longlong()

void Item::set_data_type_longlong ( )
inline

Set the data type of the Item to be longlong.

Maximum display width is set to be the maximum of a 64-bit integer, but it may be adjusted later. The unsigned property is not affected.

◆ set_data_type_string() [1/4]

void Item::set_data_type_string ( uint32  max_l)
inline

Set the Item to be variable length string.

Actual type is determined from maximum string size. Collation must have been set before calling function.

Parameters
max_lMaximum number of characters in string

◆ set_data_type_string() [2/4]

void Item::set_data_type_string ( ulonglong  max_char_length_arg)
inline

Set the Item to be variable length string.

Like function above, but with larger string length precision.

Parameters
max_char_length_argMaximum number of characters in string

◆ set_data_type_string() [3/4]

void Item::set_data_type_string ( ulonglong  max_l,
const CHARSET_INFO cs 
)
inline

Set the Item to be variable length string.

Like function above, but will also set character set and collation.

Parameters
max_lMaximum number of characters in string
csPointer to character set and collation struct

◆ set_data_type_string() [4/4]

void Item::set_data_type_string ( uint32  max_l,
const DTCollation coll 
)
inline

Set the Item to be variable length string.

Like function above, but will also set full collation information.

Parameters
max_lMaximum number of characters in string
collRef to collation data, including derivation and repertoire

◆ set_data_type_string_init()

void Item::set_data_type_string_init ( )
inline

Initialize an Item to be of VARCHAR type, other properties undetermined.

◆ set_data_type_time()

void Item::set_data_type_time ( uint8  fsp)
inline

Set all type properties for Item of TIME type.

Parameters
fspFractional seconds precision

◆ set_data_type_timestamp()

void Item::set_data_type_timestamp ( uint8  fsp)
inline

Set all properties for Item of TIMESTAMP type.

Parameters
fspFractional seconds precision

◆ set_data_type_year()

void Item::set_data_type_year ( )
inline

Set the data type of the Item to be YEAR.

◆ set_derived_used()

void Item::set_derived_used ( )
inlineprivate

◆ set_has_rollup_field()

void Item::set_has_rollup_field ( )
inline

◆ set_no_const_sub()

virtual bool Item::set_no_const_sub ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ set_orig_field()

virtual void Item::set_orig_field ( Field )
inlinevirtual

Reimplemented in Item_field.

◆ set_result_field()

virtual void Item::set_result_field ( Field )
inlinevirtual

Reimplemented in Item_ref, and Item_result_field.

◆ set_runtime_created()

virtual void Item::set_runtime_created ( )
inlinevirtual

◆ set_stored_program()

void Item::set_stored_program ( )
inlineprotected

Set the "has stored program" property.

◆ set_subquery()

void Item::set_subquery ( )
inlineprotected

Set the "has subquery" property.

◆ set_wf()

void Item::set_wf ( )
inline

Set the "has window function" property.

◆ skip_itemize()

bool Item::skip_itemize ( Item **  res)
inlineprotected

Helper function to skip itemize() for grammar-allocated items.

Parameters
[out]respointer to "this"
Return values
truecan skip itemize()
falsecan't skip: the item is allocated directly by the parser

◆ split_sum_func()

virtual void Item::split_sum_func ( THD ,
Ref_item_array  ,
List< Item > &   
)
inlinevirtual

◆ split_sum_func2()

void Item::split_sum_func2 ( THD thd,
Ref_item_array  ref_item_array,
List< Item > &  fields,
Item **  ref,
bool  skip_registered 
)

Move SUM items out from item tree and replace with reference.

The general goal of this is to get a list of group aggregates, and window functions, and their arguments, so that the code which manages internal tmp tables (creation, row copying) has a list of all aggregates (which require special management) and a list of their arguments (which must be carried from tmp table to tmp table until the aggregate can be computed).

Parameters
thdCurrent session
ref_item_arrayPointer to array of reference fields
fieldsAll fields in select
refPointer to item. If nullptr, get it from Item_sum::ref_by[].
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

The logic of skip_registered is:

  • split_sum_func() is called when an aggregate is part of a bigger expression, example: '1+max()'.
  • an Item_sum has ref_by[0]!=nullptr when it is a group aggregate located in a subquery but aggregating in a more outer query.
  • this ref_by is necessary because for such aggregates, there are two phases:
    • fix_fields() is called by the subquery, which puts the item into the outer SELECT_LEX::inner_sum_func_list.
    • the outer query scans that list, calls split_sum_func2(), it replaces the aggregate with an Item_ref, so it needs to correct the pointer-to-aggregate held by the '+' item; so it needs access to the pointer; this is possible because fix_fields() has stored the address of this pointer into ref_by[0].
  • So when we call split_sum_func for any aggregate, if we are in the subquery, we do not want to modify the outer-aggregated aggregates, and as those are detectable because they have ref_by[0]!=0: we pass 'skip_registered=true'.
  • On the other hand, if we are in the outer query and scan inner_sum_func_list, it's time to modify the aggregate which was skipped by the subquery, so we pass 'skip_registered=false'.
  • Finally, if the subquery was transformed with IN-to-EXISTS, a new HAVING condition may have been added, which contains an Item_ref to the same Item_sum; that makes a second pointer, ref_by[1], to remember.

Examples:

(1) SELECT a+FIRST_VALUE(b*SUM(c/d)) OVER (...)

Assume we have done fix_fields() on this SELECT list, which list is so far only '+'. This '+' contains a WF (and a group aggregate function), so the resolver (generally, SELECT_LEX::prepare()) calls Item::split_sum_func2 on the '+'; as this '+' is neither a WF nor a group aggregate, but contains some, it calls Item_func::split_sum_func which calls Item::split_sum_func2 on every argument of the '+':

  • for 'a', it adds it to 'fields' as a hidden item
  • then the FIRST_VALUE wf is added as a hidden item; this is necessary so that create_tmp_table() and copy_funcs can spot the WF.
  • next, for FIRST_VALUE: it is a WF, so its Item_sum::split_sum_func is called, as its arguments need to be added as hidden items so they can get carried forward between the tmp tables. This split_sum_func calls Item::split_sum_func2 on its argument (the '*'); this '*' is not a group aggregate but contains one, so its Item_func::split_sum_func is called, which calls Item::split_sum_func2 on every argument of the '*':
    • for 'b', adds it to 'fields' as a hidden item
    • for SUM: it is a group aggregate (and doesn't contain any WF) so it adds it to 'fields' as a hidden item.

So we finally have, in 'fields':

SUM, b, FIRST_VALUE, a, +

Each time we add a hidden item we re-point its parent to the hidden item using an Item_aggregate_ref. For example, the args[0] of '+' is made to point to an Item_aggregate_ref which points to the hidden 'a'.

◆ string_field_type()

static enum_field_types Item::string_field_type ( uint32  max_bytes)
inlinestatic

Determine correct string field type, based on string length.

Parameters
max_bytesMaximum string size, in number of bytes

◆ subq_opt_away_processor()

virtual bool Item::subq_opt_away_processor ( uchar )
inlineprivatevirtual

Reimplemented in Item_subselect.

◆ subst_argument_checker()

virtual bool Item::subst_argument_checker ( uchar **  arg)
inlinevirtual

◆ substitutional_item()

virtual Item* Item::substitutional_item ( )
inlinevirtual

◆ supports_partial_update()

virtual bool Item::supports_partial_update ( const Field_json field) const
inlinevirtual

Check if this expression can be used for partial update of a given JSON column.

For example, the expression ‘JSON_REPLACE(col, ’$.foo', 'bar') can be used to partially update the columnfoo`.

Parameters
fieldthe JSON column that is being updated
Returns
true if this expression can be used for partial update, false otherwise

Reimplemented in Item_json_func.

◆ temporal_with_date_as_number_result_type()

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.

◆ this_item() [1/2]

virtual Item* Item::this_item ( )
inlinevirtual

Reimplemented in Item_case_expr, and Item_splocal.

◆ this_item() [2/2]

virtual const Item* Item::this_item ( ) const
inlinevirtual

Reimplemented in Item_case_expr, and Item_splocal.

◆ this_item_addr()

virtual Item** Item::this_item_addr ( THD ,
Item **  addr_arg 
)
inlinevirtual

Reimplemented in Item_case_expr, and Item_splocal.

◆ time_precision()

uint Item::time_precision ( )
virtual

TIME precision of the item: 0..6.

Reimplemented in Item_temporal_func.

◆ tmp_table_field()

virtual Field* Item::tmp_table_field ( TABLE )
inlinevirtual

◆ tmp_table_field_from_field_type()

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

Returns
Created field
Return values
NULLerror

◆ top_level_item()

virtual void Item::top_level_item ( )
inlinevirtual

◆ transform()

Item * Item::transform ( Item_transformer  transformer,
uchar arg 
)
virtual

Perform a generic transformation of the Item tree, by adding zero or more additional Item objects to it.

Parameters
transformerTransformer function
[in,out]argPointer to struct used by transformer function
Returns
Returned item tree after transformation, NULL if error

Transformation is performed as follows:

transform() { transform children if any; return this->*some_transformer(...); }

Note that unlike Item::compile(), transform() does not support an analyzer function, ie. all children are unconditionally invoked.

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

◆ traverse_cond()

virtual void Item::traverse_cond ( Cond_traverser  traverser,
void *  arg,
traverse_order   
)
inlinevirtual

Reimplemented in Item_cond, and Item_func.

◆ type()

◆ type_for_variable()

static enum_field_types Item::type_for_variable ( enum_field_types  src_type)
inlinestatic

Provide data type for a user or system variable, based on the type of the item that is assigned to the variable.

Note
MYSQL_TYPE_VARCHAR is returned for all string types, but must be further adjusted based on maximum string length by the caller.
Parameters
src_typeSource type that variable's type is derived from

◆ update_null_value()

bool Item::update_null_value ( )

Make sure the null_value member has a correct value.

◆ update_used_tables()

◆ update_value_transformer()

virtual Item* Item::update_value_transformer ( uchar )
inlinevirtual

Reimplemented in Item_field.

◆ used_tables()

◆ used_tables_for_level()

virtual bool Item::used_tables_for_level ( uchar arg)
inlinevirtual

Return used table information for the specified query block (level).

For a field that is resolved from this query block, return the table number. For a field that is resolved from a query block outer to the specified one, return OUTER_REF_TABLE_BIT

Parameters
[in,out]argpointer to an instance of class Used_tables, which is constructed with the query block as argument. The used tables information is accumulated in the field used_tables in this class.
Note
This function is used to update used tables information after merging a query block (a subquery) with its parent.

Reimplemented in Item_field.

◆ val_bool()

◆ val_date_temporal()

◆ val_decimal()

virtual my_decimal* Item::val_decimal ( my_decimal decimal_buffer)
pure virtual

◆ val_decimal_from_date()

my_decimal * Item::val_decimal_from_date ( my_decimal decimal_value)
protected

◆ val_decimal_from_int()

my_decimal * Item::val_decimal_from_int ( my_decimal decimal_value)
protected

◆ val_decimal_from_real()

my_decimal * Item::val_decimal_from_real ( my_decimal decimal_value)
protected

◆ val_decimal_from_string()

my_decimal * Item::val_decimal_from_string ( my_decimal decimal_value)
protected

◆ val_decimal_from_time()

my_decimal * Item::val_decimal_from_time ( my_decimal decimal_value)
protected

◆ val_int()

virtual longlong Item::val_int ( )
pure virtual

Implemented in Item_type_holder, Item_cache_json, Item_cache_datetime, Item_cache_row, Item_cache_str, Item_cache_decimal, Item_cache_real, Item_cache_int, Item_copy_decimal, Item_copy_float, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_ref_null_helper, Item_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_int, Item_func_uuid_short, Item_func_found_rows, Item_param, Item_func_sp, Item_func_row_count, Item_func_is_used_lock, Item_null, Item_func_is_free_lock, Item_field, Item_func_match, Item_ident_for_show, Item_func_get_system_var, Item_user_var_as_out_param, Item_func_get_user_var, Item_func_set_user_var, Item_name_const, Item_sp_variable, Item_func_internal_tablespace_data_free, Item_func_internal_tablespace_version, Item_func_internal_tablespace_autoextend_size, Item_func_internal_tablespace_maximum_size, Item_func_internal_tablespace_initial_size, Item_func_grouping, Item_func_internal_tablespace_extent_size, Item_func_internal_tablespace_total_extents, Item_func_internal_tablespace_free_extents, Item_nth_value, Item_func_internal_tablespace_logfile_group_number, Item_func_internal_tablespace_id, Item_func_get_dd_index_sub_part_length, Item_func_internal_get_view_warning_or_error, Item_first_last_value, Item_func_internal_dd_char_length, Item_func_internal_index_column_cardinality, Item_func_internal_keys_disabled, Item_func_internal_checksum, Item_func_internal_auto_increment, Item_lead_lag, Item_func_internal_data_free, Item_func_internal_index_length, Item_func_internal_max_data_length, Item_func_internal_data_length, Item_ntile, Item_func_internal_avg_row_length, Item_func_internal_table_rows, Item_percent_rank, Item_func_is_visible_dd_object, Item_func_can_access_column, Item_func_can_access_view, Item_cume_dist, Item_func_can_access_resource_group, Item_func_can_access_event, Item_func_can_access_routine, Item_rank, Item_func_can_access_trigger, Item_func_can_access_table, Item_func_can_access_database, Item_cond_or, Item_func_gtid_subset, Item_row_number, Item_cond_and, Item_master_gtid_set_wait, Item_wait_for_executed_gtid_set, Item_master_pos_wait, Item_equal, Item_func_group_concat, Item_func_release_all_locks, Item_func_release_lock, Item_func_get_lock, Item_func_udf_str, Item_sum_udf_decimal, Item_func_udf_decimal, Item_sum_udf_str, Item_func_udf_int, Item_func_udf_float, Item_sum_udf_int, Item_sum_udf_float, Item_func_like, Item_func_isnotnull, Item_func_sleep, Item_is_not_null_test, Item_func_benchmark, Item_func_isnull, Item_func_last_insert_id, Item_sum_bit, Item_func_bit_count, Item_func_st_srid_observer, Item_func_in, Item_func_numpoints, Item_func_numinteriorring, Item_func_numgeometries, Item_func_bit, Item_sum_hybrid, Item_func_case, Item_func_find_in_set, Item_func_ord, Item_func_ascii, Item_func_timestamp_diff, Item_func_field, Item_func_microsecond, Item_func_validate_password_strength, Item_func_locate, Item_func_coercibility, Item_func_char_length, Item_func_bit_length, Item_func_length, Item_func_dimension, Item_func_isvalid, Item_func_rollup_const, Item_func_isclosed, Item_func_st_issimple, Item_func_isempty, Item_extract, Item_func_min_max, Item_func_sign, Item_sum_avg, Item_sum_json, Item_func_uncompressed_length, Item_sum_bit_field, Item_func_crc32, Item_func_nullif, Item_sum_num_field, Item_func_if, Item_sum_count, Item_func_int_div, Item_func_interval, Item_sum_sum, Item_func_spatial_relation, Item_func_strcmp, Item_func_between, Item_decimal_typecast, Item_func_spatial_rel, Item_func_unsigned, Item_sum_num, Item_func_signed, Item_func_spatial_mbr_rel, Item_func_connection_id, Item_func_ne, Item_func_lt, Item_func_le, Item_func_is_uuid, Item_func_gt, Item_func_ge, Item_func_equal, Item_func_json_storage_free, Item_func_json_storage_size, Item_func_eq, Item_time_func, Item_func_nop_all, Item_func_numhybrid, Item_func_not_all, Item_datetime_func, Item_func_elt, Item_real_func, Item_func_trig_cond, Item_date_func, Item_temporal_hybrid_func, Item_in_subselect, Item_func_not, Item_func_xor, Item_nodeset_to_const_comparator, Item_func_time_to_sec, Item_func_json_depth, Item_func_xpath_count, Item_func_json_length, Item_func_xpath_position, Item_timeval_func, Item_exists_subselect, Item_func_regexp_substr, Item_func_json_contains_path, Item_xpath_cast_bool, Item_func_weekday, Item_func_regexp_replace, Item_in_optimizer, Item_func_json_contains, Item_func_year, Item_func_yearweek, Item_func_json_valid, Item_func_regexp_like, Item_func_week, Item_func_second, Item_singlerow_subselect, Item_func_quarter, Item_func_regexp_instr, Item_func_minute, Item_func_hour, Item_func_truth, Item_func_dayofyear, Item_json_func, Item_func_month, Item_func_dayofmonth, Item_str_func, Item_proc_string, Item_func_to_seconds, Item_row, Item_func_inet_bool_base, Item_func_to_days, Item_func_period_diff, Item_proc_int, Parse_tree_item, Item_func_period_add, and Item_func_inet_aton.

◆ val_int_endpoint()

virtual longlong Item::val_int_endpoint ( bool  left_endp,
bool incl_endp 
)
inlinevirtual

◆ val_int_from_date()

longlong Item::val_int_from_date ( )
protected

◆ val_int_from_datetime()

longlong Item::val_int_from_datetime ( )
protected

◆ val_int_from_decimal()

longlong Item::val_int_from_decimal ( )
protected

◆ val_int_from_time()

longlong Item::val_int_from_time ( )
protected

◆ val_json()

virtual bool Item::val_json ( Json_wrapper result)
inlinevirtual

Get a JSON value from an Item.

All subclasses that can return a JSON value, should override this function. The function in the base class is not expected to be called. If it is called, it most likely means that some subclass is missing an override of val_json().

Parameters
[in,out]resultThe resulting Json_wrapper.
Returns
false if successful, true on failure

Reimplemented in Item_cache_json, Item_copy_json, Item_copy, Item_view_ref, Item_ref, Item_func_sp, Item_null, Item_field, Item_splocal, Item_sp_variable, Item_nth_value, Item_first_last_value, Item_lead_lag, Item_sum_hybrid, Item_func_case, Item_func_rollup_const, Item_sum_json, Item_func_nullif, Item_func_if, Item_func_ifnull, Item_func_coalesce, Item_func_json_merge_patch, Item_func_json_merge_preserve, Item_func_json_remove, Item_func_json_search, Item_func_json_row_object, Item_func_json_array, Item_func_json_set_replace, Item_func_json_array_insert, Item_func_as_geojson, Item_func_json_insert, Item_func_json_array_append, Item_func_json_extract, Item_func_json_keys, Item_json_typecast, and Item_singlerow_subselect.

◆ val_real()

virtual double Item::val_real ( )
pure virtual

Implemented in Item_type_holder, Item_cache_json, Item_cache_datetime, Item_cache_row, Item_cache_str, Item_cache_decimal, Item_cache_real, Item_cache_int, Item_copy_decimal, Item_copy_float, Item_copy_uint, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_ref_null_helper, Item_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_uint, Item_int, Item_param, Item_func_sp, Item_null, Item_field, Item_func_match, Item_ident_for_show, Item_func_get_system_var, Item_user_var_as_out_param, Item_func_get_user_var, Item_func_set_user_var, Item_name_const, Item_sp_variable, Item_nth_value, Item_first_last_value, Item_lead_lag, Item_ntile, Item_percent_rank, Item_cume_dist, Item_rank, Item_row_number, Item_func_group_concat, Item_func_udf_str, Item_sum_udf_decimal, Item_func_udf_decimal, Item_func_udf_int, Item_sum_udf_str, Item_func_udf_float, Item_sum_udf_int, Item_sum_udf_float, Item_sum_bit, Item_func_st_distance_sphere, Item_func_distance, Item_func_st_length, Item_func_st_area, Item_func_bit, Item_sum_hybrid, Item_func_case, Item_sum_std, Item_func_coordinate_observer, Item_std_field, Item_sum_variance, Item_func_rollup_const, Item_func_min_max, Item_variance_field, Item_func_units, Item_sum_avg, Item_func_rand, Item_sum_json, Item_func_cot, Item_func_tan, Item_func_sin, Item_func_cos, Item_func_atan, Item_sum_bit_field, Item_func_asin, Item_func_acos, Item_func_pow, Item_avg_field, Item_func_sqrt, Item_func_log10, Item_func_nullif, Item_func_log2, Item_func_log, Item_func_ln, Item_func_if, Item_func_exp, Item_sum_sum, Item_sum_int, Item_decimal_typecast, Item_int_func, Item_time_func, Item_func_numhybrid, Item_datetime_func, Item_func_elt, Item_func_latlongfromgeohash, Item_date_func, Item_temporal_hybrid_func, Item_in_subselect, Item_func_xpath_sum, Item_timeval_func, Item_exists_subselect, Item_func_regexp_substr, Item_xpath_cast_number, Item_func_weekday, Item_func_regexp_replace, Item_func_regexp_like, Item_singlerow_subselect, Item_func_regexp_instr, Item_json_func, Item_func_month, Item_str_func, Item_proc_string, Item_row, Item_proc_int, and Parse_tree_item.

◆ val_real_from_decimal()

double Item::val_real_from_decimal ( )
protected

◆ val_str()

virtual String* Item::val_str ( String str)
pure virtual

Implemented in Item_type_holder, Item_cache_json, Item_cache_datetime, Item_cache_row, Item_cache_str, Item_cache_decimal, Item_cache_real, Item_cache_int, Item_copy_decimal, Item_copy_float, Item_copy_uint, Item_copy_int, Item_copy_json, Item_copy_string, Item_copy, Item_ref_null_helper, Item_view_ref, Item_ref, Item_hex_string, Item_string, Item_float, Item_decimal, Item_uint, Item_int, Item_func_sp, Item_param, Item_null, Item_field, Item_ident_for_show, Item_func_get_system_var, Item_user_var_as_out_param, Item_func_get_user_var, Item_func_set_user_var, Item_name_const, Item_sp_variable, Item_nth_value, Item_first_last_value, Item_lead_lag, Item_ntile, Item_percent_rank, Item_cume_dist, Item_rank, Item_row_number, Item_func_group_concat, Item_func_udf_str, Item_sum_udf_decimal, Item_func_udf_decimal, Item_func_udf_int, Item_sum_udf_str, Item_func_udf_float, Item_sum_udf_int, Item_sum_udf_float, Item_sum_bit, Item_func_st_transform, Item_func_st_srid_mutator, Item_sum_hybrid, Item_func_bit, Item_func_swap_xy, Item_func_case, Item_func_convert_cpu_id_mask, Item_func_internal_tablespace_row_format, Item_func_internal_tablespace_status, Item_func_internal_tablespace_logfile_group_name, Item_func_internal_tablespace_type, Item_func_coordinate_mutator, Item_func_get_partition_nodegroup, Item_func_rollup_const, Item_func_get_dd_index_private_data, Item_func_get_dd_tablespace_private_data, Item_func_buffer_strategy, Item_func_buffer, Item_func_internal_get_comment_or_error, Item_func_get_dd_create_options, Item_func_get_dd_column_privileges, Item_variance_field, Item_sum_avg, Item_func_roles_graphml, Item_func_date_format, Item_func_current_role, Item_func_uuid, Item_func_spatial_operation, Item_sum_json, Item_func_uncompress, Item_func_compress, Item_sum_bit_field, Item_func_now, Item_avg_field, Item_func_weight_string, Item_func_nullif, Item_func_collation, Item_func_if, Item_func_curdate, Item_func_charset, Item_func_set_collation, Item_func_conv_charset, Item_func_curtime, Item_sum_sum, Item_func_quote, Item_func_export_set, Item_datetime_literal, Item_load_file, Item_sum_int, Item_time_literal, Item_func_binary, Item_decimal_typecast, Item_char_typecast, Item_sum_num, Item_date_literal, Item_func_like_range, Item_func_unhex, Item_int_func, Item_func_spatial_collection, Item_func_conv, Item_func_spatial_decomp_n, Item_func_spatial_decomp, Item_func_uuid_to_bin, Item_func_lpad, Item_func_pointfromgeohash, Item_func_rpad, Item_func_space, Item_func_repeat, Item_func_point, Item_func_char, Item_func_json_pretty, Item_time_func, Item_func_st_simplify, Item_func_validate, Item_func_json_unquote, Item_func_make_envelope, Item_func_envelope, Item_func_json_quote, Item_func_convex_hull, Item_func_numhybrid, Item_func_make_set, Item_func_centroid, Item_datetime_func, Item_func_elt, Item_func_soundex, Item_real_func, Item_date_func, Item_func_user, Item_func_database, Item_temporal_hybrid_func, Item_in_subselect, Item_func_trim, Item_func_substr_index, Item_func_substr, Item_func_right, Item_func_left, Item_timeval_func, Item_str_conv, Item_exists_subselect, Item_func_insert, Item_func_dayname, Item_func_geomfromgeojson, Item_func_json_type, Item_func_replace, Item_func_regexp_substr, Item_func_reverse, Item_func_weekday, Item_func_concat_ws, Item_func_concat, Item_func_regexp_replace, Item_func_as_wkb, Item_func_random_bytes, Item_func_geometry_from_wkb, Item_func_aes_decrypt, Item_func_aes_encrypt, Item_func_regexp_like, Item_func_from_base64, Item_func_statement_digest_text, Item_singlerow_subselect, Item_func_geometry_from_text, Item_func_regexp_instr, Item_func_monthname, Item_str_ascii_func, Item_json_func, Item_func_month, Item_nodeset_func, Item_proc_string, Item_row, Item_func_xml_update, Item_func_xml_extractvalue, Item_proc_int, Parse_tree_item, and Item_func_inet_ntoa.

◆ val_str_ascii()

◆ val_string_from_date()

String * Item::val_string_from_date ( String str)
protected

◆ val_string_from_datetime()

String * Item::val_string_from_datetime ( String str)
protected

◆ val_string_from_decimal()

String * Item::val_string_from_decimal ( String str)
protected

◆ val_string_from_int()

String * Item::val_string_from_int ( String str)
protected

◆ val_string_from_real()

String * Item::val_string_from_real ( String str)
protected

◆ val_string_from_time()

String * Item::val_string_from_time ( String str)
protected

◆ val_temporal_by_field_type()

longlong Item::val_temporal_by_field_type ( )
inline

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

◆ val_temporal_with_round()

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.

◆ val_time_temporal()

longlong Item::val_time_temporal ( )
virtual

◆ val_uint()

ulonglong Item::val_uint ( )
inline

◆ visitor_processor()

bool Item::visitor_processor ( uchar arg)
virtual

A processor to handle the select lex visitor framework.

◆ walk()

virtual bool Item::walk ( Item_processor  processor,
enum_walk  walk,
uchar arg 
)
inlinevirtual

Traverses a tree of Items in prefix and/or postfix order.

Optionally walks into subqueries.

Parameters
processorprocessor function to be invoked per item returns true to abort traversal, false to continue
walkcontrols how to traverse the item tree WALK_PREFIX: call processor before invoking children WALK_POSTFIX: call processor after invoking children WALK_SUBQUERY go down into subqueries walk values are bit-coded and may be combined. Omitting both WALK_PREFIX and WALK_POSTFIX is undefined behaviour.
argOptional pointer to a walk-specific object
Return values
falsewalk succeeded
truewalk aborted by agreement, an error may have been reported

Reimplemented in Item_cache, Item_insert_value, Item_default_value, Item_ref, Item_ident, Item_equal, Item_cond, Item_func_make_set, Item_sum, Item_in_subselect, Item_func, Item_subselect, and Item_row.

Friends And Related Function Documentation

◆ udf_handler

friend class udf_handler
friend

Member Data Documentation

◆ cmp_context

Item_result Item::cmp_context

Comparison context.

◆ collation

DTCollation Item::collation

Character set and collation properties assigned for this Item.

Used if Item represents a character string expression.

◆ decimals

uint8 Item::decimals

Number of decimals in result when evaluating this item.

  • For integer type, always zero.
  • For decimal type, number of decimals.
  • For float type, it may be DECIMAL_NOT_SPECIFIED
  • For time, datetime and timestamp, number of decimals in fractional second
  • For string types, may be decimals of cast source or DECIMAL_NOT_SPECIFIED

◆ derived_used

bool Item::derived_used
private

True if this is an expression from the select list of a derived table which is actually used by outer query.

◆ fixed

bool Item::fixed

True if item has been resolved.

◆ is_expensive_cache

int8 Item::is_expensive_cache
private

Cache of result of is_expensive()

◆ is_parser_item

const bool Item::is_parser_item
private

true if allocated directly by parser

◆ item_name

Item_name_string Item::item_name

Name from query.

◆ m_accum_properties

uint8 Item::m_accum_properties
protected

◆ m_data_type

uint8 Item::m_data_type
private

Data type assigned to Item.

◆ m_has_rollup_field

bool Item::m_has_rollup_field
private

◆ m_is_window_function

bool Item::m_is_window_function

True if item represents window func.

◆ marker

item_marker Item::marker

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

  • when doing constant propagation (e.g. change_cond_ref_to_const(), to remember that we have already processed the item).
  • when creating an internal temporary table: says how to store BIT fields
  • when analyzing functional dependencies for only_full_group_by (says whether a nullable column can be treated at not nullable)
  • when we change DISTINCT to GROUP BY: used for book-keeping of fields.
  • when pushing index conditions: it says whether a condition uses only indexed columns. The important property is that a phase must have a value (or few values) which is reserved for this phase. If it wants to set "marked", it assigns the value; it it wants to test if it is marked, it tests marker != value. If the value has been assigned and the phase wants to cancel it can set marker to MARKER_NONE, which is a magic number which no phase reserves. A phase can expect 'marker' to be MARKER_NONE at the start of execution of a normal statement, at the start of preparation of a PS, and at the start of execution of a PS. A phase should not expect marker's value to survive after the phase's end - as a following phase may change it.

◆ max_length

uint32 Item::max_length

Maximum length of result of evaluating this item, in number of bytes.

  • For character or blob data types, max char length multiplied by max character size (collation.mbmaxlen).
  • For decimal type, it is the precision in digits plus sign (unless unsigned) plus decimal point (unless it has zero decimals).
  • For other numeric types, the default or specific display length.
  • For date/time types, the display length (10 for DATE, 10 + optional FSP for TIME, 19 + optional fsp for datetime/timestamp).
  • For bit, the number of bits.
  • For enum, the string length of the widest enum element.
  • For set, the sum of the string length of each set element plus separators.
  • For geometry, the maximum size of a BLOB (it's underlying storage type).
  • For json, the maximum size of a BLOB (it's underlying storage type).Maximum length, in bytes

◆ maybe_null

bool Item::maybe_null

True if this item may be null.

For items that represent rows, it is true if one of the columns may be null.

For items that represent scalar or row subqueries, it is true if one of the returned columns could be null, or if the subquery could return zero rows.

◆ next_free

Item* Item::next_free

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

◆ null_value

bool Item::null_value

True if item is null.

◆ orig_name

Item_name_string Item::orig_name

Original item name (if it was renamed)

◆ PROP_AGGREGATION

constexpr uint8 Item::PROP_AGGREGATION = 0x04
staticprotected

◆ PROP_STORED_PROGRAM

constexpr uint8 Item::PROP_STORED_PROGRAM = 0x02
staticprotected

◆ PROP_SUBQUERY

constexpr uint8 Item::PROP_SUBQUERY = 0x01
staticprotected

Set of properties that are calculated by accumulation from underlying items.

Computed by constructors and fix_fields() and updated by update_used_tables(). The properties are accumulated up to the root of the current item tree, except they are not accumulated across subqueries and functions.

◆ PROP_WINDOW_FUNCTION

constexpr uint8 Item::PROP_WINDOW_FUNCTION = 0x08
staticprotected

◆ runtime_item

bool Item::runtime_item
private

◆ str_value

String Item::str_value
protected

str_values's main purpose is to cache the value in save_in_field

◆ unsigned_flag

bool Item::unsigned_flag

The documentation for this class was generated from the following files: