MySQL  8.0.27
Source Code Documentation
item_func.h File Reference
#include <sys/types.h>
#include <climits>
#include <cmath>
#include <cstddef>
#include <functional>
#include "decimal.h"
#include "field_types.h"
#include "ft_global.h"
#include "lex_string.h"
#include "m_ctype.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_pointer_arithmetic.h"
#include "my_table_map.h"
#include "my_thread_local.h"
#include "my_time.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysqld_error.h"
#include "sql/enum_query_type.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/my_decimal.h"
#include "sql/parse_location.h"
#include "sql/set_var.h"
#include "sql/sql_const.h"
#include "sql/sql_udf.h"
#include "sql/table.h"
#include "sql/thr_malloc.h"
#include "sql_string.h"
#include "template_utils.h"

Go to the source code of this file.

Classes

class  Item_func
 
class  Item_real_func
 
class  Item_func_numhybrid
 
class  Item_func_num1
 
class  Item_num_op
 
class  Item_int_func
 
class  Item_func_connection_id
 
class  Item_typecast_signed
 
class  Item_typecast_unsigned
 
class  Item_typecast_decimal
 
class  Item_typecast_real
 Class used to implement CAST to floating-point data types. More...
 
class  Item_func_additive_op
 
class  Item_func_plus
 
class  Item_func_minus
 
class  Item_func_mul
 
class  Item_func_div_base
 
class  Item_func_div
 
class  Item_func_div_int
 
class  Item_func_mod
 
class  Item_func_neg
 
class  Item_func_abs
 
class  Item_dec_func
 
class  Item_func_exp
 
class  Item_func_ln
 
class  Item_func_log
 
class  Item_func_log2
 
class  Item_func_log10
 
class  Item_func_sqrt
 
class  Item_func_pow
 
class  Item_func_acos
 
class  Item_func_asin
 
class  Item_func_atan
 
class  Item_func_cos
 
class  Item_func_sin
 
class  Item_func_tan
 
class  Item_func_cot
 
class  Item_func_int_val
 
class  Item_func_ceiling
 
class  Item_func_floor
 
class  Item_func_round
 
class  Item_func_rand
 
class  Item_func_sign
 
class  Item_func_units
 
class  Item_func_degrees
 
class  Item_func_radians
 
class  Item_func_min_max
 
class  Item_func_min
 
class  Item_func_max
 
class  Item_rollup_group_item
 A wrapper Item that normally returns its parameter, but becomes NULL when processing rows for rollup. More...
 
class  Item_func_length
 
class  Item_func_bit_length
 
class  Item_func_char_length
 
class  Item_func_coercibility
 
class  Item_func_locate
 
class  Item_func_instr
 
class  Item_func_validate_password_strength
 
class  Item_func_field
 
class  Item_func_ascii
 
class  Item_func_ord
 
class  Item_func_find_in_set
 
class  Item_func_bit
 
class  Item_func_bit_two_param
 Base class for all the bit functions that work with two binary arguments: '&', '|', '^'. More...
 
class  Item_func_bit_or
 
class  Item_func_bit_and
 
class  Item_func_bit_xor
 
class  Item_func_bit_count
 
class  Item_func_shift
 
class  Item_func_shift_left
 
class  Item_func_shift_right
 
class  Item_func_bit_neg
 
class  Item_func_last_insert_id
 
class  Item_func_benchmark
 
class  Item_func_sleep
 
class  Item_udf_func
 
class  Item_func_udf_float
 
class  Item_func_udf_int
 
class  Item_func_udf_decimal
 
class  Item_func_udf_str
 
class  Item_func_get_lock
 
class  Item_func_release_lock
 
class  Item_func_release_all_locks
 
class  Item_source_pos_wait
 
class  Item_master_pos_wait
 
class  Item_wait_for_executed_gtid_set
 This class is used for implementing the new wait_for_executed_gtid_set function and the functions related to them. More...
 
class  Item_master_gtid_set_wait
 
class  Item_func_gtid_subset
 
class  Item_func_can_access_database
 Internal functions used by INFORMATION_SCHEMA implementation to check if user have access to given database/table/column. More...
 
class  Item_func_can_access_table
 
class  Item_func_can_access_user
 
class  Item_func_can_access_trigger
 
class  Item_func_can_access_routine
 
class  Item_func_can_access_event
 
class  Item_func_can_access_resource_group
 
class  Item_func_can_access_view
 
class  Item_func_can_access_column
 
class  Item_func_is_visible_dd_object
 
class  Item_func_internal_table_rows
 
class  Item_func_internal_avg_row_length
 
class  Item_func_internal_data_length
 
