MySQL 8.4.3
Source Code Documentation
item_strfunc.cc File Reference

This file defines all string Items (e.g. More...

#include "sql/item_strfunc.h"
#include <fcntl.h>
#include <algorithm>
#include <atomic>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
#include <openssl/sha.h>
#include <zconf.h>
#include <zlib.h>
#include "base64.h"
#include "decimal.h"
#include "dig_vec.h"
#include "field_types.h"
#include "lex_string.h"
#include "m_string.h"
#include "my_aes.h"
#include "my_alloc.h"
#include "my_byteorder.h"
#include "my_checksum.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_dir.h"
#include "my_io.h"
#include "my_md5.h"
#include "my_md5_size.h"
#include "my_rnd.h"
#include "my_sqlcommand.h"
#include "my_stacktrace.h"
#include "my_sys.h"
#include "my_systime.h"
#include "myisampack.h"
#include "mysql/components/services/bits/my_io_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/my_loglevel.h"
#include "mysql/mysql_lex_string.h"
#include "mysql/psi/mysql_file.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "mysys_err.h"
#include "nulls.h"
#include "sha1.h"
#include "sha2.h"
#include "sql-common/my_decimal.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/current_thd.h"
#include "sql/dd/dd_event.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/info_schema/metadata.h"
#include "sql/dd/info_schema/table_stats.h"
#include "sql/dd/info_schema/tablespace_stats.h"
#include "sql/dd/properties.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/event.h"
#include "sql/dd_sql_view.h"
#include "sql/derror.h"
#include "sql/error_handler.h"
#include "sql/events.h"
#include "sql/filesort.h"
#include "sql/handler.h"
#include "sql/mysqld.h"
#include "sql/parse_tree_node_base.h"
#include "sql/resourcegroups/resource_group_mgr.h"
#include "sql/rpl_gtid.h"
#include "sql/sort_param.h"
#include "sql/sql_class.h"
#include "sql/sql_digest.h"
#include "sql/sql_digest_stream.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_locale.h"
#include "sql/sql_show.h"
#include "sql/strfunc.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/val_int_compare.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "strxmov.h"
#include "template_utils.h"
#include "typelib.h"
#include "unhex.h"

Classes

class  kdf_argument
 
class  iv_argument
 helper class to process an IV argument to aes_encrypt/aes_decrypt More...
 
class  anonymous_namespace{item_strfunc.cc}::Thd_parse_modifier
 Because it's not possible to disentangle the state of the parser from the THD, we have to destructively modify the current THD object in order to parse. More...
 
class  anonymous_namespace{item_strfunc.cc}::Parse_error_anonymizer
 Error handler that wraps parse error messages, removes details and silences warnings. More...
 

Namespaces

namespace  anonymous_namespace{item_strfunc.cc}
 

Macros

#define get_esc_bit(mask, num)   (1 & (*((mask) + ((num) >> 3))) >> ((num)&7))
 
#define UUID_TIME_OFFSET   ((ulonglong)141427 * 24 * 60 * 60 * 1000 * 1000 * 10)
 number of 100-nanosecond intervals between 1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00. More...
 
#define UUID_VERSION   0x1000
 
#define UUID_VARIANT   0x8000
 

Functions

static CHARSET_INFOget_checksum_charset (const char *csname)
 
bool anonymous_namespace{item_strfunc.cc}::parse (THD *thd, Item *statement_expr, String *statement_string)
 Parses a string and fills the token buffer. More...
 
static const char * trim_func_name (Item_func_trim::TRIM_MODE mode)
 
static int soundex_toupper (int ch)
 If alpha, map input letter to soundex code. More...
 
static char get_scode (int wc)
 
static bool my_uni_isalpha (int wc)
 
Stringalloc_buffer (String *res, String *str, String *tmp_value, size_t length)
 
static void tohex (char *to, uint from, uint len)
 
static void set_clock_seq_str ()
 
Stringmysql_generate_uuid (String *str)
 Generate Universal Unique Identifier (UUID). More...
 
CHARSET_INFOmysqld_collation_get_by_name (const char *name, CHARSET_INFO *name_cs)
 Get collation by name, send error to client on failure. More...
 

Variables

uint * my_aes_opmode_key_sizes
 
const int max_kdf_option_size {256}
 Helper class to retrieve KDF options for aes_encrypt/aes_decrypt. More...
 
const int max_kdf_iterations_size {65535}
 
const int min_kdf_iterations_size {1000}
 
static const char * soundex_map = "01230120022455012623010202"
 
const int FORMAT_MAX_DECIMALS = 30
 Change a number to format '3,333,333,333.000'. More...
 
static struct rand_struct uuid_rand
 
static uint nanoseq
 
static ulonglong uuid_time = 0
 
static char clock_seq_and_node_str [] = "-0000-000000000000"
 

Detailed Description

This file defines all string Items (e.g.

CONCAT).

Macro Definition Documentation

◆ get_esc_bit

#define get_esc_bit (   mask,
  num 
)    (1 & (*((mask) + ((num) >> 3))) >> ((num)&7))

