MySQL  8.0.17
Source Code Documentation
Item_func Class Reference

#include <item_func.h>

Inheritance diagram for Item_func:
Item_result_field Item Parse_tree_node_tmpl< Context > Item_func_array_cast Item_func_bit Item_func_case Item_func_if Item_func_month Item_func_numhybrid Item_func_regexp Item_func_rollup_const Item_func_sp Item_func_weekday Item_int_func Item_json_func Item_real_func Item_str_func Item_temporal_func Item_timeval_func Item_typecast_decimal Item_typecast_real Item_udf_func Item_var_func

Public Types

enum  Functype {
  UNKNOWN_FUNC, EQ_FUNC, EQUAL_FUNC, NE_FUNC,
  LT_FUNC, LE_FUNC, GE_FUNC, GT_FUNC,
  FT_FUNC, MATCH_FUNC, LIKE_FUNC, ISNULL_FUNC,
  ISNOTNULL_FUNC, ISTRUTH_FUNC, COND_AND_FUNC, COND_OR_FUNC,
  XOR_FUNC, BETWEEN, IN_FUNC, MULT_EQUAL_FUNC,
  INTERVAL_FUNC, ISNOTNULLTEST_FUNC, SP_EQUALS_FUNC, SP_DISJOINT_FUNC,
  SP_INTERSECTS_FUNC, SP_TOUCHES_FUNC, SP_CROSSES_FUNC, SP_WITHIN_FUNC,
  SP_CONTAINS_FUNC, SP_COVEREDBY_FUNC, SP_COVERS_FUNC, SP_OVERLAPS_FUNC,
  SP_STARTPOINT, SP_ENDPOINT, SP_EXTERIORRING, SP_POINTN,
  SP_GEOMETRYN, SP_INTERIORRINGN, NOT_FUNC, NOT_ALL_FUNC,
  NOW_FUNC, TRIG_COND_FUNC, SUSERVAR_FUNC, GUSERVAR_FUNC,
  COLLATE_FUNC, EXTRACT_FUNC, TYPECAST_FUNC, FUNC_SP,
  UDF_FUNC, NEG_FUNC, GSYSVAR_FUNC, GROUPING_FUNC,
  TABLE_FUNC, DD_INTERNAL_FUNC, PLUS_FUNC, MINUS_FUNC,
  MUL_FUNC, DIV_FUNC, CEILING_FUNC, SQRT_FUNC,
  ABS_FUNC, FLOOR_FUNC, LOG_FUNC, LN_FUNC,
  LOG10_FUNC, SIN_FUNC, TAN_FUNC, COS_FUNC,
  ASIN_FUNC, ATAN_FUNC, ACOS_FUNC, MOD_FUNC,
  IF_FUNC, CASE_FUNC, YEAR_FUNC, MONTH_FUNC,
  DAY_FUNC, TO_DAYS_FUNC, DATE_FUNC, HOUR_FUNC,
  MINUTE_FUNC, SECOND_FUNC, MICROSECOND_FUNC, WEEK_FUNC,
  WEEKDAY_FUNC, DATEADD_FUNC, DATETIME_LITERAL, GREATEST_FUNC,
  LEAST_FUNC, JSON_CONTAINS, JSON_OVERLAPS, MEMBER_OF_FUNC
}
 
enum  optimize_type {
  OPTIMIZE_NONE, OPTIMIZE_KEY, OPTIMIZE_OP, OPTIMIZE_NULL,
  OPTIMIZE_EQUAL
}
 
- Public Types inherited from Item
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_const_item_cache { CACHE_NONE = 0, CACHE_JSON_VALUE, CACHE_JSON_ATOM }
 How to cache constant JSON data. More...
 
enum  Bool_test {
  BOOL_IS_TRUE = 0x00, BOOL_IS_FALSE = 0x01, BOOL_IS_UNKNOWN = 0x02, BOOL_NOT_TRUE = 0x03,
  BOOL_NOT_FALSE = 0x04, BOOL_NOT_UNKNOWN = 0x05, BOOL_IDENTITY = 0x06, BOOL_NEGATED = 0x07,
  BOOL_ALWAYS_TRUE = 0x08, BOOL_ALWAYS_FALSE = 0x09
}
 < Modifier for result transformation More...
 
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

enum Type type () const override
 