class  Item_func_internal_max_data_length
 
class  Item_func_internal_index_length
 
class  Item_func_internal_data_free
 
class  Item_func_internal_auto_increment
 
class  Item_func_internal_checksum
 
class  Item_func_internal_keys_disabled
 
class  Item_func_internal_index_column_cardinality
 
class  Item_func_internal_dd_char_length
 
class  Item_func_internal_get_view_warning_or_error
 
class  Item_func_get_dd_index_sub_part_length
 
class  Item_func_internal_tablespace_id
 
class  Item_func_internal_tablespace_logfile_group_number
 
class  Item_func_internal_tablespace_free_extents
 
class  Item_func_internal_tablespace_total_extents
 
class  Item_func_internal_tablespace_extent_size
 
class  Item_func_internal_tablespace_initial_size
 
class  Item_func_internal_tablespace_maximum_size
 
class  Item_func_internal_tablespace_autoextend_size
 
class  Item_func_internal_tablespace_version
 
class  Item_func_internal_tablespace_data_free
 
class  Item_var_func
 Common class for: Item_func_get_system_var Item_func_get_user_var Item_func_set_user_var. More...
 
class  user_var_entry
 
class  Item_func_set_user_var
 This class is used to implement operations like SET @variable or @variable:= expression. More...
 
class  Item_func_get_user_var
 
class  Item_user_var_as_out_param
 
class  Audit_global_variable_get_event
 Class to log audit event MYSQL_AUDIT_GLOBAL_VARIABLE_GET. More...
 
class  Item_func_get_system_var
 
class  Item_func_match
 
class  Item_func_is_free_lock
 
class  Item_func_is_used_lock
 
class  Item_func_row_count
 
class  Item_func_sp
 
class  Item_func_found_rows
 
class  Item_func_uuid_short
 
class  Item_func_version
 
class  Item_func_internal_is_mandatory_role
 Internal function used by INFORMATION_SCHEMA implementation to check if a role is a mandatory role. More...
 
class  Item_func_internal_is_enabled_role
 Internal function used by INFORMATION_SCHEMA implementation to check if a role is enabled. More...
 

Macros

#define GET_SYS_VAR_CACHE_LONG   1
 
#define GET_SYS_VAR_CACHE_DOUBLE   2
 
#define GET_SYS_VAR_CACHE_STRING   4
 

Functions

bool reject_geometry_args (uint arg_count, Item **args, Item_result_field *me)
 
void unsupported_json_comparison (size_t arg_count, Item **args, const char *msg)
 Go through the arguments of a function and check if any of them are JSON. More...
 
void report_conversion_error (const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs)
 
bool simplify_string_args (THD *thd, const DTCollation &c, Item **items, uint nitems)
 Simplify the string arguments to a function, if possible. More...
 
Stringeval_string_arg (const CHARSET_INFO *to_cs, Item *arg, String *buffer)
 Evaluate an argument string and return it in the desired character set. More...
 
void item_func_sleep_init ()
 
void item_func_sleep_free ()
 
void mysql_ull_cleanup (THD *thd)
 Release all user level locks for this THD. More...
 
void mysql_ull_set_explicit_lock_duration (THD *thd)
 Set explicit duration for metadata locks corresponding to user level locks to protect them from being released at the end of transaction. More...
 
void uuid_short_init ()
 
Itemget_system_var (Parse_context *pc, enum_var_type var_type, LEX_STRING name, LEX_STRING component, bool unsafe_for_replication)
 Return value of an system variable base[.name] as a constant item. More...
 
bool check_reserved_words (const char *name)
 
enum_field_types agg_field_type (Item **items, uint nitems)
 Aggregates field types from the array of items. More...
 
double my_double_round (double value, longlong dec, bool dec_unsigned, bool truncate)
 
bool eval_const_cond (THD *thd, Item *cond, bool *value)
 Evaluate a constant condition, represented by an Item tree. More...
 
Item_fieldget_gc_for_expr (const Item *func, Field *fld, Item_result type, Field **found=nullptr)
 Return new Item_field if given expression matches GC. More...
 
void retrieve_tablespace_statistics (THD *thd, Item **args, bool *null_value)
 Retrieve tablespace statistics from SE. More...
 

Variables

bool volatile mqh_used
 

Macro Definition Documentation

◆ GET_SYS_VAR_CACHE_DOUBLE

#define GET_SYS_VAR_CACHE_DOUBLE   2

◆ GET_SYS_VAR_CACHE_LONG

#define GET_SYS_VAR_CACHE_LONG   1

◆ GET_SYS_VAR_CACHE_STRING

#define GET_SYS_VAR_CACHE_STRING   4