◆ UUID_TIME_OFFSET

#define UUID_TIME_OFFSET   ((ulonglong)141427 * 24 * 60 * 60 * 1000 * 1000 * 10)

number of 100-nanosecond intervals between 1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00.

◆ UUID_VARIANT

#define UUID_VARIANT   0x8000

◆ UUID_VERSION

#define UUID_VERSION   0x1000

Function Documentation

◆ alloc_buffer()

String * alloc_buffer ( String res,
String str,
String tmp_value,
size_t  length 
)
inline

◆ get_checksum_charset()

static CHARSET_INFO * get_checksum_charset ( const char *  csname)
static

◆ get_scode()

static char get_scode ( int  wc)
static

◆ my_uni_isalpha()

static bool my_uni_isalpha ( int  wc)
static

◆ mysql_generate_uuid()

String * mysql_generate_uuid ( String str)

Generate Universal Unique Identifier (UUID).

Parameters
strPointer to string which will hold the UUID.
Returns
str Pointer to string which contains the UUID.

◆ mysqld_collation_get_by_name()

CHARSET_INFO * mysqld_collation_get_by_name ( const char *  name,
CHARSET_INFO name_cs 
)

Get collation by name, send error to client on failure.

Parameters
nameCollation name
name_csCharacter set of the name string
Return values
NULLon error
Pointterto CHARSET_INFO with the given name on success

◆ set_clock_seq_str()

static void set_clock_seq_str ( )
static

◆ soundex_toupper()

static int soundex_toupper ( int  ch)
static

If alpha, map input letter to soundex code.

If not alpha and remove_garbage is set then skip to next char else return 0

◆ tohex()

static void tohex ( char *  to,
uint  from,
uint  len 
)
static

◆ trim_func_name()

static const char * trim_func_name ( Item_func_trim::TRIM_MODE  mode)
static

Variable Documentation

◆ clock_seq_and_node_str

char clock_seq_and_node_str[] = "-0000-000000000000"
static

◆ FORMAT_MAX_DECIMALS

const int FORMAT_MAX_DECIMALS = 30

Change a number to format '3,333,333,333.000'.

This should be 'internationalized' sometimes.

◆ max_kdf_iterations_size

const int max_kdf_iterations_size {65535}

◆ max_kdf_option_size

const int max_kdf_option_size {256}

Helper class to retrieve KDF options for aes_encrypt/aes_decrypt.

◆ min_kdf_iterations_size

const int min_kdf_iterations_size {1000}

◆ my_aes_opmode_key_sizes

uint* my_aes_opmode_key_sizes
extern

◆ nanoseq

uint nanoseq
static

◆ soundex_map

const char* soundex_map = "01230120022455012623010202"
static

◆ uuid_rand

struct rand_struct uuid_rand
static

◆ uuid_time

ulonglong uuid_time = 0
static