MySQL 9.1.0
Source Code Documentation
|
Base class that is used to represent any kind of expression in a relational query. More...
#include <item.h>
Classes | |
struct | Aggregate_ref_update |
struct | Aggregate_replacement |
class | Cleanup_after_removal_context |
Context object for (functions that override) Item::clean_up_after_removal(). More... | |
class | Collect_item_fields_or_refs |
class | Collect_item_fields_or_view_refs |
struct | Collect_scalar_subquery_info |
Context struct used by walk method collect_scalar_subqueries to accumulate information about scalar subqueries found. More... | |
struct | Css_info |
Minion class under Collect_scalar_subquery_info ("Css"). More... | |
struct | Item_field_replacement |
struct | Item_func_call_replacement |
struct | Item_replacement |
struct | Item_view_ref_replacement |
struct | Replace_equal |
Public Member Functions | |
Item (const Item &)=delete | |
void | operator= (Item &)=delete |
Item () | |
Item constructor for general use. More... | |
Item (THD *thd, const Item *item) | |
Constructor used by Item_field, Item_ref & aggregate functions. More... | |
Item (const POS &) | |
Parse-time context-independent constructor. More... | |
~Item () override=default | |
virtual bool | itemize (Parse_context *pc, Item **res) final |
The same as 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 () |
Called for every Item after use (preparation and execution). More... | |
virtual void | notify_removal () |
Called when an item has been removed, can be used to notify external objects about the removal, e.g subquery predicates that are part of the sj_candidates container. More... | |
virtual void | make_field (Send_field *field) |
virtual Field * | make_string_field (TABLE *table) const |
Create a field to hold a string value from an item. More... | |
virtual bool | fix_fields (THD *, Item **) |
virtual void | fix_after_pullout (Query_block *parent_query_block, Query_block *removed_query_block) |
Fix after tables have been moved from one query_block level to the parent level, e.g by semijoin conversion. More... | |
void | quick_fix_field () |
virtual void | set_can_use_prefix_key () |
virtual bool | propagate_type (THD *thd, const Type_properties &type) |
Propagate data type specifications into parameters and user variables. More... | |
bool | propagate_type (THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR, bool pin=false, bool inherit=false) |
Wrapper for easier calling of propagate_type(const Type_properties &). More... | |
virtual void | mark_json_as_scalar () |
For Items with data type JSON, mark that a string argument is treated as a scalar JSON value. More... | |
virtual std::optional< ContainedSubquery > | get_contained_subquery (const Query_block *outer_query_block) |
If this item represents a IN/ALL/ANY/comparison_operator subquery, return that (along with data on how it will be executed). More... | |
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... | |
void | save_in_field_no_error_check (Field *field, bool no_conversions) |
A slightly faster value of save_in_field() that returns no error value (you will need to check thd->is_error() yourself), and does not support saving into hidden fields for functional indexes. 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 scalar item, possibly using the supplied buffer. More... | |
virtual bool | eq (const Item *) const |
Compare this item with another item for equality. More... | |
const Item * | unwrap_for_eq () const |
Unwrap an Item argument so that Item::eq() can see the "real" item, and not just the wrapper. More... | |
virtual Item_result | result_type () const |
virtual Item_result | numeric_context_result_type () const |
Result type when an item appear in a numeric context. More... | |
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... | |
virtual void | set_data_type_inherited () |
Set data type for item as inherited. More... | |
virtual void | pin_data_type () |
Pin the data type for the item. More... | |
enum_field_types | data_type () const |
Retrieve the derived data type of the Item. More... | |
virtual enum_field_types | actual_data_type () const |
Retrieve actual data type for an item. More... | |
virtual enum_field_types | default_data_type () const |
Get the default data (output) type for the specific item. More... | |
void | set_data_type (enum_field_types data_type) |
Set the data type of the current Item. More... | |
void | set_data_type_null () |
void | set_data_type_bool () |
void | set_data_type_int (enum_field_types type, bool unsigned_prop, uint32 max_width) |
Set the data type of the Item to be a specific integer type. More... | |
void | set_data_type_longlong () |
Set the data type of the Item to be longlong. More... | |
void | set_data_type_decimal (uint8 precision, uint8 scale) |
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 (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 (uint32 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 (enum_field_types type, 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_vector (uint32 max_l) |
Set the data type of the Item to be VECTOR. More... | |
void | set_data_type_geometry () |
Set the data type of the Item to be GEOMETRY. 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_bit (uint32 max_bits) |
Set the data type of the Item to be bit. More... | |
void | set_data_type_from_item (const Item *item) |
Set data type properties of the item from the properties of another item. More... | |
virtual TYPELIB * | get_typelib () const |
Get the typelib information for an item of type set or enum. More... | |
virtual Item_result | cast_to_int_type () const |
virtual enum Type | type () const =0 |
bool | aggregate_type (const char *name, Item **items, uint count) |
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 | int_sort_key () |
Produces a key suitable for filesort. 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 String * | val_str (String *str)=0 |
virtual String * | val_str_ascii (String *str) |
virtual my_decimal * | val_decimal (my_decimal *decimal_buffer)=0 |
virtual bool | val_bool () |
virtual 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... | |
my_decimal * | error_decimal (my_decimal *decimal_value) |
Get the value to return from val_decimal() in case of errors. More... | |
String * | error_str () |
Get the value to return from val_str() in case of errors. 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 Field * | get_tmp_table_field () |
If this Item is being materialized into a temporary table, returns the field that is being materialized into. More... | |
virtual Field * | tmp_table_field (TABLE *) |
virtual const char * | full_name () const |
virtual table_map | used_tables () const |
virtual table_map | not_null_tables () const |
Return table map of tables that can't be NULL tables (tables that are used in a context where if they would contain a NULL row generated by a LEFT or RIGHT join, the item would not be true). More... | |
virtual bool | basic_const_item () const |
Returns true if this is a simple constant item like an integer, not a constant expression. More... | |
bool | may_eval_const_item (const THD *thd) const |
virtual Item * | clone_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... | |
bool | is_non_deterministic () const |
bool | is_outer_reference () const |
virtual void | print (const THD *, String *str, enum_query_type) const |
This method is used for to: 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, const char *used_alias) const |
Prints the item when it's part of ORDER BY and GROUP BY. More... | |
virtual void | update_used_tables () |
Updates used tables, not null tables information and accumulates properties up the item tree, cf. More... | |
virtual bool | split_sum_func (THD *, Ref_item_array, mem_root_deque< Item * > *) |
bool | split_sum_func2 (THD *thd, Ref_item_array ref_item_array, mem_root_deque< 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 (my_timeval *tm, int *warnings) |
Get timestamp in "struct timeval" format. More... | |
virtual bool | is_null () |
The method allows to determine nullness of a complex expression without fully evaluating it, instead of calling val*() then checking null_value. 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 void | set_result_field (Field *) |
virtual bool | is_result_field () const |
virtual Field * | get_result_field () const |
virtual bool | is_bool_func () const |
virtual void | no_rows_in_result () |
virtual Item * | copy_or_same (THD *) |
virtual Item * | copy_andor_structure (THD *) |
virtual Item * | real_item () |
virtual const Item * | real_item () const |
virtual Item * | get_tmp_table_item (THD *thd) |
If an Item is materialized in a temporary table, a different Item may have to be used in the part of the query that runs after the materialization. More... | |
virtual const CHARSET_INFO * | compare_collation () const |
virtual const CHARSET_INFO * | charset_for_protocol () |
virtual bool | walk (Item_processor processor, enum_walk walk, uchar *arg) |
Traverses a tree of Items in prefix and/or postfix order. More... | |
template<class T > | |
auto | walk_helper_thunk (uchar *arg) |
template<class T > | |
auto | analyze_helper_thunk (uchar **arg) |
See CompileItem. More... | |
virtual Item * | transform (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 Item * | compile (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 | collect_item_field_or_ref_processor (uchar *) |
virtual bool | collect_outer_field_processor (uchar *) |
virtual bool | collect_item_field_or_view_ref_processor (uchar *) |
Collects fields and view references that have the qualifying table in the specified query block. More... | |
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 | cast_incompatible_args (uchar *) |
Wrap incompatible arguments in CAST nodes to the expected data types. More... | |
virtual bool | mark_field_in_map (uchar *arg) |
Mark underlying field in read or write map of a table. More... | |
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 void | bind_fields () |
Bind objects from the current execution context to field objects in item trees. More... | |
virtual bool | clean_up_after_removal (uchar *arg) |
Clean up after removing the item from the item tree. 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 Query_block *) const |
virtual bool | collect_scalar_subqueries (uchar *) |
virtual bool | collect_grouped_aggregates (uchar *) |
virtual bool | collect_subqueries (uchar *) |
virtual bool | update_depended_from (uchar *) |
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... | |
bool | visit_all_analyzer (uchar **) |
virtual bool | cache_const_expr_analyzer (uchar **cache_item) |
Check if an item is a constant one and can be cached. More... | |
Item * | cache_const_expr_transformer (uchar *item) |
Cache item if needed. More... | |
virtual bool | equality_substitution_analyzer (uchar **) |
virtual Item * | equality_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 Item * | explain_subquery_propagator (uchar *) |
virtual Item * | equal_fields_propagator (uchar *) |
virtual bool | disable_constant_propagation (uchar *) |
virtual Item * | replace_equal_field (uchar *) |
virtual bool | replace_equal_field_checker (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 bool | is_valid_for_pushdown (uchar *arg) |
Check if all the columns present in this expression are from the derived table. More... | |
virtual bool | check_column_in_window_functions (uchar *arg) |
Check if all the columns present in this expression are present in PARTITION clause of window functions of the derived table. More... | |
virtual bool | check_column_in_group_by (uchar *arg) |
Check if all the columns present in this expression are present in GROUP BY clause of the derived table. More... | |
virtual Item * | replace_with_derived_expr (uchar *arg) |
Assuming this expression is part of a condition that would be pushed to the WHERE clause of a materialized derived table, replace, in this expression, each derived table's column with a clone of the expression lying under it in the derived table's definition. More... | |
virtual Item * | replace_with_derived_expr_ref (uchar *arg) |
Assuming this expression is part of a condition that would be pushed to the HAVING clause of a materialized derived table, replace, in this expression, each derived table's column with a reference to the expression lying under it in the derived table's definition. More... | |
virtual Item * | replace_view_refs_with_clone (uchar *arg) |
Assuming this expression is part of a condition that would be pushed to a materialized derived table, replace, in this expression, each view reference with a clone of the expression in merged derived table's definition. More... | |
virtual Item * | this_item () |
virtual const Item * | this_item () const |
virtual Item ** | this_item_addr (THD *, Item **addr_arg) |
virtual uint | cols () const |
virtual Item * | element_index (uint) |
virtual Item ** | addr (uint) |
virtual bool | check_cols (uint c) |
virtual bool | null_inside () |
virtual void | bring_value () |
Field * | tmp_table_field_from_field_type (TABLE *table, bool fixed_length) const |
Create a field based on field_type of argument. More... | |
virtual Item_field * | field_for_view_update () |
virtual Item * | truth_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 Item * | update_value_transformer (uchar *) |
virtual Item * | replace_scalar_subquery (uchar *) |
When walking the item tree seeing an Item_singlerow_subselect matching a target, replace it with a substitute field used when transforming scalar subqueries into derived tables. More... | |
virtual Item * | replace_item_field (uchar *) |
Transform processor used by Query_block::transform_grouped_to_derived to replace fields which used to be at the transformed query block with corresponding fields in the new derived table containing the grouping operation of the original transformed query block. More... | |
virtual Item * | replace_func_call (uchar *) |
virtual Item * | replace_item_view_ref (uchar *) |
virtual Item * | replace_aggregate (uchar *) |
virtual Item * | replace_outer_ref (uchar *) |
virtual bool | update_aggr_refs (uchar *) |
A walker processor overridden by Item_aggregate_ref, q.v. More... | |
Item * | convert_charset (THD *thd, const CHARSET_INFO *tocs, bool ignore_errors=false) |
Convert constant string in this object into the specified character set. More... | |
void | delete_self () |
Delete this item. More... | |
virtual bool | is_splocal () const |
virtual Settable_routine_parameter * | get_settable_routine_parameter () |
bool | is_temporal_with_date () const |
bool | is_temporal_with_date_and_time () const |
bool | is_temporal_with_time () const |
bool | is_temporal () const |
bool | has_compatible_context (Item *item) const |
Check whether this and the given item has compatible comparison context. More... | |
virtual Field::geometry_type | get_geometry_type () const |
String * | check_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, const CHARSET_INFO *cs) |
Compare two items using a given collation. More... | |
CostOfItem | cost () const |
uint32 | max_char_length () const |
uint32 | max_char_length (const CHARSET_INFO *cs) 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... | |
uint | reference_count () const |
void | increment_ref_count () |
Increment reference count. More... | |
uint | decrement_ref_count () |
Decrement reference count. 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_grouping_set_dep () const |
void | set_group_by_modifier () |
Set the property: this item (tree) contains a reference to a GROUP BY modifier (such as ROLLUP) 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... | |
void | mark_subqueries_optimized_away () |
virtual bool | gc_subst_analyzer (uchar **) |
Analyzer function for GC substitution. More... | |
virtual Item * | gc_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 (bool array=false) const |
Check if this item is of a type that is eligible for GC substitution. More... | |
void | aggregate_float_properties (enum_field_types type, Item **items, 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_decimal_properties (Item **items, uint nitems) |
Set data type, precision and scale of item of type decimal from list of items. More... | |
void | aggregate_temporal_properties (enum_field_types type, Item **items, uint nitems) |
Set data type and fractional seconds precision for temporal functions. More... | |
bool | aggregate_string_properties (enum_field_types type, const char *name, Item **items, uint nitems) |
Aggregate string properties (character set, collation and maximum length) for string function. More... | |
void | aggregate_bit_properties (Item **items, uint nitems) |
Set data type and properties of a BIT column. 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 bool | strip_db_table_name_processor (uchar *) |
virtual void | compute_cost (CostOfItem *root_cost) const |
Compute the cost of evaluating this Item. More... | |
bool | is_abandoned () const |
bool | is_nullable () const |
void | set_nullable (bool nullable) |
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 function to ensure proper usage of CAST(. More... | |
Public Member Functions inherited from Parse_tree_node_tmpl< Context > | |
virtual | ~Parse_tree_node_tmpl ()=default |
bool | is_contextualized () const |
virtual bool | contextualize (Context *pc) final |
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 | result_to_type (Item_result result) |
static Item_result | type_to_result (enum_field_types type) |
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_INFO * | default_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 | |
Item * | next_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 | null_value |
True if item is null. More... | |
bool | unsigned_flag |
bool | m_is_window_function |
True if item represents window func. More... | |
bool | hidden {false} |
If the item is in a SELECT list (Query_block::fields) and hidden is true, the item wasn't actually in the list as given by the user (it was added by the optimizer, to e.g. More... | |
bool | m_in_check_constraint_exec_ctx {false} |
True if item is a top most element in the expression being evaluated for a check constraint. More... | |
Public Attributes inherited from Parse_tree_node_tmpl< Context > | |
POS | m_pos |
Protected Member Functions | |
String * | make_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 bool | do_itemize (Parse_context *pc, Item **res) |
The core function that does the actual itemization. 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... | |
String * | val_string_from_real (String *str) |
String * | val_string_from_int (String *str) |
String * | val_string_from_decimal (String *str) |
String * | val_string_from_date (String *str) |
String * | val_string_from_datetime (String *str) |
String * | val_string_from_time (String *str) |
my_decimal * | val_decimal_from_real (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_int (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_string (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_date (my_decimal *decimal_value) |
my_decimal * | val_decimal_from_time (my_decimal *decimal_value) |
longlong | val_int_from_decimal () |
longlong | val_int_from_date () |
longlong | val_int_from_time () |
longlong | val_int_from_datetime () |
longlong | val_int_from_string () |
double | val_real_from_decimal () |
double | val_real_from_string () |
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... | |
bool | error_date () |
Get the value to return from get_date() in case of errors. More... | |
bool | error_time () |
Get the value to return from get_time() in case of errors. More... | |
String * | null_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... | |
virtual longlong | val_date_temporal_at_utc () |
virtual longlong | val_time_temporal_at_utc () |
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 ()=delete | |
Parse_tree_node_tmpl (const POS &pos) | |
Parse_tree_node_tmpl (const POS &start_pos, const POS &end_pos) | |
bool | begin_parse_tree (Show_parse_tree *tree) |
bool | end_parse_tree (Show_parse_tree *tree) |
virtual bool | do_contextualize (Context *pc) |
Do all context-sensitive things and mark the node as contextualized. More... | |
virtual void | add_json_info (Json_object *json_obj) |
Add all the node-specific json fields. More... | |
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 |
static constexpr uint8 | PROP_HAS_GROUPING_SET_DEP = 0x10 |
Set if the item or one or more of the underlying items contains a GROUP BY modifier (such as ROLLUP). 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... | |
Private Types | |
typedef Parse_tree_node | super |
Private Member Functions | |
bool | do_contextualize (Parse_context *) override |
virtual bool | subq_opt_away_processor (uchar *) |
Private Attributes | |
uint | m_ref_count {0} |
Number of references to this item. More... | |
bool | m_abandoned {false} |
true if item has been fully de-referenced More... | |
const bool | is_parser_item |
true if allocated directly by parser More... | |
uint8 | m_data_type |
Data type assigned to Item. More... | |
CostOfItem | m_cost |
The cost of evaluating this item. More... | |
bool | m_nullable |
True if this item may hold the NULL value(if null_value may be set to true). More... | |
Friends | |
class | udf_handler |
Base class that is used to represent any kind of expression in a relational query.
The class provides subclasses for simple components, like literal (constant) values, column references and variable references, as well as more complex expressions like comparison predicates, arithmetic and string functions, row objects, function references and subqueries.
The lifetime of an Item class object is often the same as a relational statement, which may be used for several executions, but in some cases it may also be generated for an optimized statement and thus be valid only for one execution.
For Item objects with longer lifespan than one execution, we must take special precautions when referencing objects with shorter lifespan. For example, TABLE and Field objects against most tables are valid only for one execution. For such objects, Item classes should rather reference Table_ref and Item_field objects instead of TABLE and Field, because these classes support dynamic rebinding of objects before each execution. See Item::bind_fields() which binds new objects per execution and Item::cleanup() that deletes references to such objects.
These mechanisms can also be used to handle other objects with shorter lifespan, such as function references and variable references.
|
private |
enum Item::Bool_test |
enum Item::cond_result |
enum Item::item_marker |
< Values for member 'marker'
enum Item::traverse_order |
enum Item::Type |
|
delete |
Item::Item | ( | ) |
Item constructor for general use.
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
|
explicit |
Parse-time context-independent constructor.
This constructor and caller constructors of child classes must not access/change thd->lex (including thd->lex->current_query_block(), 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.
|
overridedefault |
|
inlinevirtual |
Retrieve actual data type for an item.
Equal to data_type() for all items, except parameters.
Reimplemented in Item_param.
|
inlineprotected |
Add more accumulated properties to an Item.
|
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.
|
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.
|
inlinevirtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
void Item::aggregate_bit_properties | ( | Item ** | items, |
uint | nitems | ||
) |
Set data type and properties of a BIT column.
items | Items to aggregate bit properties from |
nitems | Number of items |
|
inlinevirtual |
Reimplemented in Item_ident, Item_func_any_value, Item_sum, and Item_func_grouping.
|
inlinevirtual |
Reimplemented in Item_ident, Item_func_any_value, Item_sum, and Item_func_grouping.
void Item::aggregate_decimal_properties | ( | Item ** | items, |
uint | nitems | ||
) |
Set data type, precision and scale of item of type decimal from list of items.
items | Argument array. |
nitems | Number of arguments in the array. |
void Item::aggregate_float_properties | ( | enum_field_types | type, |
Item ** | items, | ||
uint | nitems | ||
) |
Set max_length and decimals of function if function is floating point and result length/precision depends on argument ones.
type | The float type (float or double precision) |
items | Argument array. |
nitems | Number of arguments in the array. |
bool Item::aggregate_string_properties | ( | enum_field_types | type, |
const char * | name, | ||
Item ** | items, | ||
uint | nitems | ||
) |
Aggregate string properties (character set, collation and maximum length) for string function.
type | String data type |
name | Name of function |
items | Argument array. |
nitems | Number of arguments. |
void Item::aggregate_temporal_properties | ( | enum_field_types | type, |
Item ** | items, | ||
uint | nitems | ||
) |
Set data type and fractional seconds precision for temporal functions.
type | Temporal data type |
items | Argument array |
nitems | Number of arguments in the array. |
bool Item::aggregate_type | ( | const char * | name, |
Item ** | items, | ||
uint | count | ||
) |
Aggregates data types from array of items into current item.
name | name of function that performs type aggregation |
items | array of items to aggregate the type from |
count | number of items to aggregate |
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.
The function is used when resolving the result type of
NOTE: "this" may be part of "items" array, thus it is important that the type properties are not updated until after all items in the array have been processed.
|
inlinevirtual |
A helper function to ensure proper usage of CAST(.
. AS .. ARRAY)
Reimplemented in Item_func_array_cast.
|
inline |
See CompileItem.
|
inlinevirtual |
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the same.
This property is applied e.g to all conditions in WHERE, HAVING and ON clauses, and is recursively applied to operands of AND, OR operators. Some items (currently AND and subquery predicates) may enable special optimizations when they have this property.
Reimplemented in Item_func_truth, Item_bool_func2, Item_func_xor, Item_func_not_all, Item_func_opt_neg, Item_func_isnotnull, Item_cond, and Item_exists_subselect.
|
inlinevirtual |
Returns true if this is a simple constant item like an integer, not a constant expression.
Used in the optimizer to propagate basic constants. It is assumed that val_xxx() does not modify the item's state for such items. It is also assumed that val_str() can be called with nullptr as argument as val_str() will return an internally cached const string.
Reimplemented in Item_basic_constant, Item_ref, Item_cache, Item_func_bool_const, Item_date_literal, Item_time_literal, and Item_datetime_literal.
|
inlinevirtual |
Bind objects from the current execution context to field objects in item trees.
Typically used to bind Field objects from TABLEs to Item_field objects.
Reimplemented in Item_field, Item_default_value, Item_insert_value, and Item_trigger_field.
|
inlinevirtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
|
virtual |
Check if an item is a constant one and can be cached.
[out] | arg | If != NULL <=> Cache this item. |
Reimplemented in Item_name_const.
Cache item if needed.
arg | Descriptor of what and how to cache |
bool Item::can_be_substituted_for_gc | ( | bool | array = false | ) | const |
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.
array | true if the item is an argument to a function that takes an array, or false otherwise |
|
inlinevirtual |
Wrap incompatible arguments in CAST nodes to the expected data types.
Reimplemented in Item_func_comparison, and Item_multi_eq.
|
inlinevirtual |
Reimplemented in Item_field, Item_hex_string, Item_ref, Item_func_min_max, and Item_json_func.
|
inlinevirtual |
Reimplemented in Item_ident, Item_func_sp, and Item_func_group_concat.
|
inlinevirtual |
Reimplemented in Item_ident_for_show, Item_func_get_user_var, Item_temporal_func, Item_temporal_hybrid_func, and Item_field.
|
virtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
|
inlinevirtual |
Check if all the columns present in this expression are present in GROUP BY clause of the derived table.
Used in checking if a condition can be pushed down to derived table.
Reimplemented in Item_field, Item_ref, and Item_func.
|
inlinevirtual |
Check if all the columns present in this expression are present in PARTITION clause of window functions of the derived table.
Used in checking if a condition can be pushed down to derived table.
Reimplemented in Item_field, Item_ref, and Item_func.
|
inlinevirtual |
Check privileges.
thd | thread handle |
Reimplemented in Item_default_value, Item_field, Item_view_ref, and Item_trigger_field.
|
virtual |
Check if this item is allowed for a virtual column or inside a default expression.
Should be overridden in child classes.
[in,out] | args | Due 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. |
Reimplemented in Item_basic_constant, Item_int, Item_result_field, Item_func_additive_op, Item_func_mul, Item_func_div_int, Item_func_mod, Item_func_neg, Item_func_abs, Item_func_ceiling, Item_func_floor, Item_row, Item_xml_str_func, Item_field, Item_param, Item_static_string_func, Item_blob, Item_ref, Item_insert_value, Item_trigger_field, Item_cache, Item_aggregate_type, Item_subselect, Item_aggregate_field, Item_aggr_variance_field, Item_aggr_std_field, Item_func, Item_func_connection_id, Item_func_rand, Item_func_last_insert_id, Item_func_benchmark, Item_func_sleep, Item_udf_func, Item_func_get_lock, Item_func_release_lock, Item_func_release_all_locks, Item_source_pos_wait, Item_var_func, Item_func_match, Item_func_is_free_lock, Item_func_is_used_lock, Item_func_row_count, Item_func_sp, Item_func_found_rows, Item_func_uuid_short, Item_func_statement_digest, Item_func_statement_digest_text, Item_func_sysconst, Item_func_user, Item_load_file, Item_func_uuid, Item_func_curtime, Item_func_curdate, Item_func_now, Item_nodeset_func, Item_nodeset_to_const_comparator, Item_func_xml_update, and Item_func_unix_timestamp.
|
inlinevirtual |
Check if a generated expression depends on DEFAULT function with specific column name as argument.
[in] | args | Name of column used as DEFAULT function argument. |
Reimplemented in Item_default_value.
|
inlinevirtual |
Check if a partition function is allowed.
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_num, Item_field, Item_null, Item_int, Item_decimal, Item_string, Item_static_string_func, Item_hex_string, Item_func_additive_op, Item_func_mul, Item_func_div_int, Item_func_mod, Item_func_neg, Item_func_abs, Item_func_ceiling, Item_func_floor, Item_func_uuid_short, Item_func_to_days, Item_func_to_seconds, Item_func_dayofmonth, Item_func_month, Item_func_monthname, Item_func_dayofyear, Item_func_hour, Item_func_minute, Item_func_quarter, Item_func_second, Item_func_yearweek, Item_func_year, Item_func_weekday, Item_func_dayname, Item_func_unix_timestamp, Item_func_time_to_sec, Item_date_literal, Item_time_literal, Item_datetime_literal, Item_func_from_days, Item_extract, and Item_func_microsecond.
|
inlinevirtual |
Reimplemented in Item_func, Item_func_to_days, Item_func_to_seconds, Item_func_dayofmonth, Item_func_month, Item_func_monthname, Item_func_dayofyear, Item_func_hour, Item_func_minute, Item_func_quarter, Item_func_second, Item_func_yearweek, Item_func_year, Item_func_weekday, Item_func_unix_timestamp, Item_func_time_to_sec, Item_func_from_days, Item_extract, and Item_func_microsecond.
Verifies that the input string is well-formed according to its character set.
str | input string to verify |
send_error | If true, call my_error if string is not well-formed. |
truncate | If true, set to null/truncate if not well-formed. |
|
virtual |
Clean up after removing the item from the item tree.
param arg pointer to a Cleanup_after_removal_context object
Reimplemented in Item_ref, Item_subselect, and Item_sum.
|
inlinevirtual |
Called for every Item after use (preparation and execution).
Release all allocated resources, such as dynamic memory. Prepare for new execution by clearing cached values. Do not remove values allocated during preparation, destructor handles this.
Reimplemented in Item_basic_constant, Item_field, Item_result_field, Item_ref, Item_default_value, Item_insert_value, Item_trigger_field, Item_cache, Item_cache_row, Item_func_bool_const, Item_in_optimizer, Item_bool_func2, Item_func_in, Item_func_like, Item_func_rand, Item_udf_func, Item_func_set_user_var, Item_func_get_user_var, Item_func_get_system_var, Item_func_match, Item_func_sp, Item_json_func, Item_func_json_schema_valid, Item_func_json_schema_validation_report, Item_func_json_contains, Item_func_json_contains_path, Item_func_json_search, Item_func_array_cast, Item_func_regexp, Item_row, Item_func_user, Item_func_current_role, Item_func_roles_graphml, Item_subselect, Item_singlerow_subselect, Item_maxmin_subselect, Item_in_subselect, Item_sum, Item_sum_count, Item_sum_avg, Item_sum_variance, Item_sum_hybrid, Item_sum_bit, Item_udf_sum, Item_func_group_concat, Item_date_literal, Item_time_literal, Item_datetime_literal, Item_func_convert_tz, and Item_xml_str_func.
|
inline |
cleanup() item if it is resolved ('fixed').
|
inlinevirtual |
nullptr | if this is not const |
Reimplemented in Item_null, Item_param, Item_int, Item_temporal, Item_uint, Item_decimal, Item_float, Item_string, Item_hex_string, Item_int_with_ref, Item_datetime_with_ref, Item_time_with_ref, and Item_json.
|
inlinevirtual |
Reimplemented in Item_field, and Item_ref.
|
inlinevirtual |
Collects fields and view references that have the qualifying table in the specified query block.
Reimplemented in Item_sum, Item_field, Item_view_ref, Item_default_value, and Item_func_any_value.
|
inlinevirtual |
Reimplemented in Item_field.
|
inlinevirtual |
Reimplemented in Item_field.
|
inlinevirtual |
Reimplemented in Item_singlerow_subselect, and Item_sum.
|
inlinevirtual |
Reimplemented in Item_subselect.
|
inlinevirtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
|
inlinevirtual |
Reimplemented in Item_bool_func2, Item_func_between, Item_func_case, Item_func_in, Item_func_isnull, Item_func_isnotnull, Item_multi_eq, and Item_func_find_in_set.
|
inlinevirtual |
Perform a generic "compilation" of the Item tree, ie transform the Item tree by adding zero or more Item objects to it.
analyzer | Analyzer function, see details section | |
[in,out] | arg_p | Pointer to struct used by analyzer function |
transformer | Transformer function, see details section | |
[in,out] | arg_t | Pointer to struct used by transformer function |
The process of this transformation is assumed to be as follows:
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, Item_func, Item_row, and Item_in_subselect.
|
inlinevirtual |
Compute the cost of evaluating this Item.
root_cost | The cost object to which the cost should be added. |
Reimplemented in Item_field, Item_udf_func, and Item_func_sp.
|
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
|
inline |
Returns true if item is constant, regardless of query evaluation state.
An expression is constant if it:
Item * Item::convert_charset | ( | THD * | thd, |
const CHARSET_INFO * | tocs, | ||
bool | ignore_errors = false |
||
) |
Convert constant string in this object into the specified character set.
thd | thread handler |
tocs | target character set |
ignore_errors | if true, ignore errors in conversion |
Reimplemented in Item_cond_and, and Item_cond_or.
Reimplemented in Item_trigger_field, Item_sum_sum, Item_sum_count, Item_sum_json_array, Item_sum_json_object, Item_sum_avg, Item_sum_variance, Item_sum_std, Item_sum_hybrid, Item_sum_or, Item_sum_and, Item_sum_xor, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, and Item_sum_collect.
|
inline |
|
inlinevirtual |
Whether this Item was created by the IN->EXISTS subquery transformation.
Reimplemented in Item_ref, and Item_bool_func.
|
inline |
Retrieve the derived data type of the Item.
|
virtual |
DATETIME precision of the item: 0..6.
Reimplemented in Item_temporal_func.
|
inline |
|
virtual |
Reimplemented in Item_int, Item_uint, Item_decimal, Item_hex_string, Item_bool_func, Item_func_between, Item_func_interval, Item_func_nullif, and Item_func_in.
|
inline |
Decrement reference count.
|
static |
|
inlinevirtual |
Get the default data (output) type for the specific item.
Important for some SQL functions that may deliver multiple result types, and is used to determine data type for function's parameters that cannot be type-resolved by looking at the context. An example of such function is '+', which may return INT, DECIMAL, DOUBLE, depending on arguments. On the contrary, many other functions have a fixed output type, usually set with set_data_type_XXX(), which overrides the value of default_data_type(). For example, COS always returns DOUBLE,
Reimplemented in Item_func_coalesce, Item_func_if, Item_func_nullif, Item_func_case, Item_func_numhybrid, Item_func_div_int, Item_func_min_max, and Item_sum_num.
|
inline |
Delete this item.
Note that item must have been cleanup up by calling Item::cleanup().
|
inlinevirtual |
Reimplemented in Item_field.
|
inlineoverrideprivate |
|
protectedvirtual |
The core function that does the actual itemization.
itemize() is just a wrapper over this.
Reimplemented in Item_param, Item_name_const, Item_ident, Item_field, Item_asterisk, Item_default_value, Item_insert_value, Item_func_xor, Item_func_interval, Item_cond, Item_func, Item_func_connection_id, Item_func_rand, Item_func_last_insert_id, Item_func_benchmark, Item_func_sleep, Item_udf_func, Item_func_get_lock, Item_func_release_lock, Item_func_release_all_locks, Item_source_pos_wait, Item_func_match, Item_func_is_free_lock, Item_func_is_used_lock, Item_func_row_count, Item_func_sp, Item_func_found_rows, Item_func_uuid_short, Item_func_version, Item_func_geometry_from_text, Item_func_geometry_from_wkb, Item_wait_for_executed_gtid_set, Item_func_pfs_current_thread_id, Item_func_pfs_thread_id, Item_func_icu_version, Item_row, Item_func_aes_encrypt, Item_func_aes_decrypt, Item_func_random_bytes, Item_func_database, Item_func_user, Item_func_current_user, Item_load_file, Item_func_set_collation, Item_func_weight_string, Item_func_uuid, Item_in_subselect, Item_sum, Item_udf_sum, Item_func_group_concat, Item_func_week, Item_func_unix_timestamp, Item_func_curtime, Item_func_curdate, Item_func_now_utc, PTI_truth_transform, PTI_comp_op, PTI_comp_op_all, PTI_simple_ident_ident, PTI_simple_ident_q_3d, PTI_simple_ident_q_2d, PTI_simple_ident_nospvar_ident, PTI_function_call_nonkeyword_now, PTI_function_call_nonkeyword_sysdate, PTI_udf_expr, PTI_function_call_generic_ident_sys, PTI_function_call_generic_2d, PTI_text_literal_text_string, PTI_text_literal_nchar_string, PTI_text_literal_underscore_charset, PTI_text_literal_concat, PTI_temporal_literal, PTI_literal_underscore_charset_hex_num, PTI_literal_underscore_charset_bin_num, PTI_variable_aux_set_var, PTI_user_variable, PTI_get_system_variable, PTI_count_sym, PTI_in_sum_expr, PTI_singlerow_subselect, PTI_exists_subselect, PTI_odbc_date, PTI_handle_sql2003_note184_exception, PTI_expr_with_alias, PTI_int_splocal, PTI_limit_option_ident, PTI_limit_option_param_marker, and PTI_context.
|
inlinevirtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
|
virtual |
Compare this item with another item for equality.
If both pointers are the same, the items are equal. Both items must be of same type. For literal values, metadata must be the same and the values must be equal. Strings are compared with the embedded collation. For column references, table references and column names must be the same. For functions, the function type, function properties and arguments must be equal. Otherwise, see specific implementations.
This function is called when:
Reimplemented in Item_field, Item_null, Item_param, Item_int, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_view_ref, Item_default_value, Item_insert_value, Item_trigger_field, Item_cache, Item_values_column, Item_cond, Item_func, Item_func_json_extract, and Item_sum.
bool Item::eq_by_collation | ( | Item * | item, |
const CHARSET_INFO * | cs | ||
) |
Compare two items using a given collation.
item | item to compare with |
cs | collation to use when comparing strings |
This function works exactly as Item::eq() if the collation cs coincides with the collation of the compared objects. Otherwise, first the collations that differ from cs are replaced for cs and then the items are compared by Item::eq. After the comparison the original collations of items are restored.
For items that do not return strings, function behaves exactly like Item::eq.
|
inlinevirtual |
Reimplemented in Item_func_eq, Item_func_equal, Item_func_ge, Item_func_gt, Item_func_le, Item_func_lt, Item_func_ne, and Item_func_like.
Reimplemented in Item_field.
|
inlinevirtual |
Reimplemented in Item_func_eq, Item_cond, and Item_multi_eq.
Reimplemented in Item_func_eq, and Item_multi_eq.
|
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(); }
|
inlineprotected |
Get the value to return from get_date() in case of errors.
|
inline |
Get the value to return from val_decimal() in case of errors.
|
inlineprotected |
Get the value to return from val_int() in case of errors.
|
inline |
Get the value to return from val_json() in case of errors.
|
inlineprotected |
Get the value to return from val_real() in case of errors.
|
inline |
Get the value to return from val_str() in case of errors.
|
inlineprotected |
Get the value to return from get_time() in case of errors.
Evaluate scalar item, possibly using the supplied buffer.
thd | Thread context |
buffer | Buffer, in case item needs a large one |
|
inlinevirtual |
Reimplemented in Item_ref, and Item_subselect.
|
inlinevirtual |
Reimplemented in Item_field, Item_ref, and Item_func_set_collation.
|
inlinevirtual |
Is this an Item_field which references the given Field argument?
Reimplemented in Item_field.
|
inlinevirtual |
Reimplemented in Item_field.
|
inlinevirtual |
|
inlinevirtual |
Fix after tables have been moved from one query_block level to the parent level, e.g by semijoin conversion.
Basically re-calculate all attributes dependent on the tables.
parent_query_block | query_block that tables are moved to. |
removed_query_block | query_block that tables are moved away from, child of parent_query_block. |
Reimplemented in Item_ident, Item_field, Item_ref, Item_outer_ref, Item_cache, Item_in_optimizer, Item_func_trig_cond, Item_func_between, Item_func_if, Item_func_in, Item_cond, Item_func, Item_func_sp, Item_row, Item_subselect, Item_in_subselect, and Item_sum.
|
inline |
Reimplemented in Item_name_const, Item_field, Item_asterisk, Item_ref, Item_view_ref, Item_outer_ref, Item_default_value, Item_insert_value, Item_trigger_field, Item_func_bool_const, Item_in_optimizer, Item_func_between, Item_func_if, Item_func_in, Item_func_json_schema_valid, Item_func_json_schema_validation_report, Item_func_json_search, Item_sum_num, Item_sum_hybrid, Item_func_group_concat, Item_cond, Item_func, Item_func_geomfromgeojson, Item_sp_variable, Item_func_regexp, Item_func_regexp_instr, Item_non_framing_wf, Item_ntile, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_sum_json, Item_ident_for_show, Item_param, Item_func_trig_cond, Item_func_case, Item_func_isnull, Item_func_like, Item_multi_eq, Item_func_connection_id, Item_func_rand, Item_udf_func, Item_func_set_user_var, Item_user_var_as_out_param, Item_func_match, Item_func_sp, Item_func_as_geojson, Item_func_geohash, Item_func_latlongfromgeohash, Item_func_pointfromgeohash, Item_func_array_cast, Item_func_json_value, Item_func_pfs_current_thread_id, Item_row, Item_str_func, Item_func_make_set, Item_subselect, Item_singlerow_subselect, Item_exists_subselect, Item_sum, Item_sum_bit, Item_udf_sum, Item_func_grouping, and Item_sum_collect.
|
inline |
|
inlinevirtual |
Reimplemented in Item_ident.
|
inlinevirtual |
Analyzer function for GC substitution.
Reimplemented in Item_func_comparison, Item_func_equal, Item_func_ne, Item_func_between, Item_func_in, Item_cond_and, Item_cond_or, Item_func_json_contains, Item_func_json_overlaps, and Item_func_member_of.
|
inlinevirtual |
If this item represents a IN/ALL/ANY/comparison_operator subquery, return that (along with data on how it will be executed).
(These subqueries correspond to
outer_query_block | the Query_block to which 'this' belongs. |
Reimplemented in Item_singlerow_subselect, and Item_in_subselect.
|
pure virtual |
Implemented in Item_null, Item_temporal, Item_temporal_with_ref, Item_cache_row, Item_type_holder, Item_user_var_as_out_param, Item_func_array_cast, Item_row, Item_sum_collect, Item_aggregate_type, Item_func_json_value, Item_date_literal, Item_datetime_literal, Item_typecast_date, Item_func_makedate, Item_sp_variable, Item_name_const, Item_ident_for_show, Item_field, Item_int, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_ref_null_helper, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_datetime, Item_cache_json, Item_values_column, Item_func_if, Item_func_case, Item_real_func, Item_func_numhybrid, Item_int_func, Item_typecast_decimal, Item_typecast_real, Item_rollup_group_item, Item_func_bit, Item_func_udf_float, Item_func_udf_int, Item_func_udf_decimal, Item_func_udf_str, Item_var_func, Item_func_sp, Item_json_func, Item_func_regexp_instr, Item_func_regexp_like, Item_func_regexp_replace, Item_func_regexp_substr, Item_str_func, Item_singlerow_subselect, Item_exists_subselect, Item_sum_num, Item_sum_int, Item_aggr_numeric_field, Item_aggr_bit_field, Item_sum_json, Item_sum_hybrid, Item_sum_bit, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, Item_non_framing_wf, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_rollup_sum_switcher, Item_func_month, Item_func_weekday, Item_func_dayname, Item_timeval_func, Item_temporal_hybrid_func, Item_json, Item_func_sysdate_local, Item_func_from_days, Item_func_from_unixtime, Item_func_convert_tz, Item_typecast_datetime, Item_func_last_day, Item_func_internal_update_time, Item_func_internal_check_time, Item_date_func, Item_datetime_func, Item_time_func, Item_func_at_time_zone, Item_func_curdate, Item_func_now, and Item_param.
|
protected |
Convert val_decimal() to date in MYSQL_TIME.
|
protected |
Convert val_int() to date in MYSQL_TIME.
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!
|
protected |
Convert a numeric type to date.
|
protected |
Convert val_real() to date in MYSQL_TIME.
|
protected |
Convert val_str() to date in MYSQL_TIME.
|
protected |
Convert get_time() from time to date in MYSQL_TIME.
|
inlinevirtual |
Calculate the filter contribution that is relevant for table 'filter_for_table' for this item.
thd | Thread handler |
filter_for_table | The table we are calculating filter effect for |
read_tables | Tables 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_ignore | Fields 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_table | The number of rows in table 'filter_for_table' |
Reimplemented in Item_field, Item_func_comparison, Item_func_xor, Item_func_not, Item_func_match_predicate, Item_func_eq, Item_func_equal, Item_func_reject_if, Item_func_ne, Item_func_between, Item_func_in, Item_func_isnull, Item_func_isnotnull, Item_func_like, Item_multi_eq, Item_cond_and, Item_cond_or, and Item_func_match.
|
inlinevirtual |
Reimplemented in Item_field, Item_aggregate_type, Item_func_centroid, Item_func_convex_hull, Item_func_envelope, Item_func_make_envelope, Item_func_point, Item_func_pointfromgeohash, Item_typecast_point, Item_typecast_linestring, Item_typecast_polygon, Item_typecast_multipoint, Item_typecast_multilinestring, Item_typecast_multipolygon, Item_typecast_geometrycollection, and Item_typecast_geometry.
|
inlinevirtual |
Reimplemented in Item_field, Item_func_to_days, Item_func_to_seconds, Item_func_year, and Item_func_unix_timestamp.
|
inlinevirtual |
Reimplemented in Item_result_field, and Item_ref.
|
inlinevirtual |
Reimplemented in Item_splocal, Item_param, Item_trigger_field, and Item_func_get_user_var.
|
pure virtual |
Implemented in Item_null, Item_temporal, Item_temporal_with_ref, Item_cache_row, Item_type_holder, Item_user_var_as_out_param, Item_func_array_cast, Item_row, Item_sum_collect, Parse_tree_item, Item_aggregate_type, Item_sp_variable, Item_name_const, Item_ident_for_show, Item_field, Item_int, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_datetime, Item_cache_json, Item_values_column, Item_json, Item_func_if, Item_func_case, Item_real_func, Item_func_numhybrid, Item_int_func, Item_typecast_decimal, Item_typecast_real, Item_rollup_group_item, Item_func_bit, Item_func_udf_float, Item_func_udf_int, Item_func_udf_decimal, Item_func_udf_str, Item_var_func, Item_func_sp, Item_json_func, Item_func_json_value, Item_str_func, Item_singlerow_subselect, Item_exists_subselect, Item_sum_num, Item_sum_int, Item_aggr_numeric_field, Item_aggr_bit_field, Item_sum_json, Item_sum_hybrid, Item_sum_bit, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, Item_non_framing_wf, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_rollup_sum_switcher, Item_func_month, Item_func_weekday, Item_func_dayname, Item_timeval_func, Item_temporal_hybrid_func, Item_date_func, Item_datetime_func, Item_time_literal, Item_func_curtime, Item_func_sec_to_time, Item_typecast_time, Item_func_timediff, Item_func_maketime, Item_time_func, Item_func_regexp_instr, Item_func_regexp_like, Item_func_regexp_replace, Item_func_regexp_substr, and Item_param.
|
protected |
Convert date to time.
|
protected |
Convert datetime to time.
|
protected |
Convert val_decimal() to time in MYSQL_TIME.
|
protected |
Convert val_int() to time in MYSQL_TIME.
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!
|
protected |
Convert a numeric type to time.
|
protected |
Convert val_real() to time in MYSQL_TIME.
|
protected |
Convert val_str() to time in MYSQL_TIME.
|
virtual |
Get timestamp in "struct timeval" format.
If argument is NULL, sets null_value.
false | on success |
true | on 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.
|
inlinevirtual |
If this Item is being materialized into a temporary table, returns the field that is being materialized into.
(Typically, this is the “result_field” members for items that have one.)
Reimplemented in Item_field, Item_result_field, Item_ref, and Item_trigger_field.
If an Item is materialized in a temporary table, a different Item may have to be used in the part of the query that runs after the materialization.
For instance, if the Item was an Item_field, the new Item_field needs to point into the temporary table instead of the original one, but if, on the other hand, the Item was a literal constant, it can be reused as-is. This function encapsulates these policies for the different kinds of Items. See also get_tmp_table_field().
TODO: Document how aggregate functions (Item_sum) are handled.
Reimplemented in Item_field, Item_ref, Item_view_ref, Item_default_value, Item_trigger_field, Item_func, and Item_subselect.
|
inlinevirtual |
Get the typelib information for an item of type set or enum.
Reimplemented in Item_field, Item_ref, Item_func_coalesce, Item_func_if, Item_func_nullif, Item_func_case, Item_func_min_max, Item_rollup_group_item, Item_sum_hybrid, and Item_lead_lag.
|
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.
true | if this is an aggregate which is referenced from the GROUP BY clause of the aggregating query block |
false | otherwise |
Reimplemented in Item_sum.
|
inline |
|
inline |
Check whether this and the given item has compatible comparison context.
Used by the equality propagation. See Item_field::equal_fields_propagator.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Increment reference count.
|
inlinevirtual |
Reimplemented in Item_subselect.
void Item::init_make_field | ( | Send_field * | tmp_field, |
enum enum_field_types | type | ||
) |
|
inline |
Produces a key suitable for filesort.
Most of the time, val_int() would suffice, but for temporal values, the packed value (as sent to the handler) is called for. It is also necessary that the value is in UTC. This function supplies just that.
|
inlinevirtual |
Reimplemented in Item_func_to_seconds.
|
inline |
bool Item::is_blob_field | ( | ) | const |
Check if an item either is a blob field, or will be represented as a BLOB field if a field is created based on this item.
true | If a field based on this item will be a BLOB field, |
false | Otherwise. |
|
inlinevirtual |
Reimplemented in Item_bool_func, Item_func_between, Item_func_nullif, Item_func_in, Item_func_gtid_subset, Item_func_json_valid, Item_func_json_contains, Item_func_json_contains_path, Item_func_regexp_like, Item_exists_subselect, Item_bool, Item_xpath_cast_bool, and Item_nodeset_to_const_comparator.
|
inlinevirtual |
Reimplemented in Item_ident.
|
inlinevirtual |
|
inline |
|
inlinevirtual |
The method allows to determine nullness of a complex expression without fully evaluating it, instead of calling val*() then checking null_value.
Used in Item_func_isnull/Item_func_isnotnull and Item_sum_count/Item_sum_count_distinct. Any item which can be NULL must implement this method.
false | if the expression is not NULL. |
true | if the expression is NULL, or evaluation caused an error. The null_value member is set according to the return value. |
Reimplemented in Item_sp_variable, Item_name_const, Item_field, Item_null, Item_param, Item_ref, Item_view_ref, Item_cache, Item_values_column, Item_in_optimizer, Item_bool_func2, Item_func_comparison, Item_func_equal, Item_func_nullif, Item_func, Item_func_numhybrid, Item_func_spatial_mbr_rel, Item_func_spatial_relation, Item_row, Item_subselect, Item_sum, Item_aggr_numeric_field, and Item_rollup_sum_switcher.
|
inline |
|
inlinevirtual |
Reimplemented in Item_field, and Item_ref.
|
inline |
|
inlinevirtual |
Reimplemented in Item_result_field, and Item_ref.
|
inlinevirtual |
Reimplemented in Item_splocal.
|
inlinevirtual |
Reimplemented in Item_ident.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Check if all the columns present in this expression are from the derived table.
Used in determining if a condition can be pushed down to derived table.
Reimplemented in Item_sp_variable, Item_field, Item_param, Item_ref, Item_func_reject_if, Item_func, Item_func_get_system_var, and Item_trigger_field.
|
inlinefinalvirtual |
The same as 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.
Derived classes should not override this. If needed, they should override do_itemize().
pc | current parse context | |
[out] | res | pointer to "this" or to a newly allocated replacement object to use in the Item tree instead |
false | success |
true | syntax/OOM/etc error |
|
inlinevirtual |
Reimplemented in Item_ident.
|
inlineprotected |
Sets the result value of the function an empty string, using the current character set.
No memory is allocated.
A | pointer to the str_value member. |
|
virtual |
Reimplemented in Item_cache_row, Item_row, Item_sp_variable, Item_param, Item_empty_string, Item_ref, Item_aggregate_type, Item_ident_for_show, Item_field, Item_func_set_user_var, and Item_func_sp.
Create a field to hold a string value from an item.
If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob
If max_length > 0 create a varchar
If max_length == 0 create a CHAR(0)
table | Table for which the field is created |
Reimplemented in Item_func_group_concat.
|
inlinestaticprotected |
Helper function for mark_field_in_map(uchar *arg).
mark_field | Mark_field object |
field | Field to be marked for read/write |
|
inlinevirtual |
Mark underlying field in read or write map of a table.
arg | Mark_field object |
Reimplemented in Item_field, Item_result_field, Item_view_ref, and Item_aggregate_field.
|
inlinevirtual |
For Items with data type JSON, mark that a string argument is treated as a scalar JSON value.
Only relevant for the Item_param class.
Reimplemented in Item_param.
|
inline |
|
inline |
|
inline |
bool Item::may_eval_const_item | ( | const THD * | thd | ) | const |
bool Item::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.
This function should be used in the following circumstances:
This function should not be used by code that is called during optimization and/or execution only. Use const_for_execution() in this case.
|
inlinevirtual |
Reimplemented in Item_singlerow_subselect, Item_sum, Item_sum_sum, Item_sum_count, Item_sum_variance, Item_sum_hybrid, and Item_func_group_concat.
|
inlinevirtual |
Return table map of tables that can't be NULL tables (tables that are used in a context where if they would contain a NULL row generated by a LEFT or RIGHT join, the item would not be true).
This expression is used on WHERE item to determinate if a LEFT JOIN can be converted to a normal join. Generally this function should return used_tables() if the function would return null if any of the arguments are null As this is only used in the beginning of optimization, the value don't have to be updated in update_used_tables()
Reimplemented in Item_ref, Item_outer_ref, Item_func_not_all, Item_func_nop_all, Item_func, Item_row, Item_subselect, Item_sum, Item_date_literal, Item_time_literal, and Item_datetime_literal.
|
inlinevirtual |
Called when an item has been removed, can be used to notify external objects about the removal, e.g subquery predicates that are part of the sj_candidates container.
Reimplemented in Item_exists_subselect.
|
inlinevirtual |
Reimplemented in Item_ref, Item_cache_row, Item_row, and Item_singlerow_subselect.
|
inlineprotected |
Gets the value to return from val_str() when returning a NULL value.
|
inlinevirtual |
Result type when an item appear in a numeric context.
See Field::numeric_context_result_type() for more comments.
Reimplemented in Item_field, and Item_hex_string.
|
inlinestaticnoexcept |
|
inlinestatic |
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
delete |
|
inlinevirtual |
Pin the data type for the item.
Non-empty implementation only for dynamic parameters.
Reimplemented in Item_param.
|
inlinevirtual |
This method is used for to:
For more information about view definition query, INFORMATION_SCHEMA query and why they should be generated from the Item-tree,
Reimplemented in Item_null, Item_func_pi, Item_static_string_func, Item_json, Item_func_true, Item_func_false, Item_aggregate_ref, Item_splocal, Item_case_expr, Item_name_const, Item_ident, Item_field, Item_param, Item_int, Item_uint, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_ref_null_helper, Item_temporal_with_ref, Item_default_value, Item_insert_value, Item_trigger_field, Item_cache, Item_func_truth, Item_in_optimizer, Item_bool_func2, Item_func_not, Item_func_match_predicate, Item_func_trig_cond, Item_func_not_all, Item_func_between, Item_func_strcmp, Item_func_interval, Item_func_nullif, Item_func_case, Item_func_in, Item_func_isnull, Item_is_not_null_test, Item_func_isnotnull, Item_func_like, Item_cond, Item_multi_eq, Item_func, Item_num_op, Item_typecast_signed, Item_typecast_unsigned, Item_typecast_decimal, Item_typecast_real, Item_rollup_group_item, Item_func_locate, Item_func_bit, Item_func_bit_neg, Item_func_benchmark, Item_udf_func, Item_func_set_user_var, Item_func_get_user_var, Item_user_var_as_out_param, Item_func_get_system_var, Item_func_match, Item_func_spatial_mbr_rel, Item_func_spatial_relation, Item_typecast_point, Item_typecast_linestring, Item_typecast_polygon, Item_typecast_multipoint, Item_typecast_multilinestring, Item_typecast_multipolygon, Item_typecast_geometrycollection, Item_typecast_json, Item_func_array_cast, Item_func_member_of, Item_func_json_value, Item_row, Item_func_trim, Item_func_make_set, Item_func_format, Item_typecast_char, Item_func_conv_charset, Item_func_set_collation, Item_func_weight_string, Item_subselect, Item_maxmin_subselect, Item_exists_subselect, Item_in_subselect, Item_allany_subselect, Item_sum, Item_udf_sum, Item_func_group_concat, Item_rollup_sum_switcher, Item_typecast_year, Item_temporal_func, Item_date_literal, Item_time_literal, Item_datetime_literal, Item_func_at_time_zone, Item_date_add_interval, Item_extract, Item_typecast_date, Item_typecast_time, Item_typecast_datetime, Item_func_add_time, Item_func_timestamp_diff, Item_func_get_format, and Item_typecast_geometry.
void Item::print_for_order | ( | const THD * | thd, |
String * | str, | ||
enum_query_type | query_type, | ||
const char * | used_alias | ||
) | const |
Prints the item when it's part of ORDER BY and GROUP BY.
thd | Thread handle |
str | String to print to |
query_type | How to format the item |
used_alias | The alias with which this item was referenced, or nullptr if it was not referenced with an 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.
void Item::print_item_w_name | ( | const THD * | thd, |
String * | str, | ||
enum_query_type | query_type | ||
) | const |
|
inlinevirtual |
Propagate data type specifications into parameters and user variables.
If item has descendants, propagate type recursively into these.
thd | thread handler |
type | Data type properties that are propagated |
Reimplemented in Item_param, Item_func, Item_func_get_user_var, and Item_row.
|
inline |
Wrapper for easier calling of propagate_type(const Type_properties &).
thd | thread handler |
def | type to make Type_properties object |
pin | if true: also mark the type as pinned |
inherit | if true: also mark the type as inherited |
|
inline |
|
inlinevirtual |
Reimplemented in Item_ref, and Item_int_with_ref.
|
inlinevirtual |
Reimplemented in Item_ref, and Item_int_with_ref.
|
inline |
|
inlinevirtual |
Visitor interface for removing all column expressions (Item_field) in this expression tree from a bitmap.
arg | A MY_BITMAP* cast to unsigned char*, where the bits represent Field::field_index values. |
Reimplemented in Item_field.
void Item::rename | ( | char * | new_name | ) |
rename item (used for views, cleanup() return original name).
new_name | new name of item; |
Reimplemented in Item_field, and Item_func.
|
inlinevirtual |
Reimplemented in Item_func.
|
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.
Transform processor used by Query_block::transform_grouped_to_derived to replace fields which used to be at the transformed query block with corresponding fields in the new derived table containing the grouping operation of the original transformed query block.
Reimplemented in Item_field, Item_default_value, and Item_subselect.
Reimplemented in Item_view_ref, and Item_subselect.
Reimplemented in Item_outer_ref.
When walking the item tree seeing an Item_singlerow_subselect matching a target, replace it with a substitute field used when transforming scalar subqueries into derived tables.
Cf. Query_block::transform_scalar_subqueries_to_join_with_derived.
Reimplemented in Item_bool_func2, Item_func_like, and Item_singlerow_subselect.
Assuming this expression is part of a condition that would be pushed to a materialized derived table, replace, in this expression, each view reference with a clone of the expression in merged derived table's definition.
We replace with a clone, because the referenced item in a view reference is shared by all the view references to that expression.
Reimplemented in Item_view_ref.
Assuming this expression is part of a condition that would be pushed to the WHERE clause of a materialized derived table, replace, in this expression, each derived table's column with a clone of the expression lying under it in the derived table's definition.
We replace with a clone, because the condition can be pushed further down in case of nested derived tables.
Reimplemented in Item_field.
Assuming this expression is part of a condition that would be pushed to the HAVING clause of a materialized derived table, replace, in this expression, each derived table's column with a reference to the expression lying under it in the derived table's definition.
Unlike replace_with_derived_expr, a clone is not used because HAVING condition will not be pushed further down in case of nested derived tables.
Reimplemented in Item_field.
|
inlinevirtual |
This function applies only to Item_field objects referred to by an Item_ref object that has been marked as a const_item.
arg | Keep track of whether an Item_ref refers to an Item_field. |
Reimplemented in Item_field, and Item_ref.
|
inline |
Reset the "has aggregation" property.
|
inlinevirtual |
Reset execution state for such window function types as determined by arg.
arg | pointing to a bool which, if true, says to reset state for framing window function, else for non-framing |
Reimplemented in Item_sum.
|
inlinestatic |
|
inlinevirtual |
Reimplemented in Item_splocal, Item_case_expr, Item_name_const, Item_field, Item_null, Item_param, Item_int, Item_decimal, Item_string, Item_hex_string, Item_ref, Item_cache, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_row, Item_cache_datetime, Item_cache_json, Item_aggregate_type, Item_json, Item_func_coalesce, Item_func_if, Item_func_nullif, Item_func_case, Item_real_func, Item_func_numhybrid, Item_int_func, Item_typecast_decimal, Item_typecast_real, Item_func_min_max, Item_rollup_group_item, Item_func_bit, Item_udf_func, Item_func_udf_int, Item_func_udf_decimal, Item_func_udf_str, Item_func_set_user_var, Item_func_get_user_var, Item_func_get_system_var, Item_func_sp, Item_json_func, Item_func_array_cast, Item_func_json_value, Item_func_regexp_instr, Item_func_regexp_like, Item_func_regexp_replace, Item_func_regexp_substr, Item_row, Item_str_func, Item_singlerow_subselect, Item_exists_subselect, Item_sum_int, Item_sum_sum, Item_aggregate_field, Item_sum_json, Item_sum_variance, Item_aggr_std_field, Item_sum_std, Item_sum_hybrid, Item_sum_bit, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, Item_row_number, Item_rank, Item_cume_dist, Item_percent_rank, Item_ntile, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_rollup_sum_switcher, Item_sum_collect, Item_func_month, Item_func_weekday, Item_func_dayname, Item_timeval_func, Item_temporal_func, Item_temporal_hybrid_func, and Item_nodeset_func.
|
inlinevirtual |
Whether the item returns array of its data type.
Reimplemented in Item_field, and Item_func_array_cast.
type_conversion_status Item::save_date_in_field | ( | Field * | 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().
[in,out] | field | the field to save the item into |
no_conversions | whether or not to allow conversions of the value |
TYPE_OK | item saved without any errors or warnings |
!= | TYPE_OK there were errors or warnings when saving the item |
|
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().
[in,out] | field | the field to save the item into |
no_conversions | whether or not to allow conversions of the value |
TYPE_OK | item saved without any errors or warnings |
!= | TYPE_OK there were errors or warnings when saving the item |
Reimplemented in Item_sp_variable, Item_name_const, Item_field, Item_null, Item_param, Item_int, Item_temporal, Item_uint, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_view_ref, Item_int_with_ref, Item_default_value, Item_cache_str, Item_values_column, Item_func_set_user_var, Item_func_array_cast, Item_temporal_hybrid_func, Item_func_user, Item_func_current_user, Item_date_func, Item_datetime_func, Item_time_func, Item_insert_value, and Item_func_now.
|
inline |
A slightly faster value of save_in_field() that returns no error value (you will need to check thd->is_error() yourself), and does not support saving into hidden fields for functional indexes.
Used by copy_funcs(), to avoid the functional call overhead and RAII setup of save_in_field().
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.
field | field to save the item into |
no_conversions | whether or not to allow conversions of the value |
TYPE_OK | item saved without any issues |
!= | TYPE_OK there were issues saving the item |
|
inlinevirtual |
Reimplemented in Item_field, and Item_func_set_user_var.
type_conversion_status Item::save_str_value_in_field | ( | Field * | field, |
String * | result | ||
) |
type_conversion_status Item::save_time_in_field | ( | Field * | field | ) |
This is only called from items that is not of type item_field.
Reimplemented in Item_ref, Item_view_ref, Item_sp_variable, Item_null, Item_field, and Item_func_set_user_var.
|
inlineprotected |
Set accumulated properties for an Item.
|
inline |
Set the "has aggregation" property.
|
inlinevirtual |
Reimplemented in Item_field.
|
inline |
Set the data type of the current Item.
It is however recommended to use one of the type-specific setters if possible.
data_type | The data type of this Item. |
|
inline |
Set the data type of the Item to be bit.
max_bits | Maximum number of bits to store in this field. |
|
inline |
Set the Item to be of BLOB type.
type | Actual blob data type |
max_l | Maximum number of characters in data type |
|
inline |
|
inline |
Set the Item to be fixed length string.
Collation must have been set before calling function.
max_l | Number of characters in string |
|
inline |
Set the Item to be fixed length string.
Like function above, but will also set character set and collation.
max_l | Maximum number of characters in string |
cs | Pointer to character set and collation struct |
|
inline |
Set all type properties for Item of DATE type.
|
inline |
Set all properties for Item of DATETIME type.
fsp | Fractional seconds precision |
Set the data type of the Item to be decimal.
The unsigned property must have been set before calling this function.
precision | Number of digits of precision |
scale | Number of digits after decimal point. |
|
inline |
Set the data type of the Item to be double precision floating point.
|
inline |
Set the data type of the Item to be single precision floating point.
|
inline |
Set data type properties of the item from the properties of another item.
item | Item to set data type properties from. |
|
inline |
Set the data type of the Item to be GEOMETRY.
|
inlinevirtual |
Set data type for item as inherited.
Non-empty implementation only for dynamic parameters.
Reimplemented in Item_param.
|
inline |
Set the data type of the Item to be a specific integer type.
type | Integer type |
unsigned_prop | Whether the integer is signed or not |
max_width | Maximum width of field in number of digits |
|
inline |
Set the data type of the Item to be JSON.
|
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.
|
inline |
|
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.
max_l | Maximum number of characters in string |
|
inline |
Set the Item to be variable length string.
Like function above, but will also set character set and collation.
max_l | Maximum number of characters in string |
cs | Pointer to character set and collation struct |
|
inline |
Set the Item to be variable length string.
Like function above, but will also set full collation information.
max_l | Maximum number of characters in string |
coll | Ref to collation data, including derivation and repertoire |
|
inline |
Set the Item to be variable length string.
Like function above, but with larger string length precision.
max_char_length_arg | Maximum number of characters in string |
|
inline |
Set all type properties for Item of TIME type.
fsp | Fractional seconds precision |
|
inline |
Set all properties for Item of TIMESTAMP type.
fsp | Fractional seconds precision |
|
inline |
Set the data type of the Item to be VECTOR.
|
inline |
Set the data type of the Item to be YEAR.
|
inline |
Set the property: this item (tree) contains a reference to a GROUP BY modifier (such as ROLLUP)
|
inline |
Set the property: this item is a call to GROUPING.
|
inline |
|
inlinevirtual |
Reimplemented in Item_result_field, Item_ref, and Item_field.
|
inlineprotected |
Set the "has stored program" property.
|
inlineprotected |
Set the "has subquery" property.
|
inline |
Set the "has window function" property.
|
inlineprotected |
Helper function to skip itemize() for grammar-allocated items.
[out] | res | pointer to "this" |
true | can skip itemize() |
false | can't skip: the item is allocated directly by the parser |
|
inlinevirtual |
Reimplemented in Item_in_optimizer, Item_cond, Item_func, Item_row, Item_sum, Item_sum_hybrid, Item_lead_lag, Item_first_last_value, and Item_nth_value.
bool Item::split_sum_func2 | ( | THD * | thd, |
Ref_item_array | ref_item_array, | ||
mem_root_deque< Item * > * | fields, | ||
Item ** | ref, | ||
bool | skip_registered | ||
) |
The general goal of this is to get a list of set functions (aggregate functions and the GROUPING function), and window functions, and their arguments, so that the code which manages internal tmp tables (creation, row copying) has a list of all such functions (which require special handling) and a list of their arguments (which must be carried from tmp table to tmp table until the function can be computed).
thd | Current session |
ref_item_array | Pointer to array of reference fields |
fields | All fields of the current query block |
ref | Pointer to item. If nullptr, get it from Item_sum::referenced_by[]. |
skip_registered | <=> if aggregate function, item can be skipped. |
A set function item is added at the start of the fields list and then the original use is replaced with a reference.
The logic of skip_registered is:
Examples of 1):
(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 an aggregate function), so the resolver (generally, Query_block::prepare()) calls Item::split_sum_func2 on the '+'; as this '+' is neither a WF nor an aggregate function, but contains some, it calls Item_func::split_sum_func which calls Item::split_sum_func2 on every argument of the '+':
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'.
Examples of 2):
SELECT LAST_VALUE((SELECT upper.j FROM t1 LIMIT 1)) OVER (ORDER BY i) FROM t1 AS upper;
|
inlinestatic |
Determine correct string field type, based on string length.
max_bytes | Maximum string size, in number of bytes |
|
inlinevirtual |
Reimplemented in Item_field.
|
inlineprivatevirtual |
Reimplemented in Item_subselect.
|
inlinevirtual |
Reimplemented in Item_view_ref, Item_func_comparison, Item_func_opt_neg, Item_cond, and Item_field.
|
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 column
col`.
field | the JSON column that is being updated |
Reimplemented in Item_json_func.
|
inline |
Similar to result_type() but makes DATE, DATETIME, TIMESTAMP pretend to be numbers rather than strings.
|
inlinevirtual |
Reimplemented in Item_splocal, and Item_case_expr.
|
inlinevirtual |
Reimplemented in Item_splocal, and Item_case_expr.
Reimplemented in Item_splocal, and Item_case_expr.
|
virtual |
TIME precision of the item: 0..6.
Reimplemented in Item_temporal_func.
Reimplemented in Item_field, Item_result_field, Item_func, Item_func_sp, Item_geometry_func, Item_func_ifnull, Item_func_array_cast, Item_temporal_func, and Item_temporal_hybrid_func.
Create a field based on field_type of argument.
For now, this is only used to create a field for IFNULL(x,something) and time functions
NULL | error |
|
virtual |
Perform a generic transformation of the Item tree, by adding zero or more additional Item objects to it.
transformer | Transformer function | |
[in,out] | arg | Pointer to struct used by transformer function |
Transformation is performed as follows:
Note that unlike Item::compile(), transform() does not support an analyzer function, ie. all children are unconditionally invoked.
Item::transform() should handle all transformations during preparation. Notice that all transformations are permanent; they are not rolled back.
Use Item::compile() to perform transformations during optimization.
Reimplemented in Item_cond, Item_func, Item_row, Item_in_subselect, Item_default_value, and Item_ref.
|
inlinevirtual |
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implement this test by itself.
thd | Thread handle |
test | Truth test |
Reimplemented in Item_func_truth, Item_func_opt_neg, Item_func_isnull, Item_func_isnotnull, Item_func_comparison, Item_func_xor, Item_func_not, Item_func_not_all, Item_func_nop_all, Item_func_equal, Item_cond_and, Item_cond_or, and Item_exists_subselect.
|
pure virtual |
Implemented in Item_splocal, Item_case_expr, Item_name_const, Item_ident_for_show, Item_field, Item_null, Item_param, Item_int, Item_decimal, Item_float, Item_string, Item_blob, Item_hex_string, Item_ref, Item_default_value, Item_insert_value, Item_trigger_field, Item_cache, Item_type_holder, Item_values_column, Item_json, Item_cond, Item_func, Item_user_var_as_out_param, Item_row, Item_subselect, Item_sum, Item_aggr_avg_field, Item_aggr_bit_field, Item_aggr_variance_field, Item_aggr_std_field, Item_nodeset_func, and Parse_tree_item.
|
inlinestatic |
Provide data type for a user or system variable, based on the type of the item that is assigned to the variable.
src_type | Source type that variable's type is derived from |
|
inlinestatic |
const Item * Item::unwrap_for_eq | ( | ) | const |
Unwrap an Item argument so that Item::eq() can see the "real" item, and not just the wrapper.
It unwraps Item_ref using real_item(), and also cache items and rollup group wrappers, since these may not have been added consistently to both sides compared by Item::eq().
|
inlinevirtual |
A walker processor overridden by Item_aggregate_ref, q.v.
Reimplemented in Item_aggregate_ref.
|
inlinevirtual |
Reimplemented in Item_ident.
bool Item::update_null_value | ( | ) |
Make sure the null_value member has a correct value.
null_value is set true also when evaluation causes error.
|
inlinevirtual |
Updates used tables, not null tables information and accumulates properties up the item tree, cf.
used_tables_cache, not_null_tables_cache and m_accum_properties.
TODO(sgunders): Consider just removing these caches; it causes a lot of bugs (cache invalidation is known to be a complex problem), and the performance benefits are dubious.
Reimplemented in Item_func_modify_json_in_path, Item_ref, Item_in_optimizer, Item_func_trig_cond, Item_func_between, Item_func_interval, Item_func_if, Item_func_in, Item_func_isnull, Item_is_not_null_test, Item_cond, Item_multi_eq, Item_func, Item_rollup_group_item, Item_func_get_user_var, Item_func_match, Item_func_sp, Item_row, Item_subselect, Item_in_subselect, Item_sum, and Item_func_grouping.
Reimplemented in Item_field.
|
inlinevirtual |
Reimplemented in Item_basic_constant, Item_sp_variable, Item_field, Item_param, Item_result_field, Item_ref, Item_view_ref, Item_outer_ref, Item_ref_null_helper, Item_default_value, Item_insert_value, Item_trigger_field, Item_cache, Item_type_holder, Item_values_column, Item_cond, Item_func, Item_rollup_group_item, Item_row, Item_subselect, Item_sum, Item_rollup_sum_switcher, Item_date_literal, Item_time_literal, and Item_datetime_literal.
|
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
[in,out] | arg | pointer 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. |
Reimplemented in Item_field.
|
virtual |
|
virtual |
Return date value of item in packed longlong format.
Reimplemented in Item_field, Item_null, Item_temporal, Item_ref, Item_ref_null_helper, Item_datetime_with_ref, Item_time_with_ref, Item_cache_int, Item_cache_datetime, Item_sum_hybrid, Item_date_func, Item_datetime_func, Item_date_literal, Item_datetime_literal, Item_func_curdate, and Item_func_now.
|
inlineprotectedvirtual |
Reimplemented in Item_field.
|
pure virtual |
Implemented in Item_name_const, Item_field, Item_null, Item_param, Item_int, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_ref_null_helper, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_row, Item_cache_datetime, Item_type_holder, Item_values_column, Item_func_if, Item_func_nullif, Item_func_case, Item_func, Item_func_numhybrid, Item_typecast_decimal, Item_func_min_max, Item_func_udf_decimal, Item_func_set_user_var, Item_func_get_user_var, Item_func_array_cast, Item_row, Item_str_func, Item_singlerow_subselect, Item_exists_subselect, Item_in_subselect, Item_sum_num, Item_sum_int, Item_sum_sum, Item_aggr_avg_field, Item_aggr_bit_field, Item_sum_avg, Item_sum_variance, Item_aggr_std_field, Item_sum_hybrid, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_decimal, Parse_tree_item, Item_aggregate_type, Item_json, Item_row_number, Item_rank, Item_ntile, Item_cume_dist, Item_percent_rank, Item_ident_for_show, Item_view_ref, Item_rollup_group_item, Item_sum_udf_str, Item_rollup_sum_switcher, Item_func_udf_float, Item_func_udf_str, Item_func_get_system_var, Item_func_sp, Item_aggr_variance_field, Item_user_var_as_out_param, Item_sum_json, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_sum_collect, Item_sp_variable, Item_real_func, Item_typecast_real, Item_func_bit, Item_json_func, Item_sum_bit, Item_func_group_concat, Item_timeval_func, Item_temporal_hybrid_func, Item_date_func, Item_datetime_func, Item_time_func, Item_cache_json, and Item_func_json_value.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
pure virtual |
Implemented in Item_sp_variable, Item_name_const, Item_ident_for_show, Item_field, Item_null, Item_param, Item_int, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_view_ref, Item_ref_null_helper, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_row, Item_cache_datetime, Item_cache_json, Item_type_holder, Item_values_column, Item_json, Item_func_true, Item_func_false, Item_func_truth, Item_in_optimizer, Item_func_xor, Item_func_not, Item_func_match_predicate, Item_func_trig_cond, Item_func_not_all, Item_func_nop_all, Item_func_eq, Item_func_equal, Item_func_ge, Item_func_gt, Item_func_le, Item_func_reject_if, Item_func_lt, Item_func_ne, Item_func_between, Item_func_strcmp, Item_func_interval, Item_func_if, Item_func_nullif, Item_func_case, Item_func_in, Item_func_isnull, Item_is_not_null_test, Item_func_isnotnull, Item_func_like, Item_multi_eq, Item_cond_and, Item_cond_or, Item_real_func, Item_func_numhybrid, Item_func_connection_id, Item_typecast_signed, Item_typecast_unsigned, Item_typecast_decimal, Item_typecast_real, Item_func_sign, Item_func_min_max, Item_rollup_group_item, Item_func_length, Item_func_vector_dim, Item_func_bit_length, Item_func_char_length, Item_func_coercibility, Item_func_locate, Item_func_validate_password_strength, Item_func_field, Item_func_ascii, Item_func_ord, Item_func_find_in_set, Item_func_bit, Item_func_bit_count, Item_func_last_insert_id, Item_func_benchmark, Item_func_sleep, Item_func_udf_float, Item_func_udf_int, Item_func_udf_decimal, Item_func_udf_str, Item_func_get_lock, Item_func_release_lock, Item_func_release_all_locks, Item_source_pos_wait, Item_master_pos_wait, Item_func_can_access_database, Item_func_can_access_table, Item_func_can_access_user, Item_func_can_access_trigger, Item_func_can_access_routine, Item_func_can_access_event, Item_func_can_access_resource_group, Item_func_can_access_view, Item_func_can_access_column, Item_func_is_visible_dd_object, Item_func_internal_table_rows, Item_func_internal_avg_row_length, Item_func_internal_data_length, Item_func_internal_max_data_length, Item_func_internal_index_length, Item_func_internal_data_free, Item_func_internal_auto_increment, Item_func_internal_checksum, Item_func_internal_keys_disabled, Item_func_internal_index_column_cardinality, Item_func_internal_dd_char_length, Item_func_internal_get_view_warning_or_error, Item_func_get_dd_index_sub_part_length, Item_func_internal_tablespace_id, Item_func_internal_tablespace_logfile_group_number, Item_func_internal_tablespace_free_extents, Item_func_internal_tablespace_total_extents, Item_func_internal_tablespace_extent_size, Item_func_internal_tablespace_initial_size, Item_func_internal_tablespace_maximum_size, Item_func_internal_tablespace_autoextend_size, Item_func_internal_tablespace_version, Item_func_internal_tablespace_data_free, Item_func_set_user_var, Item_func_get_user_var, Item_user_var_as_out_param, Item_func_get_system_var, Item_func_match, Item_func_is_free_lock, Item_func_is_used_lock, Item_func_row_count, Item_func_sp, Item_func_found_rows, Item_func_uuid_short, Item_func_internal_is_mandatory_role, Item_func_internal_use_terminology_previous, Item_func_internal_is_enabled_role, Item_func_spatial_mbr_rel, Item_func_spatial_relation, Item_func_isempty, Item_func_st_issimple, Item_func_isclosed, Item_func_isvalid, Item_func_dimension, Item_func_numgeometries, Item_func_numinteriorring, Item_func_numpoints, Item_func_st_srid_observer, Item_wait_for_executed_gtid_set, Item_func_gtid_subset, Item_func_inet_aton, Item_func_inet_bool_base, Item_json_func, Item_func_json_valid, Item_func_json_schema_valid, Item_func_json_contains, Item_func_json_contains_path, Item_func_json_length, Item_func_json_depth, Item_func_json_storage_size, Item_func_json_storage_free, Item_func_array_cast, Item_func_json_overlaps, Item_func_member_of, Item_func_json_value, Item_func_pfs_current_thread_id, Item_func_pfs_thread_id, Item_func_regexp_instr, Item_func_regexp_like, Item_func_regexp_replace, Item_func_regexp_substr, Item_row, Item_str_func, Item_func_elt, Item_func_is_uuid, Item_func_crc32, Item_func_uncompressed_length, Item_singlerow_subselect, Item_exists_subselect, Item_in_subselect, Item_sum_num, Item_sum_sum, Item_sum_count, Item_aggr_numeric_field, Item_aggr_bit_field, Item_sum_json, Item_sum_avg, Item_sum_hybrid, Item_sum_bit, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, Item_row_number, Item_rank, Item_cume_dist, Item_percent_rank, Item_ntile, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_func_grouping, Item_rollup_sum_switcher, Item_sum_collect, Item_func_period_add, Item_func_period_diff, Item_func_to_days, Item_func_to_seconds, Item_func_dayofmonth, Item_func_month, Item_func_dayofyear, Item_func_hour, Item_func_minute, Item_func_quarter, Item_func_second, Item_func_week, Item_func_yearweek, Item_func_year, Item_typecast_year, Item_func_weekday, Item_timeval_func, Item_func_time_to_sec, Item_temporal_hybrid_func, Item_date_func, Item_datetime_func, Item_time_func, Item_extract, Item_func_microsecond, Item_func_timestamp_diff, Item_xpath_cast_bool, Item_func_xpath_position, Item_func_xpath_count, Item_nodeset_to_const_comparator, Parse_tree_item, and Item_aggregate_type.
|
inlinevirtual |
Reimplemented in Item_field, Item_func_to_days, Item_func_to_seconds, Item_func_year, and Item_func_unix_timestamp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
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().
[in,out] | result | The resulting Json_wrapper. |
Reimplemented in Item_sp_variable, Item_splocal, Item_field, Item_param, Item_ref, Item_values_column, Item_json, Item_func_ifnull, Item_rollup_group_item, Item_func_sp, Item_singlerow_subselect, Item_rollup_sum_switcher, Item_null, Item_view_ref, Item_cache_json, Item_func_coalesce, Item_func_if, Item_func_nullif, Item_func_case, Item_func_as_geojson, Item_func_json_schema_validation_report, Item_typecast_json, Item_func_json_keys, Item_func_json_extract, Item_func_json_array_append, Item_func_json_insert, Item_func_json_array_insert, Item_func_json_set_replace, Item_func_json_array, Item_func_json_row_object, Item_func_json_search, Item_func_json_remove, Item_func_json_merge_preserve, Item_func_json_merge_patch, Item_func_array_cast, Item_func_json_value, Item_sum_json, Item_sum_hybrid, Item_lead_lag, Item_first_last_value, and Item_nth_value.
|
pure virtual |
Implemented in Item_sp_variable, Item_name_const, Item_ident_for_show, Item_field, Item_null, Item_param, Item_int, Item_uint, Item_decimal, Item_float, Item_string, Item_hex_string, Item_ref, Item_view_ref, Item_ref_null_helper, Item_cache_int, Item_cache_real, Item_cache_decimal, Item_cache_str, Item_cache_row, Item_cache_datetime, Item_cache_json, Item_type_holder, Item_values_column, Item_json, Item_func_if, Item_func_nullif, Item_func_case, Item_func_numhybrid, Item_int_func, Item_typecast_decimal, Item_typecast_real, Item_func_exp, Item_func_ln, Item_func_log, Item_func_log2, Item_func_log10, Item_func_sqrt, Item_func_pow, Item_func_acos, Item_func_asin, Item_func_atan, Item_func_cos, Item_func_sin, Item_func_tan, Item_func_cot, Item_func_rand, Item_func_units, Item_func_min_max, Item_rollup_group_item, Item_func_bit, Item_func_udf_float, Item_func_udf_int, Item_func_udf_decimal, Item_func_udf_str, Item_func_set_user_var, Item_func_get_user_var, Item_user_var_as_out_param, Item_func_get_system_var, Item_func_match, Item_func_sp, Item_func_latlongfromgeohash, Item_func_coordinate_observer, Item_func_st_area, Item_func_st_length, Item_func_distance, Item_func_st_frechet_distance, Item_func_st_hausdorff_distance, Item_func_st_distance_sphere, Item_json_func, Item_func_array_cast, Item_func_json_value, Item_func_regexp_instr, Item_func_regexp_like, Item_func_regexp_replace, Item_func_regexp_substr, Item_row, Item_str_func, Item_func_elt, Item_singlerow_subselect, Item_exists_subselect, Item_in_subselect, Item_sum_int, Item_sum_sum, Item_aggr_avg_field, Item_aggr_bit_field, Item_sum_json, Item_sum_avg, Item_aggr_variance_field, Item_sum_variance, Item_aggr_std_field, Item_sum_std, Item_sum_hybrid, Item_sum_bit, Item_sum_udf_float, Item_sum_udf_int, Item_sum_udf_str, Item_sum_udf_decimal, Item_func_group_concat, Item_row_number, Item_rank, Item_cume_dist, Item_percent_rank, Item_ntile, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_rollup_sum_switcher, Item_sum_collect, Item_func_month, Item_func_weekday, Item_timeval_func, Item_temporal_hybrid_func, Item_date_func, Item_datetime_func, Item_time_func, Item_xpath_cast_number, Item_func_xpath_sum, Parse_tree_item, and Item_aggregate_type.
|
protected |
|
protected |
Implemented in Item_field, Item_param, Item_int, Item_uint, Item_decimal, Item_float, Item_string, Item_hex_string, Item_cache_str, Item_cache_row, Item_type_holder, Item_func_case, Item_func_udf_str, Item_func_get_system_var, Item_func_geometry_from_text, Item_func_geometry_from_wkb, Item_func_as_wkb, Item_func_geomfromgeojson, Item_func_centroid, Item_func_convex_hull, Item_func_envelope, Item_func_make_envelope, Item_func_validate, Item_func_st_simplify, Item_func_point, Item_func_pointfromgeohash, Item_func_spatial_decomp, Item_func_spatial_decomp_n, Item_func_spatial_collection, Item_func_st_difference, Item_func_st_intersection, Item_func_st_symdifference, Item_func_st_union, Item_func_buffer_strategy, Item_func_coordinate_mutator, Item_func_swap_xy, Item_func_st_buffer, Item_func_st_srid_mutator, Item_func_json_type, Item_func_array_cast, Item_row, Item_func_statement_digest_text, Item_func_from_base64, Item_func_aes_encrypt, Item_func_aes_decrypt, Item_func_concat, Item_func_concat_ws, Item_func_reverse, Item_func_replace, Item_func_insert, Item_str_conv, Item_func_left, Item_func_right, Item_func_substr, Item_func_substr_index, Item_func_trim, Item_func_database, Item_func_user, Item_func_current_user, Item_func_soundex, Item_func_char, Item_func_repeat, Item_func_space, Item_func_rpad, Item_func_lpad, Item_func_uuid_to_bin, Item_func_conv, Item_func_unhex, Item_func_like_range, Item_charset_conversion, Item_load_file, Item_func_quote, Item_func_set_collation, Item_func_charset, Item_func_collation, Item_func_weight_string, Item_func_uuid, Item_func_current_role, Item_func_roles_graphml, Item_func_get_dd_column_privileges, Item_func_get_dd_create_options, Item_func_get_dd_schema_options, Item_func_internal_get_comment_or_error, Item_func_get_dd_tablespace_private_data, Item_func_get_dd_index_private_data, Item_func_get_partition_nodegroup, Item_func_internal_tablespace_type, Item_func_internal_tablespace_logfile_group_name, Item_func_internal_tablespace_status, Item_func_internal_tablespace_row_format, Item_func_internal_tablespace_extra, Item_func_convert_cpu_id_mask, Item_func_get_dd_property_key_value, Item_func_remove_dd_property_key, Item_func_convert_interval_to_user_interval, Item_func_internal_get_username, Item_func_internal_get_hostname, Item_func_internal_get_enabled_role_json, Item_func_internal_get_mandatory_roles_json, Item_func_internal_get_dd_column_extra, Item_singlerow_subselect, Item_exists_subselect, Item_in_subselect, Item_aggr_avg_field, Item_aggr_bit_field, Item_sum_hybrid, Item_sum_udf_str, Item_sum_udf_decimal, Item_row_number, Item_rank, Item_cume_dist, Item_percent_rank, Item_ntile, Item_func_curtime, Item_func_curdate, Item_func_now, Item_func_xml_extractvalue, Item_func_xml_update, Parse_tree_item, Item_aggregate_type, Item_func_random_bytes, Item_json_func, Item_func_json_value, Item_func_regexp_replace, Item_func_regexp_substr, Item_ref_null_helper, Item_sp_variable, Item_name_const, Item_ident_for_show, Item_null, Item_view_ref, Item_cache_int, Item_cache_bit, Item_cache_real, Item_cache_decimal, Item_cache_datetime, Item_cache_json, Item_json, Item_func_if, Item_func_nullif, Item_real_func, Item_func_numhybrid, Item_int_func, Item_typecast_decimal, Item_typecast_real, Item_rollup_group_item, Item_func_bit, Item_func_udf_float, Item_func_udf_int, Item_func_udf_decimal, Item_func_set_user_var, Item_func_get_user_var, Item_user_var_as_out_param, Item_func_sp, Item_func_lineinterpolate, Item_func_st_transform, Item_typecast_geometry, Item_func_inet_ntoa, Item_func_json_unquote, Item_func_json_pretty, Item_func_pfs_format_bytes, Item_func_pfs_format_pico_time, Item_func_regexp_instr, Item_func_regexp_like, Item_str_ascii_func, Item_func_elt, Item_func_make_set, Item_func_export_set, Item_func_compress, Item_func_to_vector, Item_func_from_vector, Item_func_uncompress, Item_sum_num, Item_sum_int, Item_sum_sum, Item_sum_json, Item_sum_avg, Item_aggr_variance_field, Item_sum_bit, Item_sum_udf_float, Item_sum_udf_int, Item_func_group_concat, Item_lead_lag, Item_first_last_value, Item_nth_value, Item_rollup_sum_switcher, Item_sum_collect, Item_func_month, Item_func_monthname, Item_func_weekday, Item_func_dayname, Item_timeval_func, Item_temporal_hybrid_func, Item_date_func, Item_datetime_func, Item_time_func, Item_date_literal, Item_time_literal, Item_datetime_literal, Item_func_date_format, Item_nodeset_func, Item_ref, Item_values_column, and Item_func_json_quote.
Reimplemented in Item_func_as_wkt, Item_func_geometry_type, Item_func_geohash, Item_func_gtid_subtract, Item_func_md5, Item_func_sha, Item_func_sha2, Item_func_to_base64, Item_func_statement_digest, Item_func_format, Item_func_bin_to_uuid, Item_func_hex, Item_str_ascii_func, Item_func_inet_str_base, Item_temporal_hybrid_func, and Item_func_get_format.
|
inline |
Return date or time value of item in packed longlong format, depending on item field type.
longlong Item::val_temporal_with_round | ( | enum_field_types | type, |
uint8 | dec | ||
) |
Get date or time value in packed longlong format.
Before conversion from MYSQL_TIME to packed format, the MYSQL_TIME value is rounded to "dec" fractional digits.
|
virtual |
Return time value of item in packed longlong format.
Reimplemented in Item_field, Item_null, Item_temporal, Item_ref, Item_ref_null_helper, Item_datetime_with_ref, Item_time_with_ref, Item_cache_int, Item_cache_datetime, Item_sum_hybrid, Item_time_func, Item_time_literal, and Item_func_curtime.
|
inlineprotectedvirtual |
Reimplemented in Item_field.
|
inline |
|
inline |
|
virtual |
A processor to handle the select lex visitor framework.
|
inlinevirtual |
Traverses a tree of Items in prefix and/or postfix order.
Optionally walks into subqueries.
processor | processor function to be invoked per item returns true to abort traversal, false to continue |
walk | controls 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. |
arg | Optional pointer to a walk-specific object |
false | walk succeeded |
true | walk aborted by agreement, an error may have been reported |
Reimplemented in Item_ref, Item_cache, Item_cond, Item_multi_eq, Item_func, Item_row, Item_subselect, Item_in_subselect, Item_default_value, and Item_insert_value.
|
inline |
|
friend |
Item_result Item::cmp_context |
Comparison context.
DTCollation Item::collation |
Character set and collation properties assigned for this Item.
Used if Item represents a character string expression.
uint8 Item::decimals |
Number of decimals in result when evaluating this item.
bool Item::fixed |
True if item has been resolved.
bool Item::hidden {false} |
If the item is in a SELECT list (Query_block::fields) and hidden is true, the item wasn't actually in the list as given by the user (it was added by the optimizer, to e.g.
make sure it was part of a given materialization), and should not be returned in the actual result.
If the item is not in a SELECT list, the value is irrelevant.
|
private |
true if allocated directly by parser
Item_name_string Item::item_name |
Name from query.
|
private |
true if item has been fully de-referenced
|
protected |
|
mutableprivate |
The cost of evaluating this item.
This is only needed for predicates, therefore we use lazy evaluation.
|
private |
Data type assigned to Item.
bool Item::m_in_check_constraint_exec_ctx {false} |
True if item is a top most element in the expression being evaluated for a check constraint.
bool Item::m_is_window_function |
True if item represents window func.
|
private |
True if this item may hold the NULL value(if null_value may be set to true).
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.
It is worth noting that this information is correct only until equality propagation has been run by the optimization phase. Indeed, consider: select * from t1, t2,t3 where t1.pk=t2.a and t1.pk+1... the '+' is not nullable as t1.pk is not nullable; but if the optimizer chooses plan is t2-t3-t1, then, due to equality propagation it will replace t1.pk in '+' with t2.a (as t2 is before t1 in plan), making the '+' capable of returning NULL when t2.a is NULL.
|
private |
Number of references to this item.
It is used for two purposes:
item_marker Item::marker |
This member has several successive meanings, depending on the phase we're in (.
uint32 Item::max_length |
Maximum length of result of evaluating this item, in number of bytes.
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.
bool Item::null_value |
True if item is null.
Item_name_string Item::orig_name |
Original item name (if it was renamed)
|
staticconstexprprotected |
|
staticconstexprprotected |
Set if the item or one or more of the underlying items is a GROUPING function.
|
staticconstexprprotected |
Set if the item or one or more of the underlying items contains a GROUP BY modifier (such as ROLLUP).
|
staticconstexprprotected |
|
staticconstexprprotected |
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.
|
staticconstexprprotected |
|
protected |
str_values's main purpose is to cache the value in save_in_field
bool Item::unsigned_flag |