virtual enum Functype functype () const
 
 Item_func ()
 
 Item_func (const POS &pos)
 
 Item_func (Item *a)
 
 Item_func (const POS &pos, Item *a)
 
 Item_func (Item *a, Item *b)
 
 Item_func (const POS &pos, Item *a, Item *b)
 
 Item_func (Item *a, Item *b, Item *c)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c)
 
 Item_func (Item *a, Item *b, Item *c, Item *d)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c, Item *d)
 
 Item_func (Item *a, Item *b, Item *c, Item *d, Item *e)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
 
 Item_func (List< Item > &list)
 
 Item_func (const POS &pos, PT_item_list *opt_list)
 
 Item_func (THD *thd, Item_func *item)
 
bool itemize (Parse_context *pc, Item **res) override
 The same as contextualize()/contextualize_() but with additional parameter. More...
 
bool fix_fields (THD *, Item **ref) override
 
bool fix_func_arg (THD *, Item **arg)
 
void fix_after_pullout (SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
 Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion. More...
 
virtual table_map get_initial_pseudo_tables () const
 Returns the pseudo tables depended upon in order to evaluate this function expression. More...
 
table_map used_tables () const override
 
table_map not_null_tables () const override
 
void update_used_tables () override
 
void set_used_tables (table_map map)
 
bool eq (const Item *item, bool binary_cmp) const override
 
virtual optimize_type select_optimize (const THD *)
 
virtual bool have_rev_func () const
 
virtual Itemkey_item () const
 
Item ** arguments () const
 
void set_arguments (List< Item > &list, bool context_free)
 Copy arguments from list to args array. More...
 
uint argument_count () const
 
void split_sum_func (THD *thd, Ref_item_array ref_item_array, List< Item > &fields) override
 See comments in Item_cmp_func::split_sum_func() More...
 
void print (const THD *thd, String *str, enum_query_type query_type) const override
 This method is used for to: More...
 
void print_op (const THD *thd, String *str, enum_query_type query_type) const
 
void print_args (const THD *thd, String *str, uint from, enum_query_type query_type) const
 
virtual void fix_num_length_and_dec ()
 
virtual bool is_deprecated () const
 
bool get_arg0_date (MYSQL_TIME *ltime, my_time_flags_t fuzzy_date)
 
bool get_arg0_time (MYSQL_TIME *ltime)
 
bool is_null () override
 
void signal_divide_by_null ()
 
void signal_invalid_argument_for_log ()
 
Fieldtmp_table_field ()
 
Fieldtmp_table_field (TABLE *t_arg) override
 
Itemget_tmp_table_item (THD *thd) override
 
my_decimalval_decimal (my_decimal *) override
 
bool agg_arg_charsets (DTCollation &c, Item **items, uint nitems, uint flags, int item_sep)
 
bool agg_arg_charsets_for_string_result (DTCollation &c, Item **items, uint nitems, int item_sep=1)
 
bool agg_arg_charsets_for_comparison (DTCollation &c, Item **items, uint nitems, int item_sep=1)
 
bool agg_arg_charsets_for_string_result_with_comparison (DTCollation &c, Item **items, uint nitems, int item_sep=1)
 
bool walk (Item_processor processor, enum_walk walk, uchar *arg) override
 Traverses a tree of Items in prefix and/or postfix order. More...
 
Itemtransform (Item_transformer transformer, uchar *arg) override
 Transform an Item_func object with a transformer callback function. More...
 
Itemcompile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) override
 Compile Item_func object with a processor and a transformer callback functions. More...
 
void traverse_cond (Cond_traverser traverser, void *arg, traverse_order order) override
 
double check_float_overflow (double value)
 Throw an error if the input double number is not finite, i.e. More...
 
longlong check_integer_overflow (longlong value, bool val_unsigned)
 Throw an error if the input BIGINT value represented by the (longlong value, bool unsigned flag) pair cannot be returned by the function, i.e. More...
 
int check_decimal_overflow (int error)
 Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW. More...
 
bool has_timestamp_args ()
 
bool has_date_args ()
 
bool has_time_args ()
 
bool has_datetime_args ()
 
bool check_valid_arguments_processor (uchar *) override
 
Itemgc_subst_transformer (uchar *arg) override
 Transformer function for GC substitution. More...
 
virtual void replace_argument (THD *thd, Item **oldpp, Item *newp)
 Does essentially the same as THD::change_item_tree, plus maintains any necessary any invariants. More...
 
virtual enum_const_item_cache can_cache_json_arg (Item *arg)
 Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion. More...
 
- Public Member Functions inherited from Item_result_field
 Item_result_field ()
 
 Item_result_field (const POS &pos)
 
 Item_result_field (THD *thd, Item_result_field *item)
 
 ~Item_result_field () override
 
Fieldget_tmp_table_field () override
 
virtual bool resolve_type (THD *thd)=0
 Resolve type-related information for this item, such as result field type, maximum size, precision, signedness, character set and collation. More...
 
