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

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

#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include "m_ctype.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "my_macros.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 *loader)
 
static int my_strnncoll_binary (const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *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 uchar *s, size_t slen, const uchar *t, size_t tlen)
 
static int my_strnncoll_8bit_bin (const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
 
static int my_strnncollsp_8bit_bin (const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *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)
 
uint my_mbcharlen_8bit (const CHARSET_INFO *cs, uint c)
 
static int my_mb_wc_bin (const CHARSET_INFO *cs, my_wc_t *wc, const uchar *str, const uchar *end)
 
static int my_wc_mb_bin (const CHARSET_INFO *cs, my_wc_t wc, uchar *s, uchar *e)
 
static void my_hash_sort_8bit_bin (const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
 
static void my_hash_sort_bin (const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *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, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
 
static size_t my_strnxfrm_8bit_bin_no_pad (const CHARSET_INFO *cs, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
 
static uint 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, uint nmatch)
 

Variables

static const uchar ctype_bin []
 
static const uchar 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 loader 
)
static

◆ my_hash_sort_8bit_bin()

static void my_hash_sort_8bit_bin ( const CHARSET_INFO cs,
const uchar key,
size_t  len,
uint64 nr1,
uint64 nr2 
)
static

◆ my_hash_sort_bin()

static void my_hash_sort_bin ( const CHARSET_INFO cs,
const uchar key,
size_t  len,
uint64 nr1,
uint64 nr2 
)
static

◆ my_instr_bin()

static uint 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,
uint  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 uchar str,
const uchar end 
)
static

◆ my_mbcharlen_8bit()

uint my_mbcharlen_8bit ( const CHARSET_INFO cs,
uint  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 uchar s,
size_t  slen,
const uchar t,
size_t  tlen,
bool  t_is_prefix 
)
static

◆ my_strnncoll_binary()

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

◆ my_strnncollsp_8bit_bin()

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

◆ my_strnncollsp_binary()

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

◆ my_strnxfrm_8bit_bin_no_pad()

static size_t my_strnxfrm_8bit_bin_no_pad ( const CHARSET_INFO cs,
uchar dst,
size_t  dstlen,
uint  nweights,
const uchar src,
size_t  srclen,
uint  flags 
)
static

◆ my_strnxfrm_8bit_bin_pad_space()

static size_t my_strnxfrm_8bit_bin_pad_space ( const CHARSET_INFO cs,
uchar dst,
size_t  dstlen,
uint  nweights,
const uchar src,
size_t  srclen,
uint  flags 
)
static

◆ my_wc_mb_bin()

static int my_wc_mb_bin ( const CHARSET_INFO cs,
my_wc_t  wc,
uchar s,
uchar 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 uchar 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 uchar 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,
uint my_mbcharlen_8bit(const CHARSET_INFO *cs, uint c)
Definition: ctype-bin.cc:227
static int my_mb_wc_bin(const CHARSET_INFO *cs, my_wc_t *wc, const uchar *str, const uchar *end)
Definition: ctype-bin.cc:233
static size_t my_case_bin(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-bin.cc:214
static size_t my_lengthsp_binary(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-bin.cc:110
static size_t my_case_str_bin(const CHARSET_INFO *cs, char *str)
Definition: ctype-bin.cc:209
static int my_wc_mb_bin(const CHARSET_INFO *cs, my_wc_t wc, uchar *s, uchar *e)
Definition: ctype-bin.cc:241
double my_strntod_8bit(const CHARSET_INFO *, const char *s, size_t l, const char **e, int *err)
Definition: ctype-simple.cc:646
size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e)
Definition: ctype-simple.cc:912
size_t my_snprintf_8bit(const CHARSET_INFO *, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:281
ulonglong my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, const char **endptr, int *error)
Definition: ctype-simple.cc:1235
size_t my_well_formed_len_8bit(const CHARSET_INFO *, const char *b, const char *e, size_t pos, int *error)
Definition: ctype-simple.cc:928
ulong my_strntoul_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: ctype-simple.cc:397
void my_fill_8bit(const CHARSET_INFO *cs, char *to, size_t l, int fill)
Definition: ctype-simple.cc:907
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l, int radix, longlong val)
Definition: ctype-simple.cc:695
int my_mb_ctype_8bit(const CHARSET_INFO *, int *, const uchar *, const uchar *)
Definition: ctype-simple.cc:1144
long my_strntol_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: ctype-simple.cc:318
longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1139
size_t my_numcells_8bit(const CHARSET_INFO *, const char *b, const char *e)
Definition: ctype-simple.cc:917
size_t my_long10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l, int radix, long int val)
Definition: ctype-simple.cc:659
ulonglong my_strntoull_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: ctype-simple.cc:549
size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e, size_t pos)
Definition: ctype-simple.cc:922
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e, int sq)
Definition: ctype-simple.cc:885
longlong my_strntoll_8bit(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: ctype-simple.cc:470

◆ my_collation_8bit_bin_handler

MY_COLLATION_HANDLER my_collation_8bit_bin_handler
Initial value:
= {
nullptr,
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:370
static uint 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, uint nmatch)
Definition: ctype-bin.cc:404
static void my_hash_sort_8bit_bin(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Definition: ctype-bin.cc:254
static bool my_coll_init_8bit_bin(CHARSET_INFO *cs, MY_CHARSET_LOADER *loader)
Definition: ctype-bin.cc:96
static int my_strnncoll_8bit_bin(const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
Definition: ctype-bin.cc:145
static int my_strcasecmp_bin(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-bin.cc:221
static int my_strnncollsp_8bit_bin(const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length)
Definition: ctype-bin.cc:175
static size_t my_strnxfrm_8bit_bin_pad_space(const CHARSET_INFO *cs, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-bin.cc:378
size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t)
Definition: ctype-simple.cc:64
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:842
bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t len)
Definition: ctype-simple.cc:1484

◆ 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, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-bin.cc:389
static int my_strnncoll_binary(const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
Definition: ctype-bin.cc:102
static void my_hash_sort_bin(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Definition: ctype-bin.cc:279
static int my_strnncollsp_binary(const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen)
Definition: ctype-bin.cc:140