Function Documentation

◆ agg_field_type()

enum_field_types agg_field_type ( Item **  items,
uint  nitems 
)

Aggregates field types from the array of items.

Parameters
[in]itemsarray of items to aggregate the type from
[in]nitemsnumber of items in the array

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

Note
The term "aggregation" is used here in the sense of inferring the result type of a function from its argument types.
Returns
aggregated field type.

◆ check_reserved_words()

bool check_reserved_words ( const char *  name)

◆ eval_const_cond()

bool eval_const_cond ( THD thd,
Item cond,
bool *  value 
)

Evaluate a constant condition, represented by an Item tree.

Parameters
thdThread handler
condThe constant condition to evaluate
[out]valueReturned value, either true or false
Returns
false if evaluation is successful, true otherwise

◆ eval_string_arg()

String* eval_string_arg ( const CHARSET_INFO to_cs,
Item arg,
String buffer 
)

Evaluate an argument string and return it in the desired character set.

Perform character set conversion if needed. Perform character set validation (from a binary string) if needed.

Parameters
to_csThe desired character set
argArgument to evaluate as a string value
bufferString buffer where argument is evaluated, if necessary
Returns
string pointer if success, NULL if error or NULL value

◆ get_gc_for_expr()

Item_field* get_gc_for_expr ( const Item func,
Field fld,
Item_result  type,
Field **  found 
)

Return new Item_field if given expression matches GC.

See also
substitute_gc()
Parameters
funcExpression to be replaced
fldGCs field
typeResult type to match with Field
[out]foundIf given, just return found field, without Item_field
Returns
item new Item_field for matched GC NULL otherwise

◆ get_system_var()

Item* get_system_var ( Parse_context pc,
enum_var_type  var_type,
LEX_STRING  name,
LEX_STRING  component,
bool  unsafe_for_replication 
)

Return value of an system variable base[.name] as a constant item.

Parameters
pcCurrent parse context
var_typeglobal / session
nameName of base or system variable
componentComponent.
unsafe_for_replicationIf true and if the variable is written to a binlog then mark the statement as unsafe.
Note
If component.str = 0 then the variable name is in 'name'
Returns
  • 0 : error
  • # : constant item

◆ item_func_sleep_free()

void item_func_sleep_free ( )

◆ item_func_sleep_init()

void item_func_sleep_init ( )

◆ my_double_round()

double my_double_round ( double  value,
longlong  dec,
bool  dec_unsigned,
bool  truncate 
)

◆ mysql_ull_cleanup()

void mysql_ull_cleanup ( THD thd)

Release all user level locks for this THD.

◆ mysql_ull_set_explicit_lock_duration()

void mysql_ull_set_explicit_lock_duration ( THD thd)

Set explicit duration for metadata locks corresponding to user level locks to protect them from being released at the end of transaction.

◆ reject_geometry_args()

bool reject_geometry_args ( uint  arg_count,
Item **  args,
Item_result_field me 
)

◆ report_conversion_error()

void report_conversion_error ( const CHARSET_INFO to_cs,
const char *  from,
size_t  from_length,
const CHARSET_INFO from_cs 
)

◆ retrieve_tablespace_statistics()

void retrieve_tablespace_statistics ( THD thd,
Item **  args,
bool *  null_value 
)

Retrieve tablespace statistics from SE.

Parameters
thdThe current thread.
argsList of parameters in following order,
                   - Tablespace_name
                   - Engine_name
                   - Tablespace_se_private_data
[out]null_valueMarked true indicating NULL, if there is no value.

◆ simplify_string_args()

bool simplify_string_args ( THD thd,
const DTCollation c,
Item **  args,
uint  nargs 
)

Simplify the string arguments to a function, if possible.

Currently used to substitute const values with character strings in the desired character set. Only used during resolving.

Parameters
thdthread handler
cDesired character set and collation
argsPointer to argument array
nargsNumber of arguments to process
Returns
false if success, true if error

◆ unsupported_json_comparison()

void unsupported_json_comparison ( size_t  arg_count,
Item **  args,
const char *  msg 
)

Go through the arguments of a function and check if any of them are JSON.

If a JSON argument is found, raise a warning saying that this operation is not supported yet. This function is used to notify users that they are comparing JSON values using a mechanism that has not yet been updated to use the JSON comparator. JSON values are typically handled as strings in that case.

Parameters
arg_countthe number of arguments
argsthe arguments to go through looking for JSON values
msgthe message that explains what is not supported

◆ uuid_short_init()

void uuid_short_init ( )

Variable Documentation

◆ mqh_used

bool volatile mqh_used
extern