void set_result_field (Field *field) override
 
bool is_result_field () const override
 
Fieldget_result_field () const override
 
void save_in_result_field (bool no_conversions) override
 
void cleanup () override
 
virtual const char * func_name () const =0
 
bool mark_field_in_map (uchar *arg) override
 Mark underlying field in read or write map of a table. More...
 
longlong llrint_with_overflow_check (double realval)
 
void raise_numeric_overflow (const char *type_name)
 
double raise_float_overflow ()
 
longlong raise_integer_overflow ()
 
int raise_decimal_overflow ()
 
- Public Member Functions inherited from Item
 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
 
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 make_field (Send_field *field)
 
virtual Fieldmake_string_field (TABLE *table)
 Create a field to hold a string value from an item. 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 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
 
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
 
bool is_null_value ()
 For template-compatibility with Field. More...
 
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 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 const char * full_name () 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 (const THD *thd) const
 Return true if this is a const item that may be evaluated in the current phase of statement processing. More...
 
void print_item_w_name (const THD *thd, String *, enum_query_type query_type) const
 
void print_for_order (const THD *thd, String *str, enum_query_type query_type, bool used_alias) const
 Prints the item when it's part of ORDER BY and GROUP BY. More...
 
void split_sum_func2 (THD *thd, Ref_item_array ref_item_array, List< Item > &fields, Item **ref, bool skip_registered)
 
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...
 
bool update_null_value ()
 Make sure the null_value member has a correct value. More...
 
virtual void apply_is_true ()
 Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the same. More...
 
virtual bool is_bool_func () const
 
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 const CHARSET_INFOcompare_collation () const
 
virtual const CHARSET_INFOcharset_for_protocol () const
 
template<class T >
bool walk_helper_thunk (uchar *arg)
 
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 find_field_processor (uchar *)
 Is this an Item_field which references the given Field argument? More...
 
virtual bool references_select_expr_of (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_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 Itemtruth_transformer (THD *thd, Bool_test test)
 Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implement this test by itself. More...
 
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...
 
bool has_rollup_expr () const
 
void set_rollup_expr ()
 Set the property: this item (tree) contains a reference to a ROLLUP expr. More...
 
bool has_grouping_func () const
 
void set_grouping_func ()
 Set the property: this item is a call to GROUPING. 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 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 *)
 
virtual bool strip_db_table_name_processor (uchar *)
 
virtual bool set_table_name (uchar *)
 Noop in Item for items that are not subclasses of Item_ident. More...
 
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...
 
virtual bool returns_array () const
 Whether the item returns array of its data type. More...
 
virtual void allow_array_cast ()
 
