MySQL 8.4.2
Source Code Documentation
ctype-bin.cc File Reference

The “binary” pseudo-charset. More...

#include <algorithm>
#include <cstdint>
#include <cstring>
#include "m_string.h"
#include "my_compiler.h"
#include "mysql/strings/m_ctype.h"
#include "strings/m_ctype_internals.h"
#include "template_utils.h"

Macros

#define likeconv(s, A)   (A)
 
#define INC_PTR(cs, A, B)   (A)++
 

Functions

static bool my_coll_init_8bit_bin (CHARSET_INFO *cs, MY_CHARSET_LOADER *, MY_CHARSET_ERRMSG *)
 
static int my_strnncoll_binary (const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
 
static size_t my_lengthsp_binary (const CHARSET_INFO *cs, const char *ptr, size_t length)
 
static int my_strnncollsp_binary (const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen)
 
static int my_strnncoll_8bit_bin (const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
 
static int my_strnncollsp_8bit_bin (const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
 
static size_t my_case_str_bin (const CHARSET_INFO *cs, char *str)
 
static size_t my_case_bin (const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
 
static int my_strcasecmp_bin (const CHARSET_INFO *cs, const char *s, const char *t)
 
unsigned my_mbcharlen_8bit (const CHARSET_INFO *cs, unsigned c)
 
static int my_mb_wc_bin (const CHARSET_INFO *cs, my_wc_t *wc, const uint8_t *str, const uint8_t *end)
 
static int my_wc_mb_bin (const CHARSET_INFO *cs, my_wc_t wc, uint8_t *s, uint8_t *e)
 
static void my_hash_sort_8bit_bin (const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
 
static void my_hash_sort_bin (const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
 
static int my_wildcmp_bin_impl (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 recurse_level)
 
int my_wildcmp_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)
 
static size_t my_strnxfrm_8bit_bin_pad_space (const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
 
static size_t my_strnxfrm_8bit_bin_no_pad (const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
 
static unsigned my_instr_bin (const CHARSET_INFO *cs, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
 

Variables

static const uint8_t ctype_bin []
 
static const uint8_t bin_char_array []
 
MY_COLLATION_HANDLER my_collation_8bit_bin_handler
 
static MY_COLLATION_HANDLER my_collation_binary_handler
 
static MY_CHARSET_HANDLER my_charset_handler
 
CHARSET_INFO my_charset_bin
 

Detailed Description

The “binary” pseudo-charset.

binary is special in that it's not really a character set; conversions from another charset to binary means “erase the charset information” and conversions from binary to another charset means “interpret these bytes as the destination charset”. In other words, in no event are the bytes changed; you can think of binary as the charset equivalent of void * that you can cast through. Needless to say, this also means that using it can be rather dangerous.

Macro Definition Documentation

◆ INC_PTR

#define INC_PTR (   cs,
  A,
 
)    (A)++

◆ likeconv

#define likeconv (   s,
 
)    (A)

Function Documentation

◆ my_case_bin()

static size_t my_case_bin ( const CHARSET_INFO cs,
char *  src,
size_t  srclen,
char *  dst,
size_t  dstlen 
)
static

◆ my_case_str_bin()

static size_t my_case_str_bin ( const CHARSET_INFO cs,
char *  str 
)
static

◆ my_coll_init_8bit_bin()

static bool my_coll_init_8bit_bin ( CHARSET_INFO cs,
MY_CHARSET_LOADER ,
MY_CHARSET_ERRMSG  
)
static

◆ my_hash_sort_8bit_bin()

static void my_hash_sort_8bit_bin ( const CHARSET_INFO cs,
const uint8_t *  key,
size_t  len,
uint64_t *  nr1,
uint64_t *  nr2 
)
static

◆ my_hash_sort_bin()

static void my_hash_sort_bin ( const CHARSET_INFO cs,
const uint8_t *  key,
size_t  len,
uint64_t *  nr1,
uint64_t *  nr2 
)
static

◆ my_instr_bin()

static unsigned my_instr_bin ( const CHARSET_INFO cs,
const char *  b,
size_t  b_length,
const char *  s,
size_t  s_length,
my_match_t match,
unsigned  nmatch 
)
static

◆ my_lengthsp_binary()

static size_t my_lengthsp_binary ( const CHARSET_INFO cs,
const char *  ptr,
size_t  length 
)
static

◆ my_mb_wc_bin()

static int my_mb_wc_bin ( const CHARSET_INFO cs,
my_wc_t wc,
const uint8_t *  str,
const uint8_t *  end 
)
static

◆ my_mbcharlen_8bit()

unsigned my_mbcharlen_8bit ( const CHARSET_INFO cs,
unsigned  c 
)

◆ my_strcasecmp_bin()

static int my_strcasecmp_bin ( const CHARSET_INFO cs,
const char *  s,
const char *  t 
)
static

◆ my_strnncoll_8bit_bin()

static int my_strnncoll_8bit_bin ( const CHARSET_INFO cs,
const uint8_t *  s,
size_t  slen,
const uint8_t *  t,
size_t  tlen,
bool  t_is_prefix 
)
static

◆ my_strnncoll_binary()

static int my_strnncoll_binary ( const CHARSET_INFO cs,
const uint8_t *  s,
size_t  slen,
const uint8_t *  t,
size_t  tlen,
bool  t_is_prefix 
)
static

◆ my_strnncollsp_8bit_bin()

static int my_strnncollsp_8bit_bin ( const CHARSET_INFO cs,
const uint8_t *  a,
size_t  a_length,
const uint8_t *  b,
size_t  b_length 
)
static

◆ my_strnncollsp_binary()

static int my_strnncollsp_binary ( const CHARSET_INFO cs,
const uint8_t *  s,
size_t  slen,
const uint8_t *  t,
size_t  tlen 
)
static

◆ my_strnxfrm_8bit_bin_no_pad()

static size_t my_strnxfrm_8bit_bin_no_pad ( const CHARSET_INFO cs,
uint8_t *  dst,
size_t  dstlen,
unsigned  nweights,
const uint8_t *  src,
size_t  srclen,
unsigned  flags 
)
static

◆ my_strnxfrm_8bit_bin_pad_space()

static size_t my_strnxfrm_8bit_bin_pad_space ( const CHARSET_INFO cs,
uint8_t *  dst,
size_t  dstlen,
unsigned  nweights,
const uint8_t *  src,
size_t  srclen,
unsigned  flags 
)
static

◆ my_wc_mb_bin()

static int my_wc_mb_bin ( const CHARSET_INFO cs,
my_wc_t  wc,
uint8_t *  s,
uint8_t *  e 
)
static

◆ my_wildcmp_bin()

int my_wildcmp_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 
)

◆ my_wildcmp_bin_impl()

static int my_wildcmp_bin_impl ( 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  recurse_level 
)
static

Variable Documentation

◆ bin_char_array

const uint8_t bin_char_array[]
static
Initial value:
= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255}

◆ ctype_bin

const uint8_t ctype_bin[]
static
Initial value:
= {
0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 16, 16, 16, 16, 16,
16, 16, 129, 129, 129, 129, 129, 129, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16,
16, 16, 130, 130, 130, 130, 130, 130, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16,
32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
}

◆ my_charset_bin

CHARSET_INFO my_charset_bin

◆ my_charset_handler

MY_CHARSET_HANDLER my_charset_handler
static
Initial value:
= {
nullptr,
nullptr,
unsigned my_mbcharlen_8bit(const CHARSET_INFO *cs, unsigned c)
Definition: ctype-bin.cc:224
static size_t my_case_bin(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-bin.cc:211
static size_t my_lengthsp_binary(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-bin.cc:109
static int my_mb_wc_bin(const CHARSET_INFO *cs, my_wc_t *wc, const uint8_t *str, const uint8_t *end)
Definition: ctype-bin.cc:230
static size_t my_case_str_bin(const CHARSET_INFO *cs, char *str)
Definition: ctype-bin.cc:206
static int my_wc_mb_bin(const CHARSET_INFO *cs, my_wc_t wc, uint8_t *s, uint8_t *e)
Definition: ctype-bin.cc:238
size_t my_numcells_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:908
long long my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1125
unsigned long long my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_flag, const char **endptr, int *error)
Definition: ctype-simple.cc:1221
double my_strntod_8bit(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: ctype-simple.cc:636
size_t my_numchars_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:903
long long my_strntoll_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:461
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long long val)
Definition: ctype-simple.cc:686
size_t my_long10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long int val)
Definition: ctype-simple.cc:650
unsigned long long my_strntoull_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:539
size_t my_snprintf_8bit(const CHARSET_INFO *cs, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:278
void my_fill_8bit(const CHARSET_INFO *cs, char *s, size_t l, int fill)
Definition: ctype-simple.cc:898
unsigned long my_strntoul_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:389
size_t my_charpos_8bit(const CHARSET_INFO *cs, const char *b, const char *e, size_t pos)
Definition: ctype-simple.cc:913
int my_mb_ctype_8bit(const CHARSET_INFO *cs, int *ctype, const uint8_t *s, const uint8_t *e)
Definition: ctype-simple.cc:1130
size_t my_well_formed_len_8bit(const CHARSET_INFO *cs, const char *start, const char *end, size_t nchars, int *error)
Definition: ctype-simple.cc:919
long my_strntol_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:311
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *str, const char *end, int sq)
Definition: ctype-simple.cc:876

◆ my_collation_8bit_bin_handler

MY_COLLATION_HANDLER my_collation_8bit_bin_handler
Initial value:
= {
nullptr,
static size_t my_strnxfrm_8bit_bin_pad_space(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
Definition: ctype-bin.cc:373
static int my_strnncoll_8bit_bin(const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
Definition: ctype-bin.cc:144
int my_wildcmp_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)
Definition: ctype-bin.cc:365
static unsigned my_instr_bin(const CHARSET_INFO *cs, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
Definition: ctype-bin.cc:400
static bool my_coll_init_8bit_bin(CHARSET_INFO *cs, MY_CHARSET_LOADER *, MY_CHARSET_ERRMSG *)
Definition: ctype-bin.cc:95
static void my_hash_sort_8bit_bin(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Definition: ctype-bin.cc:251
static int my_strcasecmp_bin(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-bin.cc:218
static int my_strnncollsp_8bit_bin(const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
Definition: ctype-bin.cc:175
bool my_like_range_simple(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, char escape, char w_one, char w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length)
Definition: ctype-simple.cc:833
bool my_propagate_simple(const CHARSET_INFO *cs, const uint8_t *str, size_t length)
Definition: ctype-simple.cc:1474
size_t my_strnxfrmlen_simple(const CHARSET_INFO *cs, size_t len)
Definition: ctype-simple.cc:62

◆ my_collation_binary_handler

MY_COLLATION_HANDLER my_collation_binary_handler
static
Initial value:
= {
nullptr,
nullptr,
static size_t my_strnxfrm_8bit_bin_no_pad(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
Definition: ctype-bin.cc:385
static int my_strnncoll_binary(const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
Definition: ctype-bin.cc:101
static void my_hash_sort_bin(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Definition: ctype-bin.cc:275
static int my_strnncollsp_binary(const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen)
Definition: ctype-bin.cc:139