![]() |
MySQL 8.0.43
Source Code Documentation
|
#include <sys/types.h>#include <cfloat>#include <climits>#include <cmath>#include <cstdio>#include <cstring>#include <memory>#include <new>#include <optional>#include <string>#include <type_traits>#include <vector>#include "decimal.h"#include "field_types.h"#include "lex_string.h"#include "m_ctype.h"#include "m_string.h"#include "memory_debugging.h"#include "my_alloc.h"#include "my_bitmap.h"#include "my_compiler.h"#include "my_dbug.h"#include "my_double2ulonglong.h"#include "my_inttypes.h"#include "my_sys.h"#include "my_table_map.h"#include "my_time.h"#include "mysql/udf_registration_types.h"#include "mysql_com.h"#include "mysql_time.h"#include "mysqld_error.h"#include "sql/auth/auth_acls.h"#include "sql/enum_query_type.h"#include "sql/field.h"#include "sql/mem_root_array.h"#include "sql/my_decimal.h"#include "sql/parse_location.h"#include "sql/parse_tree_node_base.h"#include "sql/sql_array.h"#include "sql/sql_const.h"#include "sql/sql_list.h"#include "sql/table.h"#include "sql/table_trigger_field_support.h"#include "sql/thr_malloc.h"#include "sql/trigger_def.h"#include "sql_string.h"#include "template_utils.h"Go to the source code of this file.
Classes | |
| class | DTCollation |
| class | Mark_field |
| Class used as argument to Item::walk() together with mark_field_in_map() More... | |
| class | Used_tables |
| Class used as argument to Item::walk() together with used_tables_for_level() More... | |
| class | Name_string |
| Storage for name strings. More... | |
| class | Item_name_string |
| Storage for Item names. More... | |
| struct | Name_resolution_context |
| struct | Check_function_as_value_generator_parameters |
| Struct used to pass around arguments to/from check_function_as_value_generator. More... | |
| class | Name_resolution_context_state |
| class | Bool3 |
| A type for SQL-like 3-valued Booleans: true/false/unknown. More... | |
| class | Type_properties |
| Type properties, used to collect type information for later assignment to an Item object. More... | |
| class | Settable_routine_parameter |
| class | Item_tree_walker |
| Utility mixin class to be able to walk() only parts of item trees. More... | |
| struct | ContainedSubquery |
| This class represents a subquery contained in some subclass of Item_subselect,. More... | |
| class | Item |
| Base class that is used to represent any kind of expression in a relational query. More... | |
| class | Item::Collect_item_fields_or_refs |
| class | Item::Collect_item_fields_or_view_refs |
| class | Item::Cleanup_after_removal_context |
| Context object for (functions that override) Item::clean_up_after_removal(). More... | |
| struct | Item::Css_info |
| Minion class under Collect_scalar_subquery_info. More... | |
| struct | Item::Collect_scalar_subquery_info |
| Context struct used by walk method collect_scalar_subqueries to accumulate information about scalar subqueries found. More... | |
| struct | Item::Item_replacement |
| struct | Item::Item_field_replacement |
| struct | Item::Item_view_ref_replacement |
| struct | Item::Aggregate_replacement |
| struct | Item::Aggregate_ref_update |
| struct | cache_const_expr_arg |
| Descriptor of what and how to cache for Item::cache_const_expr_transformer/analyzer. More... | |
| class | Item_basic_constant |
| class | Item_sp_variable |
| class | Item_splocal |
| class | Item_case_expr |
| class | Item_name_const |
| class | Item_num |
| class | Item_ident |
| struct | Item_ident::Change_context |
| < Argument object to change_context_processor More... | |
| struct | Item_ident::Depended_change |
| Argument structure for walk processor Item::update_depended_from. More... | |
| class | Item_ident_for_show |
| class | Item_field |
| class | Item_asterisk |
| Represents [schema. More... | |
| class | Item_null |
| class | Item_param |
| Dynamic parameters used as placeholders ('?') inside prepared statements. More... | |
| class | Item_int |
| class | Item_int_0 |
| Item_int with value==0 and length==1. More... | |
| class | Item_temporal |
| class | Item_uint |
| class | Item_decimal |
| class | Item_float |
| class | Item_func_pi |
| class | Item_string |
| class | Item_static_string_func |
| class | Item_partition_func_safe_string |
| class | Item_blob |
| class | Item_empty_string |
| Item_empty_string – is a utility class to put an item into List<Item> which is then used in protocol.send_result_set_metadata() when sending SHOW output to the client. More... | |
| class | Item_return_int |
| class | Item_hex_string |
| class | Item_bin_string |
| class | Item_result_field |
| Item with result field. More... | |
| class | Item_ref |
| class | Item_view_ref |
| Class for fields from derived tables and views. More... | |
| class | Item_outer_ref |
| class | Item_ref_null_helper |
| class | Item_int_with_ref |
| class | Item_temporal_with_ref |
| class | Item_datetime_with_ref |
| class | Item_time_with_ref |
| class | Item_metadata_copy |
| A dummy item that contains a copy/backup of the given Item's metadata; not valid for data. More... | |
| class | Cached_item |
| This is used for segregating rows in groups (e.g. More... | |
| class | Cached_item_str |
| class | Cached_item_json |
| Cached_item subclass for JSON values. More... | |
| class | Cached_item_real |
| class | Cached_item_int |
| class | Cached_item_temporal |
| class | Cached_item_decimal |
| class | Item_default_value |
| class | Item_insert_value |
| class | Item_trigger_field |
| Represents NEW/OLD version of field of row which is changed/read in trigger. More... | |
| class | Item_cache |
| class | Item_cache_int |
| class | Item_cache_bit |
| Cache class for BIT type expressions. More... | |
| class | Item_cache_real |
| class | Item_cache_decimal |
| class | Item_cache_str |
| class | Item_cache_row |
| class | Item_cache_datetime |
| class | Item_cache_json |
| An item cache for values of type JSON. More... | |
| class | Item_aggregate_type |
| Interface for storing an aggregation of type and type specification of multiple Item objects. More... | |
| class | Item_type_holder |
| Item_type_holder stores an aggregation of name, type and type specification of UNIONS and derived tables. More... | |
| class | Item_values_column |
| Reference item that encapsulates both the type and the contained items of a single column of a VALUES ROW query expression. More... | |
| class | Item_json |
| A class that represents a constant JSON value. More... | |
Macros | |
| #define | COND_FILTER_ALLPASS 1.0f |
| Default condition filtering (selectivity) values used by get_filtering_effect() and friends when better estimates (statistics) are not available for a predicate. More... | |
| #define | COND_FILTER_EQUALITY 0.1f |
| Filtering effect for equalities: col1 = col2. More... | |
| #define | COND_FILTER_INEQUALITY 0.3333f |
| Filtering effect for inequalities: col1 > col2. More... | |
| #define | COND_FILTER_BETWEEN 0.1111f |
| Filtering effect for between: col1 BETWEEN a AND b. More... | |
| #define | COND_FILTER_STALE -1.0f |
| Value is out-of-date, will need recalculation. More... | |
| #define | COND_FILTER_STALE_NO_CONST -2.0f |
| A special subcase of the above: More... | |
| #define | MY_COLL_ALLOW_SUPERSET_CONV 1 |
| #define | MY_COLL_ALLOW_COERCIBLE_CONV 2 |
| #define | MY_COLL_DISALLOW_NONE 4 |
| #define | MY_COLL_ALLOW_NUMERIC_CONV 8 |
| #define | MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV) |
| #define | MY_COLL_CMP_CONV (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE) |
| #define | NAME_STRING(x) Name_string(STRING_WITH_LEN(x)) |
| #define | NO_FIELD_INDEX ((uint16)(-1)) |
Typedefs | |
| typedef Bounds_checked_array< Item * > | Ref_item_array |
| typedef enum monotonicity_info | enum_monotonicity_info |
| typedef bool(Item::* | Item_analyzer) (uchar **argp) |
| typedef Item *(Item::* | Item_transformer) (uchar *arg) |
| Type for transformers used by Item::transform and Item::compile. More... | |
| typedef void(* | Cond_traverser) (const Item *item, void *arg) |
Enumerations | |
| enum | monotonicity_info { NON_MONOTONIC , MONOTONIC_INCREASING , MONOTONIC_INCREASING_NOT_NULL , MONOTONIC_STRICT_INCREASING , MONOTONIC_STRICT_INCREASING_NOT_NULL } |
Functions | |
| void | item_init (void) |
| Init all special items. More... | |
| static uint32 | char_to_byte_length_safe (uint32 char_length_arg, uint32 mbmaxlen_arg) |
| Item_result | numeric_context_result_type (enum_field_types data_type, Item_result result_type, uint8 decimals) |
| template<class T > | |
| bool | WalkItem (Item *item, enum_walk walk, T &&functor) |
| A helper class to give in a functor to Item::walk(). More... | |
| template<class T > | |
| bool | WalkItem (const Item *item, enum_walk walk, T &&functor) |
| Overload for const 'item' and functor taking 'const Item*' argument. More... | |
| template<class T , class U > | |
| Item * | CompileItem (Item *item, T &&analyzer, U &&transformer) |
| Same as WalkItem, but for Item::compile(). More... | |
| template<class T > | |
| Item * | TransformItem (Item *item, T &&transformer) |
| Same as WalkItem, but for Item::transform(). More... | |
| bool | agg_item_collations_for_comparison (DTCollation &c, const char *name, Item **items, uint nitems, uint flags) |
| bool | agg_item_set_converter (DTCollation &coll, const char *fname, Item **args, uint nargs, uint flags, int item_sep, bool only_consts) |
| bool | agg_item_charsets (DTCollation &c, const char *name, Item **items, uint nitems, uint flags, int item_sep, bool only_consts) |
| bool | agg_item_charsets_for_string_result (DTCollation &c, const char *name, Item **items, uint nitems, int item_sep=1) |
| bool | agg_item_charsets_for_comparison (DTCollation &c, const char *name, Item **items, uint nitems, int item_sep=1) |
| Item_field * | FindEqualField (Item_field *item_field, table_map reachable_tables, bool replace, bool *found) |
| longlong | longlong_from_string_with_check (const CHARSET_INFO *cs, const char *cptr, const char *end, int unsigned_target) |
| Converts a string to a longlong integer, with warnings. More... | |
| double | double_from_string_with_check (const CHARSET_INFO *cs, const char *cptr, const char *end) |
| Cached_item * | new_Cached_item (THD *thd, Item *item) |
| Create right type of Cached_item for an item. More... | |
| Item_result | item_cmp_type (Item_result a, Item_result b) |
| bool | resolve_const_item (THD *thd, Item **ref, Item *cmp_item) |
| Substitute a const item with a simpler const item, if possible. More... | |
| int | stored_field_cmp_to_item (THD *thd, Field *field, Item *item) |
| Compare the value stored in field with the expression from the query. More... | |
| bool | is_null_on_empty_table (THD *thd, Item_field *i) |
| Check if the column reference that is currently being resolved, will be set to NULL if its qualifying query returns zero rows. More... | |
| void | convert_and_print (const String *from_str, String *to_str, const CHARSET_INFO *to_cs) |
| Helper method: Convert string to the given charset, then print. More... | |
| std::string | ItemToString (const Item *item) |
| size_t | CountVisibleFields (const mem_root_deque< Item * > &fields) |
| size_t | CountHiddenFields (const mem_root_deque< Item * > &fields) |
| Item * | GetNthVisibleField (const mem_root_deque< Item * > &fields, size_t index) |
| bool | ItemsAreEqual (const Item *a, const Item *b, bool binary_cmp) |
| Returns true iff the two items are equal, as in a->eq(b), after unwrapping refs and Item_cache objects. More... | |
| bool | AllItemsAreEqual (const Item *const *a, const Item *const *b, int num_items, bool binary_cmp) |
| Returns true iff all items in the two arrays (which must be of the same size) are equal, as in a->eq(b), after unwrapping refs and Item_cache objects. More... | |
Variables | |
| const Name_string | null_name_string |
| const String | my_null_string |
| #define COND_FILTER_ALLPASS 1.0f |
Default condition filtering (selectivity) values used by get_filtering_effect() and friends when better estimates (statistics) are not available for a predicate.
For predicates that are always satisfied. Must be 1.0 or the filter calculation logic will break down.
| #define COND_FILTER_BETWEEN 0.1111f |
Filtering effect for between: col1 BETWEEN a AND b.
| #define COND_FILTER_EQUALITY 0.1f |
Filtering effect for equalities: col1 = col2.
| #define COND_FILTER_INEQUALITY 0.3333f |
Filtering effect for inequalities: col1 > col2.
| #define COND_FILTER_STALE -1.0f |
Value is out-of-date, will need recalculation.
This is used by post-greedy-search logic which changes the access method and thus makes obsolete the filtering value calculated by best_access_path(). For example, test_if_skip_sort_order().
| #define COND_FILTER_STALE_NO_CONST -2.0f |
A special subcase of the above:
| #define MY_COLL_ALLOW_COERCIBLE_CONV 2 |
| #define MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV) |
| #define MY_COLL_ALLOW_NUMERIC_CONV 8 |
| #define MY_COLL_ALLOW_SUPERSET_CONV 1 |
| #define MY_COLL_CMP_CONV (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE) |
| #define MY_COLL_DISALLOW_NONE 4 |
| #define NAME_STRING | ( | x | ) | Name_string(STRING_WITH_LEN(x)) |
| #define NO_FIELD_INDEX ((uint16)(-1)) |
| typedef void(* Cond_traverser) (const Item *item, void *arg) |
| typedef enum monotonicity_info enum_monotonicity_info |
| typedef bool(Item::* Item_analyzer) (uchar **argp) |
Type for transformers used by Item::transform and Item::compile.
| arg | Argument used by the transformer. Really a typeless pointer in spite of the uchar type (historical reasons). The transformer needs to cast this to the desired pointer type |
| typedef Bounds_checked_array<Item *> Ref_item_array |
| enum monotonicity_info |
| bool agg_item_charsets | ( | DTCollation & | c, |
| const char * | name, | ||
| Item ** | items, | ||
| uint | nitems, | ||
| uint | flags, | ||
| int | item_sep, | ||
| bool | only_consts | ||
| ) |
|
inline |
|
inline |
| bool agg_item_collations_for_comparison | ( | DTCollation & | c, |
| const char * | name, | ||
| Item ** | items, | ||
| uint | nitems, | ||
| uint | flags | ||
| ) |
| bool agg_item_set_converter | ( | DTCollation & | coll, |
| const char * | fname, | ||
| Item ** | args, | ||
| uint | nargs, | ||
| uint | flags, | ||
| int | item_sep, | ||
| bool | only_consts | ||
| ) |
| bool AllItemsAreEqual | ( | const Item *const * | a, |
| const Item *const * | b, | ||
| int | num_items, | ||
| bool | binary_cmp | ||
| ) |
Returns true iff all items in the two arrays (which must be of the same size) are equal, as in a->eq(b), after unwrapping refs and Item_cache objects.
|
inline |
Same as WalkItem, but for Item::compile().
Use as e.g.:
Item *item = CompileItem(root_item, [](Item *item) { return true; }, // Analyzer. [](Item *item) { return item; }); // Transformer.
| void convert_and_print | ( | const String * | from_str, |
| String * | to_str, | ||
| const CHARSET_INFO * | to_cs | ||
| ) |
Helper method: Convert string to the given charset, then print.
| from_str | String to be converted. |
| to_str | Query string. |
| to_cs | Character set to which the string is to be converted. |
|
inline |
|
inline |
| double double_from_string_with_check | ( | const CHARSET_INFO * | cs, |
| const char * | cptr, | ||
| const char * | end | ||
| ) |
| Item_field * FindEqualField | ( | Item_field * | item_field, |
| table_map | reachable_tables, | ||
| bool | replace, | ||
| bool * | found | ||
| ) |
|
inline |
| bool is_null_on_empty_table | ( | THD * | thd, |
| Item_field * | i | ||
| ) |
Check if the column reference that is currently being resolved, will be set to NULL if its qualifying query returns zero rows.
This is true for non-aggregated column references in the SELECT list, if the query block uses aggregation without grouping. For example:
SELECT COUNT(*), col FROM t WHERE some_condition
Here, if the table t is empty, or some_condition doesn't match any rows in t, the query returns one row where col is NULL, even if col is a not-nullable column.
Such column references are rejected if the ONLY_FULL_GROUP_BY SQL mode is enabled, in a later resolution phase.
| Item_result item_cmp_type | ( | Item_result | a, |
| Item_result | b | ||
| ) |
| void item_init | ( | void | ) |
Init all special items.
Returns true iff the two items are equal, as in a->eq(b), after unwrapping refs and Item_cache objects.
| std::string ItemToString | ( | const Item * | item | ) |
| longlong longlong_from_string_with_check | ( | const CHARSET_INFO * | cs, |
| const char * | cptr, | ||
| const char * | end, | ||
| int | unsigned_target | ||
| ) |
Converts a string to a longlong integer, with warnings.
| cs | charset of string |
| cptr | beginning of string |
| end | end of string |
| unsigned_target | If 0, caller will use result as a signed integer; if 1: an unsigned integer; if -1: caller doesn't tell. This influences warnings. |
| Cached_item * new_Cached_item | ( | THD * | thd, |
| Item * | item | ||
| ) |
Create right type of Cached_item for an item.
|
inline |
Substitute a const item with a simpler const item, if possible.
| thd | Current session. | |
| [in,out] | ref | Const item to be processed, contains simplest possible item on return. |
| comp_item | Item that provides result type for generated const item |
Compare the value stored in field with the expression from the query.
| thd | Current session. |
| field | Field which the Item is stored in after conversion |
| item | Original expression from query |
We similarly use it to verify that expressions like BIGINT_FIELD <cmp> <literal value> is done correctly (as int/decimal/float according to literal type).
Same as WalkItem, but for Item::transform().
Use as e.g.:
Item *item = TransformItem(root_item, [](Item *item) { return item; });
Overload for const 'item' and functor taking 'const Item*' argument.
A helper class to give in a functor to Item::walk().
Use as e.g.:
bool result = WalkItem(root_item, enum_walk::POSTFIX, [](Item *item) { ... });
TODO: Make Item::walk() just take in a functor in the first place, instead of a pointer-to-member and an opaque argument.
|
extern |
|
extern |