A helper funciton to ensure proper usage of CAST(. 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...
 

Public Attributes

uint arg_count
 
- Public Attributes inherited from Item_result_field
Fieldresult_field
 
- Public Attributes inherited from Item
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

const Item_fieldcontributes_to_filter (table_map read_tables, table_map filter_for_table, const MY_BITMAP *fields_to_ignore) const
 Whether or not an item should contribute to the filtering effect (. More...
 
virtual bool may_have_named_parameters () const
 Named parameters are allowed in a parameter list. More...
 
virtual bool is_non_const_over_literals (uchar *) override
 
bool check_function_as_value_generator (uchar *checker_args) override
 Check if this item is allowed for a virtual column or inside a default expression. More...
 
- Protected Member Functions inherited from Item
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 ()
 

Protected Attributes

Item ** args
 
Itemtmp_arg [2]
 
bool null_on_null = true
 Affects how to determine that NULL argument implies a NULL function return. More...
 
uint allowed_arg_cols = 1
 
table_map used_tables_cache
 Value used in calculation of result of used_tables() More...
 
table_map not_null_tables_cache
 Value used in calculation of result of not_null_tables() More...
 
- Protected Attributes inherited from Item
String str_value
 str_values's main purpose is to cache the value in save_in_field More...
 
uint8 m_accum_properties
 

Private Types

typedef Item_result_field super
 

Friends

class udf_handler
 

Additional Inherited Members

- Static Public Member Functions inherited from Item
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
 
- Static Protected Member Functions inherited from Item
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...
 
- Static Protected Attributes inherited from Item
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
 
static constexpr uint8 PROP_ROLLUP_EXPR = 0x10
 Set if the item or one or more of the underlying items contains a ROLLUP expression. More...
 
static constexpr uint8 PROP_GROUPING_FUNC = 0x20
 Set if the item or one or more of the underlying items is a GROUPING function. More...
 

Member Typedef Documentation

◆ super

Member Enumeration Documentation

◆ Functype

Enumerator
UNKNOWN_FUNC 
EQ_FUNC 
EQUAL_FUNC 
NE_FUNC 
LT_FUNC 
LE_FUNC 
GE_FUNC 
GT_FUNC 
FT_FUNC 
MATCH_FUNC 
LIKE_FUNC 
ISNULL_FUNC 
ISNOTNULL_FUNC 
ISTRUTH_FUNC 
COND_AND_FUNC 
COND_OR_FUNC 
XOR_FUNC 
BETWEEN 
IN_FUNC 
MULT_EQUAL_FUNC 
INTERVAL_FUNC 
ISNOTNULLTEST_FUNC 
SP_EQUALS_FUNC 
SP_DISJOINT_FUNC 
SP_INTERSECTS_FUNC 
SP_TOUCHES_FUNC 
SP_CROSSES_FUNC 
SP_WITHIN_FUNC 
SP_CONTAINS_FUNC 
SP_COVEREDBY_FUNC 
SP_COVERS_FUNC 
SP_OVERLAPS_FUNC 
SP_STARTPOINT 
SP_ENDPOINT 
SP_EXTERIORRING 
SP_POINTN 
SP_GEOMETRYN 
SP_INTERIORRINGN 
NOT_FUNC 
NOT_ALL_FUNC 
NOW_FUNC 
TRIG_COND_FUNC 
SUSERVAR_FUNC 
GUSERVAR_FUNC 
COLLATE_FUNC 
EXTRACT_FUNC 
TYPECAST_FUNC 
FUNC_SP 
UDF_FUNC 
NEG_FUNC 
GSYSVAR_FUNC 
GROUPING_FUNC 
TABLE_FUNC 
DD_INTERNAL_FUNC 
PLUS_FUNC 
MINUS_FUNC 
MUL_FUNC 
DIV_FUNC 
CEILING_FUNC 
SQRT_FUNC 
ABS_FUNC 
FLOOR_FUNC 
LOG_FUNC 
LN_FUNC 
LOG10_FUNC 
SIN_FUNC 
TAN_FUNC 
COS_FUNC 
ASIN_FUNC 
ATAN_FUNC 
ACOS_FUNC 
MOD_FUNC 
IF_FUNC 
CASE_FUNC 
YEAR_FUNC 
MONTH_FUNC 
DAY_FUNC 
TO_DAYS_FUNC 
DATE_FUNC 
HOUR_FUNC 
MINUTE_FUNC 
SECOND_FUNC 
MICROSECOND_FUNC 
WEEK_FUNC 
WEEKDAY_FUNC 
DATEADD_FUNC 
DATETIME_LITERAL 
GREATEST_FUNC 
LEAST_FUNC 
JSON_CONTAINS 
JSON_OVERLAPS 
MEMBER_OF_FUNC 

◆ optimize_type

Enumerator
OPTIMIZE_NONE 
OPTIMIZE_KEY 
OPTIMIZE_OP 
OPTIMIZE_NULL 
OPTIMIZE_EQUAL 

Constructor & Destructor Documentation

◆ Item_func() [1/15]

Item_func::Item_func ( )
inline

◆ Item_func() [2/15]

Item_func::Item_func ( const POS pos)
inlineexplicit

◆ Item_func() [3/15]

Item_func::Item_func ( Item a)
inline

◆ Item_func() [4/15]

Item_func::Item_func ( const POS pos,
Item a 
)
inline

◆ Item_func() [5/15]

Item_func::Item_func ( Item a,
Item b 
)
inline

◆ Item_func() [6/15]

Item_func::Item_func ( const POS pos,
Item a,
Item b 
)
inline

◆ Item_func() [7/15]

Item_func::Item_func ( Item a,
Item b,
Item c 
)
inline

◆ Item_func() [8/15]

Item_func::Item_func ( const POS pos,
Item a,
Item b,
Item c 
)
inline

◆ Item_func() [9/15]

Item_func::Item_func ( Item a,
Item b,
Item c,
Item d 
)
inline

◆ Item_func() [10/15]

Item_func::Item_func ( const POS pos,
Item a,
Item b,
Item c,
Item d 
)
inline

◆ Item_func() [11/15]

Item_func::Item_func ( Item a,
Item b,
Item c,
Item d,
Item e 
)
inline

◆ Item_func() [12/15]

Item_func::Item_func ( const POS pos,
Item a,
Item b,
Item c,
Item d,
Item e 
)
inline

◆ Item_func() [13/15]

Item_func::Item_func ( List< Item > &  list)
inline

◆ Item_func() [14/15]

Item_func::Item_func ( const POS pos,
PT_item_list opt_list 
)

◆ Item_func() [15/15]

Item_func::Item_func ( THD thd,
Item_func item 
)

Member Function Documentation

◆ agg_arg_charsets()

bool Item_func::agg_arg_charsets ( DTCollation c,
Item **  items,
uint  nitems,
uint  flags,
int  item_sep 
)
inline

◆ agg_arg_charsets_for_comparison()

bool Item_func::agg_arg_charsets_for_comparison ( DTCollation c,
Item **  items,
uint  nitems,
int  item_sep = 1 
)
inline

◆ agg_arg_charsets_for_string_result()

bool Item_func::agg_arg_charsets_for_string_result ( DTCollation c,
Item **  items,
uint  nitems,
int  item_sep = 1 
)
inline

◆ agg_arg_charsets_for_string_result_with_comparison()

bool Item_func::agg_arg_charsets_for_string_result_with_comparison ( DTCollation c,
Item **  items,
uint  nitems,
int  item_sep = 1 
)
inline

◆ argument_count()

uint Item_func::argument_count ( ) const
inline

◆ arguments()

Item** Item_func::arguments ( ) const
inline

◆ can_cache_json_arg()

virtual enum_const_item_cache Item_func::can_cache_json_arg ( Item arg)
inlinevirtual

Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.

This function returns true only for those args, which are the source of JSON data. JSON path args are cached independently and for them this function returns false. Same as for all other type of args.

Parameters
argthe arg to cache
Returns
true arg can be cached false otherwise

Reimplemented in Item_func_member_of, Item_func_json_overlaps, Item_func_json_contains_path, and Item_func_json_contains.

◆ check_decimal_overflow()

int Item_func::check_decimal_overflow ( int  error)
inline

Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW.

◆ check_float_overflow()

double Item_func::check_float_overflow ( double  value)
inline

Throw an error if the input double number is not finite, i.e.

is either +/-INF or NAN.

◆ check_function_as_value_generator()

bool Item_func::check_function_as_value_generator ( uchar args)
inlineoverrideprotectedvirtual

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 from Item_result_field.

Reimplemented in Item_func_uuid_short, Item_func_found_rows, Item_func_sp, Item_func_row_count, Item_func_is_used_lock, Item_func_is_free_lock, Item_func_match, 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_func_rand, Item_func_floor, Item_func_ceiling, Item_func_uuid, Item_func_now, Item_func_abs, Item_func_neg, Item_func_curdate, Item_func_mod, Item_func_int_div, Item_func_mul, Item_func_curtime, Item_func_additive_op, Item_load_file, Item_func_connection_id, Item_func_user, Item_func_sysconst, Item_nodeset_to_const_comparator, Item_func_unix_timestamp, Item_func_statement_digest_text, Item_func_statement_digest, Item_nodeset_func, Item_func_xml_update, and Item_xml_str_func.

◆ check_integer_overflow()

longlong Item_func::check_integer_overflow ( longlong  value,
bool  val_unsigned 
)
inline

Throw an error if the input BIGINT value represented by the (longlong value, bool unsigned flag) pair cannot be returned by the function, i.e.

is not compatible with this Item's unsigned_flag.

◆ check_valid_arguments_processor()

◆ compile()

Item * Item_func::compile ( Item_analyzer  analyzer,
uchar **  arg_p,
Item_transformer  transformer,
uchar arg_t 
)
overridevirtual

Compile Item_func object with a processor and a transformer callback functions.

First the function applies the analyzer to the root node of the Item_func object. Then if the analyzer succeeeds (returns true) the function recursively applies the compile method to each argument of the Item_func node. If the call of the method for an argument item returns a new item the old item is substituted for a new one. After this the transformer is applied to the root node of the Item_func object.

Reimplemented from Item.

◆ contributes_to_filter()

const Item_field * Item_func::contributes_to_filter ( table_map  read_tables,
table_map  filter_for_table,
const MY_BITMAP fields_to_ignore 
) const
protected

Whether or not an item should contribute to the filtering effect (.

See also
get_filtering_effect()). First it verifies that table requirements are satisfied as follows:

1) The item must refer to a field in 'filter_for_table' in some way. This reference may be indirect through any number of intermediate items. For example, this item may be an Item_cond_and which refers to an Item_func_eq which refers to the field. 2) The item must not refer to other tables than those already read and the table in 'filter_for_table'

