MySQL 9.0.0
Source Code Documentation
|
A better implementation of the UNIX ctype(3) library. More...
#include <sys/types.h>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <deque>
#include "mysql/attribute.h"
#include "mysql/my_loglevel.h"
#include "mysql/strings/api.h"
#include "template_utils.h"
Go to the source code of this file.
Classes | |
struct | MY_UNICASE_CHARACTER |
struct | MY_UNICASE_INFO |
struct | MY_UNI_CTYPE |
struct | MY_UNI_IDX |
struct | my_match_t |
struct | MY_CHARSET_ERRMSG |
Helper structure to return error messages from collation parser/initializer. More... | |
class | MY_CHARSET_LOADER |
User-specified callback interface for collation parser/initializer. More... | |
struct | MY_COLLATION_HANDLER |
struct | MY_CHARSET_HANDLER |
struct | CHARSET_INFO |
Typedefs | |
typedef int | myf |
typedef unsigned long | my_wc_t |
Our own version of wchar_t, ie., a type that holds a single Unicode code point ("wide character"). More... | |
typedef int(* | my_charset_conv_mb_wc) (const CHARSET_INFO *, my_wc_t *, const uint8_t *, const uint8_t *) |
typedef int(* | my_charset_conv_wc_mb) (const CHARSET_INFO *, my_wc_t, uint8_t *, uint8_t *) |
typedef size_t(* | my_charset_conv_case) (const CHARSET_INFO *, char *, size_t, char *, size_t) |
Enumerations | |
enum | Pad_attribute { PAD_SPACE , NO_PAD } |
Functions | |
static void | MY_PUT_MB2 (unsigned char *s, uint16_t code) |
MYSQL_STRINGS_EXPORT int | my_wildcmp_mb_bin (const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many) |
MYSQL_STRINGS_EXPORT size_t | my_strcspn (const CHARSET_INFO *cs, const char *str, const char *end, const char *reject, size_t reject_length) |
Calculate the length of the initial segment of 'str' which consists entirely of characters not in 'reject'. More... | |
MYSQL_STRINGS_EXPORT unsigned | my_string_repertoire (const CHARSET_INFO *cs, const char *str, size_t len) |
MYSQL_STRINGS_EXPORT bool | my_charset_is_ascii_based (const CHARSET_INFO *cs) |
Detect whether a character set is ASCII compatible. More... | |
bool | my_charset_same (const CHARSET_INFO *cs1, const CHARSET_INFO *cs2) |
MYSQL_STRINGS_EXPORT unsigned | my_charset_repertoire (const CHARSET_INFO *cs) |
MYSQL_STRINGS_EXPORT unsigned | my_strxfrm_flag_normalize (unsigned flags) |
MYSQL_STRINGS_EXPORT size_t | my_convert (char *to, size_t to_length, const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs, unsigned *errors) |
Convert a string between two character sets. More... | |
MYSQL_STRINGS_EXPORT unsigned | my_mbcharlen_ptr (const CHARSET_INFO *cs, const char *s, const char *e) |
Get the length of the first code in given sequence of chars. More... | |
MYSQL_STRINGS_EXPORT bool | my_is_prefixidx_cand (const CHARSET_INFO *cs, const char *wildstr, const char *wildend, int escape, int w_many, size_t *prefix_len) |
Identify whether given like pattern looks like a prefix pattern, which can become candidate for index only scan on prefix indexes. More... | |
bool | my_isascii (char ch) |
char | my_toupper (const CHARSET_INFO *cs, char ch) |
char | my_tolower (const CHARSET_INFO *cs, char ch) |
bool | my_isalpha (const CHARSET_INFO *cs, char ch) |
bool | my_isupper (const CHARSET_INFO *cs, char ch) |
bool | my_islower (const CHARSET_INFO *cs, char ch) |
bool | my_isdigit (const CHARSET_INFO *cs, char ch) |
bool | my_isxdigit (const CHARSET_INFO *cs, char ch) |
bool | my_isalnum (const CHARSET_INFO *cs, char ch) |
bool | my_isspace (const CHARSET_INFO *cs, char ch) |
bool | my_ispunct (const CHARSET_INFO *cs, char ch) |
bool | my_isgraph (const CHARSET_INFO *cs, char ch) |
bool | my_iscntrl (const CHARSET_INFO *cs, char ch) |
bool | my_isvar (const CHARSET_INFO *cs, char ch) |
bool | my_isvar_start (const CHARSET_INFO *cs, char ch) |
bool | my_binary_compare (const CHARSET_INFO *cs) |
bool | use_strnxfrm (const CHARSET_INFO *cs) |
size_t | my_strnxfrm (const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, const uint8_t *src, size_t srclen) |
int | my_strnncoll (const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length) |
bool | my_like_range (const CHARSET_INFO *cs, const char *s, size_t s_length, char w_prefix, char w_one, char w_many, size_t res_length, char *min_str, char *max_str, size_t *min_len, size_t *max_len) |
int | my_wildcmp (const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many) |
int | my_strcasecmp (const CHARSET_INFO *cs, const char *s1, const char *s2) |
size_t | my_charpos (const CHARSET_INFO *cs, const char *beg, const char *end, size_t pos) |
size_t | my_charpos (const CHARSET_INFO *cs, const unsigned char *beg, const unsigned char *end, size_t pos) |
bool | use_mb (const CHARSET_INFO *cs) |
unsigned | my_ismbchar (const CHARSET_INFO *cs, const char *str, const char *strend) |
unsigned | my_ismbchar (const CHARSET_INFO *cs, const uint8_t *str, const uint8_t *strend) |
unsigned | my_mbcharlen (const CHARSET_INFO *cs, unsigned first_byte) |
unsigned | my_mbcharlen_2 (const CHARSET_INFO *cs, uint8_t first_byte, uint8_t second_byte) |
Get the length of gb18030 code by the given two leading bytes. More... | |
unsigned | my_mbmaxlenlen (const CHARSET_INFO *cs) |
Get the maximum length of leading bytes needed to determine the length of a multi-byte gb18030 code. More... | |
bool | my_ismb1st (const CHARSET_INFO *cs, unsigned leading_byte) |
Judge if the given byte is a possible leading byte for a charset. More... | |
size_t | my_caseup_str (const CHARSET_INFO *cs, char *str) |
size_t | my_casedn_str (const CHARSET_INFO *cs, char *str) |
long | my_strntol (const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err) |
unsigned long | my_strntoul (const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err) |
int64_t | my_strntoll (const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err) |
uint64_t | my_strntoull (const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err) |
double | my_strntod (const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err) |
bool | is_supported_parser_charset (const CHARSET_INFO *cs) |
Variables | |
constexpr int | MY_CS_NAME_SIZE = 32 |
constexpr const char * | CHARSET_DIR = "charsets/" |
static constexpr int | MY_CS_ILSEQ = 0 |
static constexpr int | MY_CS_ILUNI = 0 |
static constexpr int | MY_CS_TOOSMALL = -101 |
static constexpr int | MY_CS_TOOSMALL2 = -102 |
static constexpr int | MY_CS_TOOSMALL3 = -103 |
static constexpr int | MY_CS_TOOSMALL4 = -104 |
static constexpr int | MY_CS_TOOSMALL5 = -105 |
static constexpr int | MY_CS_TOOSMALL6 = -106 |
static constexpr int | MY_SEQ_INTTAIL = 1 |
static constexpr int | MY_SEQ_SPACES = 2 |
static constexpr uint32_t | MY_CHARSET_UNDEFINED = 0 |
static constexpr uint32_t | MY_CS_COMPILED = 1 << 0 |
static constexpr uint32_t | MY_CS_CONFIG_UNUSED = 1 << 1 |
static constexpr uint32_t | MY_CS_INDEX_UNUSED = 1 << 2 |
static constexpr uint32_t | MY_CS_LOADED = 1 << 3 |
static constexpr uint32_t | MY_CS_BINSORT = 1 << 4 |
static constexpr uint32_t | MY_CS_PRIMARY = 1 << 5 |
static constexpr uint32_t | MY_CS_STRNXFRM = 1 << 6 |
static constexpr uint32_t | MY_CS_UNICODE = 1 << 7 |
static constexpr uint32_t | MY_CS_READY = 1 << 8 |
static constexpr uint32_t | MY_CS_AVAILABLE = 1 << 9 |
static constexpr uint32_t | MY_CS_CSSORT = 1 << 10 |
static constexpr uint32_t | MY_CS_HIDDEN = 1 << 11 |
static constexpr uint32_t | MY_CS_PUREASCII = 1 << 12 |
static constexpr uint32_t | MY_CS_NONASCII = 1 << 13 |
static constexpr uint32_t | MY_CS_UNICODE_SUPPLEMENT = 1 << 14 |
static constexpr uint32_t | MY_CS_LOWER_SORT = 1 << 15 |
static constexpr uint32_t | MY_CS_INLINE = 1 << 16 |
static constexpr uint32_t | MY_REPERTOIRE_ASCII = 1 |
static constexpr uint32_t | MY_REPERTOIRE_EXTENDED = 2 |
static constexpr uint32_t | MY_REPERTOIRE_UNICODE30 = 3 |
static constexpr uint32_t | MY_STRXFRM_PAD_TO_MAXLEN = 0x00000080 |
MYSQL_STRINGS_EXPORT int(* | my_string_stack_guard )(int) |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_bin |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_latin1 |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_filename |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb4_0900_ai_ci |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb4_0900_bin |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_latin1_bin |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf32_unicode_ci |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb3_general_ci |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb3_tolower_ci |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb3_unicode_ci |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb3_bin |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb4_bin |
MYSQL_STRINGS_EXPORT CHARSET_INFO | my_charset_utf8mb4_general_ci |
static constexpr uint8_t | MY_CHAR_U = 01 |
static constexpr uint8_t | MY_CHAR_L = 02 |
static constexpr uint8_t | MY_CHAR_NMR = 04 |
static constexpr uint8_t | MY_CHAR_SPC = 010 |
static constexpr uint8_t | MY_CHAR_PNT = 020 |
static constexpr uint8_t | MY_CHAR_CTR = 040 |
static constexpr uint8_t | MY_CHAR_B = 0100 |
static constexpr uint8_t | MY_CHAR_X = 0200 |
A better implementation of the UNIX ctype(3) library.
typedef size_t(* my_charset_conv_case) (const CHARSET_INFO *, char *, size_t, char *, size_t) |
typedef int(* my_charset_conv_mb_wc) (const CHARSET_INFO *, my_wc_t *, const uint8_t *, const uint8_t *) |
typedef int(* my_charset_conv_wc_mb) (const CHARSET_INFO *, my_wc_t, uint8_t *, uint8_t *) |
typedef unsigned long my_wc_t |
Our own version of wchar_t, ie., a type that holds a single Unicode code point ("wide character").
unsigned long is always big enough to hold any character in the BMP.
typedef int myf |
enum Pad_attribute |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Detect whether a character set is ASCII compatible.
MYSQL_STRINGS_EXPORT unsigned my_charset_repertoire | ( | const CHARSET_INFO * | cs | ) |
|
inline |
MYSQL_STRINGS_EXPORT size_t my_convert | ( | char * | to, |
size_t | to_length, | ||
const CHARSET_INFO * | to_cs, | ||
const char * | from, | ||
size_t | from_length, | ||
const CHARSET_INFO * | from_cs, | ||
unsigned * | errors | ||
) |
Convert a string between two character sets.
Optimized for quick copying of ASCII characters in the range 0x00..0x7F. 'to' must be large enough to store (form_length * to_cs->mbmaxlen) bytes.
[out] | to | Store result here |
to_length | Size of "to" buffer | |
to_cs | Character set of result string | |
from | Copy from here | |
from_length | Length of the "from" string | |
from_cs | Character set of the "from" string | |
[out] | errors | Number of conversion errors |
MYSQL_STRINGS_EXPORT bool my_is_prefixidx_cand | ( | const CHARSET_INFO * | cs, |
const char * | wildstr, | ||
const char * | wildend, | ||
int | escape, | ||
int | w_many, | ||
size_t * | prefix_len | ||
) |
Identify whether given like pattern looks like a prefix pattern, which can become candidate for index only scan on prefix indexes.
cs | Character set and collation pointer | |
wildstr | Pointer to LIKE pattern. | |
wildend | Pointer to end of LIKE pattern. | |
escape | Escape character pattern, typically '\'. | |
w_many | 'Many characters' pattern, typically ''. | |
[out] | prefix_len | Length of LIKE pattern. |
TRUE | if LIKE pattern can be used for prefix index only scan. |
FALSE | else. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Judge if the given byte is a possible leading byte for a charset.
For gb18030 whose mbmaxlenlen is 2, we can't determine the length of a multi-byte character by looking at the first byte only
[in] | cs | charset_info |
[in] | leading_byte | possible leading byte |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the length of gb18030 code by the given two leading bytes.
[in] | cs | charset_info |
[in] | first_byte | first byte of gb18030 code |
[in] | second_byte | second byte of gb18030 code |
MYSQL_STRINGS_EXPORT unsigned my_mbcharlen_ptr | ( | const CHARSET_INFO * | cs, |
const char * | s, | ||
const char * | e | ||
) |
Get the length of the first code in given sequence of chars.
This func is introduced because we can't determine the length by checking the first byte only for gb18030, so we first try my_mbcharlen, and then my_mbcharlen_2 if necessary to get the length
[in] | cs | charset_info |
[in] | s | start of the char sequence |
[in] | e | end of the char sequence |
|
inline |
Get the maximum length of leading bytes needed to determine the length of a multi-byte gb18030 code.
[in] | cs | charset_info |
|
inlinestatic |
|
inline |
MYSQL_STRINGS_EXPORT size_t my_strcspn | ( | const CHARSET_INFO * | cs, |
const char * | str, | ||
const char * | str_end, | ||
const char * | reject, | ||
size_t | reject_length | ||
) |
Calculate the length of the initial segment of 'str' which consists entirely of characters not in 'reject'.
cs | Pointer to charset info. |
str | Pointer to multi-byte string. |
str_end | Pointer to end of multi-byte string. |
reject | Pointer to start of single-byte reject string. |
reject_length | Length of single-byte reject string. |
MYSQL_STRINGS_EXPORT unsigned my_string_repertoire | ( | const CHARSET_INFO * | cs, |
const char * | str, | ||
size_t | len | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
MYSQL_STRINGS_EXPORT unsigned my_strxfrm_flag_normalize | ( | unsigned | flags | ) |
|
inline |
|
inline |
|
inline |
MYSQL_STRINGS_EXPORT int my_wildcmp_mb_bin | ( | const CHARSET_INFO * | cs, |
const char * | str, | ||
const char * | str_end, | ||
const char * | wildstr, | ||
const char * | wildend, | ||
int | escape, | ||
int | w_one, | ||
int | w_many | ||
) |
|
inline |
|
inline |
|
constexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
extern |
|
extern |
|
extern |
|
extern |
|
staticconstexpr |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
constexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
extern |
|
staticconstexpr |