Then it contines to other properties as follows:

Item_funcs represent "<operand1> OP <operand2> [OP ...]". If the Item_func is to contribute to the filtering effect, then

1) one of the operands must be a field from 'filter_for_table' that is not in 'fields_to_ignore', and 2) depending on the Item_func type filtering effect is calculated for, one or all [1] of the other operand(s) must be an available value, i.e.:

  • a constant, or
  • a constant subquery, or
  • a field value read from a table in 'read_tables', or
  • a second field in 'filter_for_table', or
  • a function that only refers to constants or tables in 'read_tables', or
  • special case: an implicit value like NULL in the case of "field IS NULL". Such Item_funcs have arg_count==1.

[1] "At least one" for multiple equality (X = Y = Z = ...), "all" for the rest (e.g. BETWEEN)

Parameters
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.
filter_for_tableThe table we are calculating filter effect for
fields_to_ignoreColumns that should be ignored.
Returns
Item_field that participates in the predicate if none of the requirements are broken, NULL otherwise
Note
: This function only applies to items doing comparison, i.e. boolean predicates. Unfortunately, some of those items do not inherit from Item_bool_func so the member function has to be placed in Item_func.

◆ eq()

bool Item_func::eq ( const Item item,
bool  binary_cmp 
) const
overridevirtual

◆ fix_after_pullout()

void Item_func::fix_after_pullout ( SELECT_LEX parent_select,
SELECT_LEX removed_select 
)
overridevirtual

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 from Item.

Reimplemented in Item_func_sp.

◆ fix_fields()

◆ fix_func_arg()

bool Item_func::fix_func_arg ( THD thd,
Item **  arg 
)

◆ fix_num_length_and_dec()

void Item_func::fix_num_length_and_dec ( )
virtual

◆ functype()

virtual enum Functype Item_func::functype ( ) const
inlinevirtual

Reimplemented in Item_func_sp, Item_func_match, Item_func_get_system_var, Item_func_get_user_var, Item_func_set_user_var, 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_internal_tablespace_extent_size, Item_func_internal_tablespace_total_extents, Item_func_internal_tablespace_free_extents, Item_func_grouping, Item_func_internal_tablespace_logfile_group_number, Item_func_internal_tablespace_id, Item_func_internal_index_column_cardinality, Item_func_internal_checksum, Item_func_internal_auto_increment, Item_func_internal_data_free, Item_func_internal_index_length, Item_func_internal_max_data_length, Item_func_internal_data_length, Item_func_internal_avg_row_length, Item_func_internal_table_rows, Item_cond_or, Item_cond_and, Item_equal, Item_func_like, Item_func_isnotnull, Item_is_not_null_test, Item_udf_func, Item_func_isnull, Item_func_in, Item_func_case, Item_func_internal_get_dd_column_extra, Item_func_internal_check_time, Item_func_internal_update_time, Item_func_convert_interval_to_user_interval, Item_func_remove_dd_property_key, Item_func_get_dd_property_key_value, Item_func_microsecond, Item_func_internal_tablespace_extra, Item_func_internal_tablespace_row_format, Item_func_internal_tablespace_status, Item_func_internal_tablespace_logfile_group_name, Item_typecast_datetime, Item_func_max, Item_func_min, Item_func_internal_tablespace_type, Item_typecast_time, Item_func_get_partition_nodegroup, Item_typecast_date, Item_func_get_dd_index_private_data, Item_func_get_dd_tablespace_private_data, Item_extract, Item_func_internal_get_comment_or_error, Item_date_add_interval, Item_func_get_dd_create_options, Item_func_get_dd_column_privileges, Item_func_floor, Item_func_ceiling, Item_func_tan, Item_func_sin, Item_func_cos, Item_func_if, Item_func_atan, Item_func_asin, Item_func_acos, Item_func_st_within, Item_func_now_local, Item_func_st_touches, Item_func_sqrt, Item_func_log10, Item_func_st_overlaps, Item_func_mbrwithin, Item_func_log, Item_func_mbrtouches, Item_func_ln, Item_func_mbroverlaps, Item_func_mbrintersects, Item_func_abs, Item_func_mbrequals, Item_func_mbrdisjoint, Item_func_neg, Item_func_mbrcovers, Item_func_mod, Item_func_mbrcoveredby, Item_func_mbrcontains, Item_func_set_collation, Item_func_st_intersects, Item_func_div, Item_func_st_equals, Item_func_between, Item_func_mul, Item_func_st_disjoint, Item_func_st_crosses, Item_func_minus, Item_func_st_contains, Item_func_plus, Item_func_ne, Item_typecast_real, Item_datetime_literal, Item_func_lt, Item_typecast_decimal, Item_func_le, Item_typecast_char, Item_typecast_unsigned, Item_func_member_of, Item_func_gt, Item_typecast_signed, Item_func_json_overlaps, Item_func_ge, Item_func_spatial_mbr_rel, Item_func_equal, Item_func_array_cast, Item_func_eq, Item_func_not_all, Item_func_trig_cond, Item_date_func, Item_func_match_predicate, Item_func_not, Item_func_xor, Item_func_json_contains, Item_func_weekday, Item_func_year, Item_func_week, Item_func_truth, Item_func_second, Item_func_minute, Item_func_hour, Item_func_month, Item_func_dayofmonth, and Item_func_to_days.

◆ gc_subst_transformer()

Item * Item_func::gc_subst_transformer ( uchar arg)
overridevirtual

Transformer function for GC substitution.

Parameters
argList of indexed GC field
Returns
this item

This function transforms the WHERE condition. It doesn't change 'this' item but rather changes its arguments. It takes list of GC fields and checks whether arguments of 'this' item matches them and index over the GC field isn't disabled with hints. If so, it replaces the argument with newly created Item_field which uses the matched GC field. Following functions' arguments could be transformed:

  • EQ_FUNC, LT_FUNC, LE_FUNC, GE_FUNC, GT_FUNC
    • Left or right argument if the opposite argument is a constant.
  • IN_FUNC, BETWEEN
    • Left argument if all other arguments are constant and of the same type.

After transformation comparators are updated to take into account the new field.

Reimplemented from Item.

◆ get_arg0_date()

bool Item_func::get_arg0_date ( MYSQL_TIME ltime,
my_time_flags_t  fuzzy_date 
)
inline

◆ get_arg0_time()

bool Item_func::get_arg0_time ( MYSQL_TIME ltime)
inline

◆ get_initial_pseudo_tables()

virtual table_map Item_func::get_initial_pseudo_tables ( ) const
inlinevirtual

Returns the pseudo tables depended upon in order to evaluate this function expression.

The default implementation returns the empty set.

Reimplemented in Item_func_sp, Item_is_not_null_test, Item_func_sleep, Item_func_benchmark, Item_func_rand, Item_func_sysdate_local, and Item_func_uuid.

◆ get_tmp_table_item()

Item * Item_func::get_tmp_table_item ( THD thd)
overridevirtual

Reimplemented from Item.

◆ has_date_args()

bool Item_func::has_date_args ( )
inline

◆ has_datetime_args()

bool Item_func::has_datetime_args ( )
inline

◆ has_time_args()

bool Item_func::has_time_args ( )
inline

◆ has_timestamp_args()

bool Item_func::has_timestamp_args ( )
inline

◆ have_rev_func()

virtual bool Item_func::have_rev_func ( ) const
inlinevirtual

Reimplemented in Item_bool_func2.

◆ is_deprecated()

virtual bool Item_func::is_deprecated ( ) const
inlinevirtual

Reimplemented in Item_func_json_merge.

◆ is_non_const_over_literals()

virtual bool Item_func::is_non_const_over_literals ( uchar )
inlineoverrideprotectedvirtual

◆ is_null()

bool Item_func::is_null ( )
inlineoverridevirtual

◆ itemize()

bool Item_func::itemize ( Parse_context pc,
Item **  res 
)
overridevirtual

◆ key_item()

virtual Item* Item_func::key_item ( ) const
inlinevirtual

◆ may_have_named_parameters()

virtual bool Item_func::may_have_named_parameters ( ) const
inlineprotectedvirtual

Named parameters are allowed in a parameter list.

The syntax to name parameters in a function call is as follow: foo(expr AS named, expr named, expr AS "named", expr "named") where "AS" is optional. Only UDF function support that syntax.

Returns
true if the function item can have named parameters

Reimplemented in Item_udf_func.

◆ not_null_tables()

table_map Item_func::not_null_tables ( ) const
inlineoverridevirtual

Reimplemented from Item.

Reimplemented in Item_datetime_literal, Item_time_literal, and Item_date_literal.

◆ print()

void Item_func::print ( const THD ,
String str,
enum_query_type   
) const
overridevirtual

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 from Item.

Reimplemented in Item_func_match, Item_func_get_system_var, Item_func_get_user_var, Item_func_set_user_var, Item_udf_func, Item_func_benchmark, Item_func_bit_neg, Item_func_bit, Item_func_get_format, Item_func_locate, Item_func_timestamp_diff, Item_func_add_time, Item_typecast_datetime, Item_typecast_time, Item_typecast_date, Item_extract, Item_date_add_interval, Item_func_weight_string, Item_func_int_div, Item_func_set_collation, Item_func_conv_charset, Item_func_spatial_relation, Item_typecast_real, Item_datetime_literal, Item_typecast_decimal, Item_typecast_char, Item_typecast_unsigned, Item_time_literal, Item_func_member_of, Item_typecast_signed, Item_func_spatial_mbr_rel, Item_date_literal, Item_func_array_cast, Item_num_op, Item_func_format, Item_func_make_set, Item_func_trim, Item_temporal_func, and Item_typecast_json.

◆ print_args()

void Item_func::print_args ( const THD thd,
String str,
uint  from,
enum_query_type  query_type 
) const

◆ print_op()

void Item_func::print_op ( const THD thd,
String str,
enum_query_type  query_type 
) const

◆ replace_argument()

void Item_func::replace_argument ( THD thd,
Item **  oldpp,
Item newp 
)
virtual

Does essentially the same as THD::change_item_tree, plus maintains any necessary any invariants.

Reimplemented in Item_in_optimizer.

◆ select_optimize()

◆ set_arguments()

void Item_func::set_arguments ( List< Item > &  list,
bool  context_free 
)

Copy arguments from list to args array.

Parameters
listfunction argument list
context_freetrue: for use in context-independent constructors (Item_func(POS,...)) i.e. for use in the parser

◆ set_used_tables()

void Item_func::set_used_tables ( table_map  map)
inline

◆ signal_divide_by_null()

void Item_func::signal_divide_by_null ( )

◆ signal_invalid_argument_for_log()

void Item_func::signal_invalid_argument_for_log ( )

◆ split_sum_func()

void Item_func::split_sum_func ( THD thd,
Ref_item_array  ref_item_array,
List< Item > &  fields 
)
overridevirtual

See comments in Item_cmp_func::split_sum_func()

Reimplemented from Item.

Reimplemented in Item_func_make_set.

◆ tmp_table_field() [1/2]

Field* Item_func::tmp_table_field ( )
inline

◆ tmp_table_field() [2/2]

Field * Item_func::tmp_table_field ( TABLE t_arg)
overridevirtual

◆ transform()

Item * Item_func::transform ( Item_transformer  transformer,
uchar argument 
)
overridevirtual

Transform an Item_func object with a transformer callback function.

The function recursively applies the transform method to each argument of the Item_func node. If the call of the method for an argument item returns a new item the old item is substituted for a new one. After this the transformer is applied to the root node of the Item_func object.

Reimplemented from Item.

Reimplemented in Item_func_make_set.

◆ traverse_cond()

void Item_func::traverse_cond ( Cond_traverser  traverser,
void *  arg,
traverse_order  order 
)
overridevirtual

Reimplemented from Item.

◆ type()

enum Type Item_func::type ( ) const
inlineoverridevirtual

Implements Item.

Reimplemented in Item_nodeset_to_const_comparator, and Item_nodeset_func.

◆ update_used_tables()

void Item_func::update_used_tables ( )
overridevirtual

◆ used_tables()

table_map Item_func::used_tables ( ) const
inlineoverridevirtual

◆ val_decimal()

◆ walk()

bool Item_func::walk ( Item_processor  processor,
enum_walk  walk,
uchar arg 
)
overridevirtual

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 enum_walk::PREFIX: call processor before invoking children enum_walk::POSTFIX: call processor after invoking children enum_walk::SUBQUERY go down into subqueries walk values are bit-coded and may be combined. Omitting both enum_walk::PREFIX and enum_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 from Item.

Reimplemented in Item_func_make_set.

Friends And Related Function Documentation

◆ udf_handler

friend class udf_handler
friend

Member Data Documentation

◆ allowed_arg_cols

uint Item_func::allowed_arg_cols = 1
protected

◆ arg_count

uint Item_func::arg_count

◆ args

Item** Item_func::args
protected

◆ not_null_tables_cache

table_map Item_func::not_null_tables_cache
protected

Value used in calculation of result of not_null_tables()

◆ null_on_null

bool Item_func::null_on_null = true
protected

Affects how to determine that NULL argument implies a NULL function return.

Default behaviour in this class is:

  • if true, any NULL argument means the function returns NULL.
  • if false, no such assumption is made and not_null_tables_cache is thus set to 0. null_on_null is true for all Item_func derived classes, except Item_func_sp, all CASE derived functions and a few other functions. RETURNS NULL ON NULL INPUT can be implemented for stored functions by modifying this member in class Item_func_sp.

◆ tmp_arg

Item * Item_func::tmp_arg[2]
protected

◆ used_tables_cache

table_map Item_func::used_tables_cache
protected

Value used in calculation of result of used_tables()


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