MySQL 8.0.39
Source Code Documentation
m_ctype.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef M_CTYPE_INCLUDED
25#define M_CTYPE_INCLUDED
26
27/**
28 @file include/m_ctype.h
29 A better implementation of the UNIX ctype(3) library.
30*/
31
32#include <stddef.h>
33#include <sys/types.h>
34#include <cassert>
35#include <cstdint>
36#include <cstring>
37
38#include "my_compiler.h"
39#include "my_inttypes.h"
40#include "my_loglevel.h"
41#include "my_macros.h"
42#include "my_sharedlib.h"
43#include "template_utils.h"
44
45#define MY_CS_NAME_SIZE 32
46#define MY_CS_CTYPE_TABLE_SIZE 257
47#define MY_CS_TO_LOWER_TABLE_SIZE 256
48#define MY_CS_TO_UPPER_TABLE_SIZE 256
49#define MY_CS_SORT_ORDER_TABLE_SIZE 256
50#define MY_CS_TO_UNI_TABLE_SIZE 256
51
52#define CHARSET_DIR "charsets/"
53
54/**
55 Our own version of wchar_t, ie., a type that holds a single Unicode code point
56 ("wide character"). ulong is always big enough to hold any character
57 in the BMP.
58*/
59typedef ulong my_wc_t;
60
61#define MY_CS_REPLACEMENT_CHARACTER 0xFFFD
62
63static inline void MY_PUT_MB2(unsigned char *s, uint16 code) {
64 s[0] = code >> 8;
65 s[1] = code & 0xFF;
66}
67
68typedef struct MY_UNICASE_CHARACTER {
73
74typedef struct MY_UNICASE_INFO {
78
83
84struct MY_UCA_INFO;
85
86typedef struct MY_UNI_CTYPE {
90
91extern MY_UNI_CTYPE my_uni_ctype[256];
92
93/* wm_wc and wc_mb return codes */
94#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
95#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
96#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
97#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
98#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
99/* These following three are currently not really used */
100#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
101#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
102#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
103/* A helper macros for "need at least n bytes" */
104#define MY_CS_TOOSMALLN(n) (-100 - (n))
105
106#define MY_SEQ_INTTAIL 1
107#define MY_SEQ_SPACES 2
108
109/* CHARSET_INFO::state flags */
110/* clang-format off */
111static constexpr uint32_t
112 MY_CHARSET_UNDEFINED = 0; // for unit testing
113static constexpr uint32_t
114 MY_CS_COMPILED = 1 << 0; // compiled-in charsets
115static constexpr uint32_t
116 MY_CS_CONFIG_UNUSED = 1 << 1; // unused bitmask
117static constexpr uint32_t
118 MY_CS_INDEX_UNUSED = 1 << 2; // unused bitmask
119static constexpr uint32_t
120 MY_CS_LOADED = 1 << 3; // charsets that are currently loaded
121static constexpr uint32_t
122 MY_CS_BINSORT = 1 << 4; // if binary sort order
123static constexpr uint32_t
124 MY_CS_PRIMARY = 1 << 5; // if primary collation
125static constexpr uint32_t
126 MY_CS_STRNXFRM = 1 << 6; // if _not_ set, sort_order will
127 // give same result as strnxfrm --
128 // all new collations should have
129 // this flag set,
130 // do not check it in new code
131static constexpr uint32_t
132 MY_CS_UNICODE = 1 << 7; // if a charset is BMP Unicode
133static constexpr uint32_t
134 MY_CS_READY = 1 << 8; // if a charset is initialized
135static constexpr uint32_t
136 MY_CS_AVAILABLE = 1 << 9; // if either compiled-in or loaded
137static constexpr uint32_t
138 MY_CS_CSSORT = 1 << 10; // if case sensitive sort order
139static constexpr uint32_t
140 MY_CS_HIDDEN = 1 << 11; // don't display in SHOW
141static constexpr uint32_t
142 MY_CS_PUREASCII = 1 << 12; // if a charset is pure ascii
143static constexpr uint32_t
144 MY_CS_NONASCII = 1 << 13; // if not ASCII-compatible
145static constexpr uint32_t
146 MY_CS_UNICODE_SUPPLEMENT = 1 << 14; // Non-BMP Unicode characters
147static constexpr uint32_t
148 MY_CS_LOWER_SORT = 1 << 15; // if use lower case as weight
149/* clang-format on */
150
151/* Character repertoire flags */
152#define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */
153#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
154#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
155
156/* Flags for strxfrm */
157#define MY_STRXFRM_PAD_TO_MAXLEN 0x00000080 /* if pad tail(for filesort) */
158
159typedef struct MY_UNI_IDX {
162 const uchar *tab;
164
165typedef struct {
169} my_match_t;
170
171struct CHARSET_INFO;
173
176 char errarg[192]{};
177
178 virtual ~MY_CHARSET_LOADER() = default;
179
180 // Memory management. By default we use mysys allocation functions.
181 virtual void *once_alloc(size_t);
182 virtual void *mem_malloc(size_t);
183 virtual void *mem_realloc(void *, size_t);
184 virtual void mem_free(void *);
185
186 // Error reporting. By default all warnings/errors are ignored.
187 // Set the global pointer my_charset_error_reporter to override this
188 // behaviour.
189 void reporter(enum loglevel, uint, const char *);
190 void reporter(enum loglevel, uint, int, const char *);
191
192 // Inserts a new charset/collation into the global all_charsets array.
193 virtual int add_collation(CHARSET_INFO *);
194};
195
196extern int (*my_string_stack_guard)(int);
197
199
200/* See strings/CHARSET_INFO.txt for information about this structure */
201typedef struct MY_COLLATION_HANDLER {
204 /* Collation routines */
205 int (*strnncoll)(const CHARSET_INFO *, const uchar *, size_t, const uchar *,
206 size_t, bool);
207 /**
208 Compare the two strings under the pad rules given by the collation.
209
210 Thus, for NO PAD collations, this is identical to strnncoll with is_prefix
211 set to false. For PAD SPACE collations, the two strings are conceptually
212 extended infinitely at the end using space characters (0x20) and then
213 compared under the collation's normal comparison rules, so that e.g 'a' is
214 equal to 'a '.
215 */
216 int (*strnncollsp)(const CHARSET_INFO *, const uchar *, size_t, const uchar *,
217 size_t);
218 /**
219 Transform the string into a form such that memcmp() between transformed
220 strings yields the correct collation order.
221
222 @param [out] dst Buffer for the transformed string.
223 @param [out] dstlen Number of bytes available in dstlen.
224 Must be even.
225 @param num_codepoints Treat the string as if it were of type
226 CHAR(num_codepoints). In particular, this means that if the
227 collation is a pad collation (pad_attribute is PAD_SPACE) and
228 string has fewer than "num_codepoints" codepoints, the string
229 will be transformed as if it ended in (num_codepoints-n) extra spaces.
230 If the string has more than "num_codepoints" codepoints,
231 behavior is undefined; may truncate, may crash, or do something
232 else entirely. Note that MY_STRXFRM_PAD_TO_MAXLEN overrides this;
233 if it is given for a PAD SPACE collation, this value is taken to be
234 effectively infinity.
235 @param src The source string, in the required character set
236 for the collation.
237 @param srclen Number of bytes in src.
238 @param flags ORed bitmask of MY_STRXFRM_* flags.
239
240 @return Number of bytes written to dst.
241 */
242 size_t (*strnxfrm)(const CHARSET_INFO *, uchar *dst, size_t dstlen,
243 uint num_codepoints, const uchar *src, size_t srclen,
244 uint flags);
245
246 /**
247 Return the maximum number of output bytes needed for strnxfrm()
248 to output all weights for any string of the given input length.
249 You can use this to e.g. size buffers for sort keys.
250
251 @param num_bytes Number of bytes in the input string. Note that for
252 multibyte character sets, this _must_ be a pessimistic estimate,
253 ie., one that's cs->mbmaxlen * max_num_codepoints. So for e.g.
254 the utf8mb4 string "foo", you will need to give in 12, not 3.
255 */
256 size_t (*strnxfrmlen)(const CHARSET_INFO *, size_t num_bytes);
257 bool (*like_range)(const CHARSET_INFO *, const char *s, size_t s_length,
258 char w_prefix, char w_one, char w_many, size_t res_length,
259 char *min_str, char *max_str, size_t *min_len,
260 size_t *max_len);
261 int (*wildcmp)(const CHARSET_INFO *, const char *str, const char *str_end,
262 const char *wildstr, const char *wildend, int escape,
263 int w_one, int w_many);
264
265 int (*strcasecmp)(const CHARSET_INFO *, const char *, const char *);
266
267 uint (*strstr)(const CHARSET_INFO *, const char *b, size_t b_length,
268 const char *s, size_t s_length, my_match_t *match,
269 uint nmatch);
270
271 /**
272 Compute a sort hash for the given key. This hash must preserve equality
273 under the given collation, so that a=b => H(a)=H(b). Note that this hash
274 is used for hash-based partitioning (PARTITION KEY), so you cannot change
275 it except when writing a new collation; it needs to be unchanged across
276 releases, so that the on-disk format does not change. (It is also used
277 for testing equality in the MEMORY storage engine.)
278
279 nr1 and nr2 are both in/out parameters. nr1 is the actual hash value;
280 nr2 holds extra state between invocations.
281 */
282 void (*hash_sort)(const CHARSET_INFO *cs, const uchar *key, size_t len,
283 uint64 *nr1, uint64 *nr2);
284 bool (*propagate)(const CHARSET_INFO *cs, const uchar *str, size_t len);
286
291
292/* Some typedef to make it easy for C++ to make function pointers */
294 const uchar *, const uchar *);
296 uchar *);
297typedef size_t (*my_charset_conv_case)(const CHARSET_INFO *, char *, size_t,
298 char *, size_t);
299
300/* See strings/CHARSET_INFO.txt about information on this structure */
301typedef struct MY_CHARSET_HANDLER {
303 /* Multibyte routines */
304 uint (*ismbchar)(const CHARSET_INFO *, const char *, const char *);
306 size_t (*numchars)(const CHARSET_INFO *, const char *b, const char *e);
307
308 /**
309 Return at which byte codepoint number "pos" begins, relative to
310 the start of the string. If the string is shorter than or is
311 exactly "pos" codepoints long, returns a value equal or greater to
312 (e-b).
313 */
314 size_t (*charpos)(const CHARSET_INFO *, const char *b, const char *e,
315 size_t pos);
316 size_t (*well_formed_len)(const CHARSET_INFO *, const char *b, const char *e,
317 size_t nchars, int *error);
318 /**
319 Given a pointer and a length in bytes, returns a new length in bytes where
320 all trailing space characters are stripped. This holds even for NO PAD
321 collations.
322
323 Exception: The "binary" collation, which is used behind-the-scenes to
324 implement the BINARY type (by mapping it to CHAR(n) COLLATE "binary"),
325 returns just the length back with no stripping. It's done that way so that
326 Field_string (implementing CHAR(n)) returns the full padded width on read
327 (as opposed to a normal CHAR, where we usually strip the spaces on read),
328 but it's suboptimal, since lengthsp() is also used in a number of other
329 places, e.g. stripping trailing spaces from enum values given in by the
330 user. If you call this function, be aware of this special exception and
331 consider the implications.
332 */
333 size_t (*lengthsp)(const CHARSET_INFO *, const char *ptr, size_t length);
334 size_t (*numcells)(const CHARSET_INFO *, const char *b, const char *e);
335
336 /* Unicode conversion */
339
340 /* CTYPE scanner */
341 int (*ctype)(const CHARSET_INFO *cs, int *ctype, const uchar *s,
342 const uchar *e);
343
344 /* Functions for case and sort conversion */
345 size_t (*caseup_str)(const CHARSET_INFO *, char *);
346 size_t (*casedn_str)(const CHARSET_INFO *, char *);
347
350
351 /* Charset dependent snprintf() */
352 size_t (*snprintf)(const CHARSET_INFO *, char *to, size_t n, const char *fmt,
353 ...) MY_ATTRIBUTE((format(printf, 4, 5)));
354 size_t (*long10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix,
355 long int val);
356 size_t (*longlong10_to_str)(const CHARSET_INFO *, char *to, size_t n,
357 int radix, longlong val);
358
359 void (*fill)(const CHARSET_INFO *, char *to, size_t len, int fill);
360
361 /* String-to-number conversion routines */
362 long (*strntol)(const CHARSET_INFO *, const char *s, size_t l, int base,
363 const char **e, int *err);
364 ulong (*strntoul)(const CHARSET_INFO *, const char *s, size_t l, int base,
365 const char **e, int *err);
366 longlong (*strntoll)(const CHARSET_INFO *, const char *s, size_t l, int base,
367 const char **e, int *err);
368 ulonglong (*strntoull)(const CHARSET_INFO *, const char *s, size_t l,
369 int base, const char **e, int *err);
370 double (*strntod)(const CHARSET_INFO *, const char *s, size_t l,
371 const char **e, int *err);
372 longlong (*strtoll10)(const CHARSET_INFO *cs, const char *nptr,
373 const char **endptr, int *error);
375 size_t length, int unsigned_fl,
376 const char **endptr, int *error);
377 size_t (*scan)(const CHARSET_INFO *, const char *b, const char *e, int sq);
379
383
384/* See strings/CHARSET_INFO.txt about information on this structure */
390 const char *csname;
391 const char *m_coll_name;
392 const char *comment;
393 const char *tailoring;
395 const uchar *ctype;
399 struct MY_UCA_INFO *uca; /* This can be changed in apply_one_rule() */
403 const struct lex_state_maps_st *state_maps; /* parser internal data */
404 const uchar *ident_map; /* parser internal data */
412 my_wc_t max_sort_char; /* For LIKE optimization */
416
419
420 /**
421 If this collation is PAD_SPACE, it collates as if all inputs were
422 padded with a given number of spaces at the end (see the "num_codepoints"
423 flag to strnxfrm). NO_PAD simply compares unextended strings.
424
425 Note that this is fundamentally about the behavior of coll->strnxfrm.
426 */
428};
429#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
430
431/*
432 NOTE: You cannot use a CHARSET_INFO without it having been initialized first.
433 In particular, they are not initialized when a unit test starts; do not use
434 these globals indiscriminately from there, and do not add more. Instead,
435 load them through a MY_CHARSET_LOADER, using my_collation_get_by_name().
436*/
437
443
452
453/* declarations for simple charsets */
454extern size_t my_strnxfrm_simple(const CHARSET_INFO *, uchar *dst,
455 size_t dstlen, uint nweights, const uchar *src,
456 size_t srclen, uint flags);
457size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t);
458extern int my_strnncoll_simple(const CHARSET_INFO *, const uchar *, size_t,
459 const uchar *, size_t, bool);
460
461extern int my_strnncollsp_simple(const CHARSET_INFO *, const uchar *, size_t,
462 const uchar *, size_t);
463
464extern void my_hash_sort_simple(const CHARSET_INFO *cs, const uchar *key,
465 size_t len, uint64 *nr1, uint64 *nr2);
466
467extern size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr,
468 size_t length);
469
470extern uint my_instr_simple(const CHARSET_INFO *, const char *b,
471 size_t b_length, const char *s, size_t s_length,
472 my_match_t *match, uint nmatch);
473
474/* Functions for 8bit */
475extern size_t my_caseup_str_8bit(const CHARSET_INFO *, char *);
476extern size_t my_casedn_str_8bit(const CHARSET_INFO *, char *);
477extern size_t my_caseup_8bit(const CHARSET_INFO *, char *src, size_t srclen,
478 char *dst, size_t dstlen);
479extern size_t my_casedn_8bit(const CHARSET_INFO *, char *src, size_t srclen,
480 char *dst, size_t dstlen);
481
482extern int my_strcasecmp_8bit(const CHARSET_INFO *cs, const char *,
483 const char *);
484
485int my_mb_wc_8bit(const CHARSET_INFO *cs, my_wc_t *wc, const uchar *s,
486 const uchar *e);
487int my_wc_mb_8bit(const CHARSET_INFO *cs, my_wc_t wc, uchar *s, uchar *e);
488
489int my_mb_ctype_8bit(const CHARSET_INFO *, int *, const uchar *, const uchar *);
490int my_mb_ctype_mb(const CHARSET_INFO *, int *, const uchar *, const uchar *);
491
492size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e,
493 int sq);
494
495size_t my_snprintf_8bit(const CHARSET_INFO *, char *to, size_t n,
496 const char *fmt, ...)
497 MY_ATTRIBUTE((format(printf, 4, 5)));
498
499long my_strntol_8bit(const CHARSET_INFO *, const char *s, size_t l, int base,
500 const char **e, int *err);
501ulong my_strntoul_8bit(const CHARSET_INFO *, const char *s, size_t l, int base,
502 const char **e, int *err);
503longlong my_strntoll_8bit(const CHARSET_INFO *, const char *s, size_t l,
504 int base, const char **e, int *err);
505ulonglong my_strntoull_8bit(const CHARSET_INFO *, const char *s, size_t l,
506 int base, const char **e, int *err);
507double my_strntod_8bit(const CHARSET_INFO *, const char *s, size_t l,
508 const char **e, int *err);
509size_t my_long10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
510 int radix, long int val);
511size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
512 int radix, longlong val);
513
514longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr,
515 const char **endptr, int *error);
516longlong my_strtoll10_ucs2(const CHARSET_INFO *cs, const char *nptr,
517 char **endptr, int *error);
518
520 size_t length, int unsigned_fl,
521 const char **endptr, int *error);
523 size_t length, int unsigned_fl, char **endptr,
524 int *error);
525
526void my_fill_8bit(const CHARSET_INFO *cs, char *to, size_t l, int fill);
527
528/* For 8-bit character set */
529bool my_like_range_simple(const CHARSET_INFO *cs, const char *ptr,
530 size_t ptr_length, char escape, char w_one,
531 char w_many, size_t res_length, char *min_str,
532 char *max_str, size_t *min_length,
533 size_t *max_length);
534
535/* For ASCII-based multi-byte character sets with mbminlen=1 */
536bool my_like_range_mb(const CHARSET_INFO *cs, const char *ptr,
537 size_t ptr_length, char escape, char w_one, char w_many,
538 size_t res_length, char *min_str, char *max_str,
539 size_t *min_length, size_t *max_length);
540
541/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */
542bool my_like_range_generic(const CHARSET_INFO *cs, const char *ptr,
543 size_t ptr_length, char escape, char w_one,
544 char w_many, size_t res_length, char *min_str,
545 char *max_str, size_t *min_length,
546 size_t *max_length);
547
548int my_wildcmp_8bit(const CHARSET_INFO *, const char *str, const char *str_end,
549 const char *wildstr, const char *wildend, int escape,
550 int w_one, int w_many);
551
552int my_wildcmp_bin(const CHARSET_INFO *, const char *str, const char *str_end,
553 const char *wildstr, const char *wildend, int escape,
554 int w_one, int w_many);
555
556size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e);
557size_t my_numcells_8bit(const CHARSET_INFO *, const char *b, const char *e);
558size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e,
559 size_t pos);
560size_t my_well_formed_len_8bit(const CHARSET_INFO *, const char *b,
561 const char *e, size_t pos, int *error);
563
564/* Functions for multibyte charsets */
565extern size_t my_caseup_str_mb(const CHARSET_INFO *, char *);
566extern size_t my_casedn_str_mb(const CHARSET_INFO *, char *);
567extern size_t my_caseup_mb(const CHARSET_INFO *, char *src, size_t srclen,
568 char *dst, size_t dstlen);
569extern size_t my_casedn_mb(const CHARSET_INFO *, char *src, size_t srclen,
570 char *dst, size_t dstlen);
571extern size_t my_caseup_mb_varlen(const CHARSET_INFO *, char *src,
572 size_t srclen, char *dst, size_t dstlen);
573extern size_t my_casedn_mb_varlen(const CHARSET_INFO *, char *src,
574 size_t srclen, char *dst, size_t dstlen);
575extern size_t my_caseup_ujis(const CHARSET_INFO *, char *src, size_t srclen,
576 char *dst, size_t dstlen);
577extern size_t my_casedn_ujis(const CHARSET_INFO *, char *src, size_t srclen,
578 char *dst, size_t dstlen);
579extern int my_strcasecmp_mb(const CHARSET_INFO *cs, const char *, const char *);
580
581int my_wildcmp_mb(const CHARSET_INFO *, const char *str, const char *str_end,
582 const char *wildstr, const char *wildend, int escape,
583 int w_one, int w_many);
584size_t my_numchars_mb(const CHARSET_INFO *, const char *b, const char *e);
585size_t my_numcells_mb(const CHARSET_INFO *, const char *b, const char *e);
586size_t my_charpos_mb3(const CHARSET_INFO *, const char *b, const char *e,
587 size_t pos);
588size_t my_well_formed_len_mb(const CHARSET_INFO *, const char *b, const char *e,
589 size_t pos, int *error);
590uint my_instr_mb(const CHARSET_INFO *, const char *b, size_t b_length,
591 const char *s, size_t s_length, my_match_t *match,
592 uint nmatch);
593
594int my_strnncoll_mb_bin(const CHARSET_INFO *cs, const uchar *s, size_t slen,
595 const uchar *t, size_t tlen, bool t_is_prefix);
596
597int my_strnncollsp_mb_bin(const CHARSET_INFO *cs, const uchar *a,
598 size_t a_length, const uchar *b, size_t b_length);
599
600int my_wildcmp_mb_bin(const CHARSET_INFO *cs, const char *str,
601 const char *str_end, const char *wildstr,
602 const char *wildend, int escape, int w_one, int w_many);
603
604int my_strcasecmp_mb_bin(const CHARSET_INFO *cs [[maybe_unused]], const char *s,
605 const char *t);
606
607void my_hash_sort_mb_bin(const CHARSET_INFO *cs [[maybe_unused]],
608 const uchar *key, size_t len, uint64 *nr1,
609 uint64 *nr2);
610
611size_t my_strnxfrm_mb(const CHARSET_INFO *, uchar *dst, size_t dstlen,
612 uint nweights, const uchar *src, size_t srclen,
613 uint flags);
614
615size_t my_strnxfrm_unicode(const CHARSET_INFO *, uchar *dst, size_t dstlen,
616 uint nweights, const uchar *src, size_t srclen,
617 uint flags);
618
620 size_t dstlen, uint nweights,
621 const uchar *src, size_t srclen,
622 uint flags);
623size_t my_strnxfrmlen_unicode_full_bin(const CHARSET_INFO *, size_t);
624
625int my_wildcmp_unicode(const CHARSET_INFO *cs, const char *str,
626 const char *str_end, const char *wildstr,
627 const char *wildend, int escape, int w_one, int w_many,
628 const MY_UNICASE_INFO *weights);
629
630extern bool my_parse_charset_xml(MY_CHARSET_LOADER *loader, const char *buf,
631 size_t buflen);
632extern size_t my_strcspn(const CHARSET_INFO *cs, const char *str,
633 const char *end, const char *reject,
634 size_t reject_length);
635
636bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t len);
637bool my_propagate_complex(const CHARSET_INFO *cs, const uchar *str, size_t len);
638
639uint my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len);
640/**
641 Detect whether a character set is ASCII compatible.
642*/
643static inline bool my_charset_is_ascii_based(const CHARSET_INFO *cs) {
644 return (cs->state & MY_CS_NONASCII) ? false : true;
645}
646
647inline bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2) {
648 assert(0 != strcmp(cs1->csname, "utf8"));
649 assert(0 != strcmp(cs2->csname, "utf8"));
650 return ((cs1 == cs2) || !strcmp(cs1->csname, cs2->csname));
651}
652
655
657size_t my_strxfrm_pad(const CHARSET_INFO *cs, uchar *str, uchar *frmend,
658 uchar *strend, uint nweights, uint flags);
659
661
662size_t my_convert(char *to, size_t to_length, const CHARSET_INFO *to_cs,
663 const char *from, size_t from_length,
664 const CHARSET_INFO *from_cs, uint *errors);
665
666uint my_mbcharlen_ptr(const CHARSET_INFO *cs, const char *s, const char *e);
667
668bool my_is_prefixidx_cand(const CHARSET_INFO *cs, const char *wildstr,
669 const char *wildend, int escape, int w_many,
670 size_t *prefix_len);
671
672#define _MY_U 01 /* Upper case */
673#define _MY_L 02 /* Lower case */
674#define _MY_NMR 04 /* Numeral (digit) */
675#define _MY_SPC 010 /* Spacing character */
676#define _MY_PNT 020 /* Punctuation */
677#define _MY_CTR 040 /* Control character */
678#define _MY_B 0100 /* Blank */
679#define _MY_X 0200 /* heXadecimal digit */
680
681/* The following macros makes sense only for one-byte character sets.
682They will not fail for multibyte character sets, but will not produce
683the expected results. They may have some limited usability like
684e.g. for utf8mb3/utf8mb4, meaningful results will be produced for
685values < 0x7F. */
686#define my_isascii(c) (!((c) & ~0177))
687#define my_toupper(s, c) (char)((s)->to_upper[(uchar)(c)])
688#define my_tolower(s, c) (char)((s)->to_lower[(uchar)(c)])
689#define my_isalpha(s, c) (((s)->ctype + 1)[(uchar)(c)] & (_MY_U | _MY_L))
690#define my_isupper(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_U)
691#define my_islower(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_L)
692#define my_isdigit(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_NMR)
693#define my_isxdigit(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_X)
694#define my_isalnum(s, c) \
695 (((s)->ctype + 1)[(uchar)(c)] & (_MY_U | _MY_L | _MY_NMR))
696#define my_isspace(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_SPC)
697#define my_ispunct(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_PNT)
698#define my_isprint(s, c) \
699 (((s)->ctype + 1)[(uchar)(c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
700#define my_isgraph(s, c) \
701 (((s)->ctype + 1)[(uchar)(c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
702#define my_iscntrl(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_CTR)
703
704/* Some macros that should be cleaned up a little */
705#define my_isvar(s, c) (my_isalnum(s, c) || (c) == '_')
706#define my_isvar_start(s, c) (my_isalpha(s, c) || (c) == '_')
707
708#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
709#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
710#define my_strnxfrm(cs, d, dl, s, sl) \
711 ((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), 0))
712#define my_strnncoll(s, a, b, c, d) \
713 ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
714#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
715 ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
716#define my_wildcmp(cs, s, se, w, we, e, o, m) \
717 ((cs)->coll->wildcmp((cs), (s), (se), (w), (we), (e), (o), (m)))
718#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
719#define my_charpos(cs, b, e, num) \
720 (cs)->cset->charpos((cs), (const char *)(b), (const char *)(e), (num))
721
722#define use_mb(s) ((s)->cset->ismbchar != NULL)
723static inline uint my_ismbchar(const CHARSET_INFO *cs, const char *str,
724 const char *strend) {
725 return cs->cset->ismbchar(cs, str, strend);
726}
727
728static inline uint my_ismbchar(const CHARSET_INFO *cs, const uchar *str,
729 const uchar *strend) {
730 return cs->cset->ismbchar(cs, pointer_cast<const char *>(str),
731 pointer_cast<const char *>(strend));
732}
733
734#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s), (a)))
735/**
736 Get the length of gb18030 code by the given two leading bytes
737
738 @param[in] s charset_info
739 @param[in] a first byte of gb18030 code
740 @param[in] b second byte of gb18030 code
741 @return the length of gb18030 code starting with given two bytes,
742 the length would be 2 or 4 for valid gb18030 code,
743 or 0 for invalid gb18030 code
744*/
745#define my_mbcharlen_2(s, a, b) \
746 ((s)->cset->mbcharlen((s), ((((a)&0xFF) << 8) + ((b)&0xFF))))
747/**
748 Get the maximum length of leading bytes needed to determine the length of a
749 multi-byte gb18030 code
750
751 @param[in] s charset_info
752 @return number of leading bytes we need, would be 2 for gb18030
753 and 1 for all other charsets
754*/
755#define my_mbmaxlenlen(s) ((s)->mbmaxlenlen)
756/**
757 Judge if the given byte is a possible leading byte for a charset.
758 For gb18030 whose mbmaxlenlen is 2, we can't determine the length of
759 a multi-byte character by looking at the first byte only
760
761 @param[in] s charset_info
762 @param[in] i possible leading byte
763 @return true if it is, otherwise false
764*/
765#define my_ismb1st(s, i) \
766 (my_mbcharlen((s), (i)) > 1 || \
767 (my_mbmaxlenlen((s)) == 2 && my_mbcharlen((s), (i)) == 0))
768
769#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
770#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
771#define my_strntol(s, a, b, c, d, e) \
772 ((s)->cset->strntol((s), (a), (b), (c), (d), (e)))
773#define my_strntoul(s, a, b, c, d, e) \
774 ((s)->cset->strntoul((s), (a), (b), (c), (d), (e)))
775#define my_strntoll(s, a, b, c, d, e) \
776 ((s)->cset->strntoll((s), (a), (b), (c), (d), (e)))
777#define my_strntoull(s, a, b, c, d, e) \
778 ((s)->cset->strntoull((s), (a), (b), (c), (d), (e)))
779#define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s), (a), (b), (c), (d)))
780
781static inline bool is_supported_parser_charset(const CHARSET_INFO *cs) {
782 return (cs->mbminlen == 1);
783}
784
785#endif // M_CTYPE_INCLUDED
static int flags[50]
Definition: hp_test1.cc:40
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, uint *errors)
Convert a string between two character sets.
Definition: ctype.cc:909
size_t my_caseup_mb_varlen(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:186
static constexpr uint32_t MY_CS_PUREASCII
Definition: m_ctype.h:142
int my_strcasecmp_8bit(const CHARSET_INFO *cs, const char *, const char *)
Definition: ctype-simple.cc:245
struct MY_UNICASE_INFO MY_UNICASE_INFO
size_t my_casedn_str_mb(const CHARSET_INFO *, char *)
Definition: ctype-mb.cc:61
size_t my_charpos_mb3(const CHARSET_INFO *, const char *b, const char *e, size_t pos)
Definition: ctype-mb.cc:331
static uint my_ismbchar(const CHARSET_INFO *cs, const char *str, const char *strend)
Definition: m_ctype.h:723
size_t my_well_formed_len_mb(const CHARSET_INFO *, const char *b, const char *e, size_t pos, int *error)
Definition: ctype-mb.cc:343
double my_strntod_8bit(const CHARSET_INFO *, const char *s, size_t l, const char **e, int *err)
Definition: ctype-simple.cc:646
MY_COLLATION_HANDLER my_collation_ucs2_uca_handler
Definition: ctype-uca.cc:5187
CHARSET_INFO my_charset_latin1_bin
Definition: ctype-latin1.cc:671
size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e)
Definition: ctype-simple.cc:912
MY_UNICASE_INFO my_unicase_unicode520
Definition: ctype-utf8.cc:4783
size_t my_snprintf_8bit(const CHARSET_INFO *, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:281
size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t)
Definition: ctype-simple.cc:64
struct MY_COLLATION_HANDLER MY_COLLATION_HANDLER
size_t my_strnxfrmlen_unicode_full_bin(const CHARSET_INFO *, size_t)
Definition: ctype-utf8.cc:5170
size_t my_caseup_str_8bit(const CHARSET_INFO *, char *)
Definition: ctype-simple.cc:211
MY_COLLATION_HANDLER my_collation_mb_bin_handler
Definition: ctype-mb.cc:1337
int my_strnncoll_mb_bin(const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
Definition: ctype-mb.cc:410
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
int(* my_charset_conv_wc_mb)(const CHARSET_INFO *, my_wc_t, uchar *, uchar *)
Definition: m_ctype.h:295
static constexpr uint32_t MY_CS_READY
Definition: m_ctype.h:134
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
MY_CHARSET_HANDLER my_charset_ascii_handler
Definition: ctype-simple.cc:1556
static bool is_supported_parser_charset(const CHARSET_INFO *cs)
Definition: m_ctype.h:781
static constexpr uint32_t MY_CS_NONASCII
Definition: m_ctype.h:144
MY_UNICASE_INFO my_unicase_turkish
Definition: ctype-utf8.cc:1875
static constexpr uint32_t MY_CS_STRNXFRM
Definition: m_ctype.h:126
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
int my_mb_wc_8bit(const CHARSET_INFO *cs, my_wc_t *wc, const uchar *s, const uchar *e)
Definition: ctype-simple.cc:252
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
size_t my_caseup_mb(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:88
CHARSET_INFO my_charset_utf8mb3_bin
Definition: ctype-utf8.cc:5883
void my_fill_8bit(const CHARSET_INFO *cs, char *to, size_t l, int fill)
Definition: ctype-simple.cc:907
size_t my_casedn_mb(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:115
MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler
Definition: ctype-simple.cc:1585
uint my_mbcharlen_8bit(const CHARSET_INFO *, uint c)
Definition: ctype-bin.cc:227
uint 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.
Definition: ctype.cc:967
MY_COLLATION_HANDLER my_collation_8bit_bin_handler
Definition: ctype-bin.cc:454
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1545
static constexpr uint32_t MY_CS_BINSORT
Definition: m_ctype.h:122
MY_UNICASE_INFO my_unicase_mysql500
Definition: ctype-utf8.cc:1701
size_t my_casedn_8bit(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:235
size_t my_caseup_str_mb(const CHARSET_INFO *, char *)
Definition: ctype-mb.cc:44
static constexpr uint32_t MY_CS_LOWER_SORT
Definition: m_ctype.h:148
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l, int radix, longlong val)
Definition: ctype-simple.cc:695
struct MY_CHARSET_HANDLER MY_CHARSET_HANDLER
uint my_strxfrm_flag_normalize(uint flags)
Definition: ctype-simple.cc:1507
static bool my_charset_is_ascii_based(const CHARSET_INFO *cs)
Detect whether a character set is ASCII compatible.
Definition: m_ctype.h:643
int my_mb_ctype_8bit(const CHARSET_INFO *, int *, const uchar *, const uchar *)
Definition: ctype-simple.cc:1144
size_t my_caseup_8bit(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:225
static constexpr uint32_t MY_CS_UNICODE_SUPPLEMENT
Definition: m_ctype.h:146
size_t my_numchars_mb(const CHARSET_INFO *, const char *b, const char *e)
Definition: ctype-mb.cc:320
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_general_ci
Definition: ctype-utf8.cc:7758
size_t my_strxfrm_pad(const CHARSET_INFO *cs, uchar *str, uchar *frmend, uchar *strend, uint nweights, uint flags)
Definition: ctype-simple.cc:1512
bool my_charset_is_ascii_compatible(const CHARSET_INFO *cs)
Definition: ctype.cc:823
uint my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len)
Definition: ctype.cc:775
int my_strnncoll_simple(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, bool)
Definition: ctype-simple.cc:137
ulonglong my_strntoull10rnd_ucs2(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error)
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename
Definition: ctype-utf8.cc:7040
int my_mb_ctype_mb(const CHARSET_INFO *, int *, const uchar *, const uchar *)
Definition: ctype-mb.cc:1324
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
size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-simple.cc:936
size_t(* my_charset_conv_case)(const CHARSET_INFO *, char *, size_t, char *, size_t)
Definition: m_ctype.h:297
bool my_charset_is_8bit_pure_ascii(const CHARSET_INFO *cs)
Definition: ctype.cc:809
int my_wildcmp_bin(const CHARSET_INFO *, 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
uint my_instr_mb(const CHARSET_INFO *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch)
Definition: ctype-mb.cc:362
int my_wildcmp_mb(const CHARSET_INFO *, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many)
Definition: ctype-mb.cc:313
static constexpr uint32_t MY_CS_AVAILABLE
Definition: m_ctype.h:136
struct MY_UNI_IDX MY_UNI_IDX
size_t my_casedn_mb_varlen(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-mb.cc:179
int my_wildcmp_8bit(const CHARSET_INFO *, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many)
Definition: ctype-simple.cc:818
MY_UNICASE_INFO my_unicase_default
Definition: ctype-utf8.cc:1655
CHARSET_INFO my_charset_utf8mb4_bin
Definition: ctype-utf8.cc:7794
struct MY_UNICASE_CHARACTER MY_UNICASE_CHARACTER
MY_CHARSET_HANDLER my_charset_8bit_handler
Definition: ctype-simple.cc:1528
void my_hash_sort_simple(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Definition: ctype-simple.cc:291
static constexpr uint32_t MY_CHARSET_UNDEFINED
Definition: m_ctype.h:112
int my_strnncollsp_mb_bin(const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length)
Definition: ctype-mb.cc:440
int my_wildcmp_unicode(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, const MY_UNICASE_INFO *weights)
Definition: ctype-utf8.cc:4926
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...
Definition: ctype.cc:994
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_0900_bin
Definition: ctype-uca.cc:11436
longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1139
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_0900_ai_ci
Definition: ctype-uca.cc:9564
static void MY_PUT_MB2(unsigned char *s, uint16 code)
Definition: m_ctype.h:63
static constexpr uint32_t MY_CS_UNICODE
Definition: m_ctype.h:132
struct MY_UNI_CTYPE MY_UNI_CTYPE
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:511
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:368
ulong my_wc_t
Our own version of wchar_t, ie., a type that holds a single Unicode code point ("wide character").
Definition: m_ctype.h:59
static constexpr uint32_t MY_CS_HIDDEN
Definition: m_ctype.h:140
int my_strcasecmp_mb_bin(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-mb.cc:561
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
uint my_charset_repertoire(const CHARSET_INFO *cs)
Definition: ctype.cc:797
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
bool my_like_range_generic(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)
Calculate min_str and max_str that ranges a LIKE string.
Definition: ctype-mb.cc:809
bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2)
Definition: m_ctype.h:647
MY_UNI_CTYPE my_uni_ctype[256]
Definition: my_uctype.h:935
int my_wc_mb_8bit(const CHARSET_INFO *cs, my_wc_t wc, uchar *s, uchar *e)
Definition: ctype-simple.cc:260
CHARSET_INFO my_charset_utf8mb3_tolower_ci
Definition: ctype-utf8.cc:5813
size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e, size_t pos)
Definition: ctype-simple.cc:922
static constexpr uint32_t MY_CS_CONFIG_UNUSED
Definition: m_ctype.h:116
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb3_general_ci
Definition: ctype-utf8.cc:5778
void my_hash_sort_mb_bin(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Definition: ctype-mb.cc:566
static constexpr uint32_t MY_CS_LOADED
Definition: m_ctype.h:120
static constexpr uint32_t MY_CS_INDEX_UNUSED
Definition: m_ctype.h:118
int my_strcasecmp_mb(const CHARSET_INFO *cs, const char *, const char *)
Definition: ctype-mb.cc:197
size_t my_casedn_str_8bit(const CHARSET_INFO *, char *)
Definition: ctype-simple.cc:218
size_t my_strnxfrm_mb(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-mb.cc:502
int(* my_charset_conv_mb_wc)(const CHARSET_INFO *, my_wc_t *, const uchar *, const uchar *)
Definition: m_ctype.h:293
size_t my_strnxfrm_unicode_full_bin(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-utf8.cc:5125
bool my_parse_charset_xml(MY_CHARSET_LOADER *loader, const char *buf, size_t buflen)
Definition: ctype.cc:745
CHARSET_INFO my_charset_utf32_unicode_ci
Definition: ctype-uca.cc:7790
bool my_like_range_mb(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-mb.cc:661
int(* my_string_stack_guard)(int)
Definition: ctype.cc:65
MY_CHARSET_HANDLER my_charset_ucs2_handler
Definition: ctype-ucs2.cc:2859
static constexpr uint32_t MY_CS_PRIMARY
Definition: m_ctype.h:124
static constexpr uint32_t MY_CS_COMPILED
Definition: m_ctype.h:114
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 're...
Definition: my_strchr.cc:65
uint my_instr_simple(const CHARSET_INFO *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch)
Definition: ctype-simple.cc:943
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e, int sq)
Definition: ctype-simple.cc:885
longlong my_strtoll10_ucs2(const CHARSET_INFO *cs, const char *nptr, char **endptr, int *error)
bool my_propagate_complex(const CHARSET_INFO *cs, const uchar *str, size_t len)
Definition: ctype-simple.cc:1490
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)
Definition: ctype-mb.cc:1042
size_t my_strnxfrm_simple(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-simple.cc:107
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
size_t my_casedn_ujis(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-ujis.cc:35762
size_t my_numcells_mb(const CHARSET_INFO *, const char *b, const char *e)
Definition: ctype-mb.cc:1292
CHARSET_INFO my_charset_utf8mb3_unicode_ci
Definition: ctype-uca.cc:6085
static constexpr uint32_t MY_CS_CSSORT
Definition: m_ctype.h:138
size_t my_strnxfrm_unicode(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-utf8.cc:5104
Pad_attribute
Definition: m_ctype.h:198
@ NO_PAD
Definition: m_ctype.h:198
@ PAD_SPACE
Definition: m_ctype.h:198
bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t len)
Definition: ctype-simple.cc:1484
size_t my_caseup_ujis(const CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-ujis.cc:35772
int my_strnncollsp_simple(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t)
Definition: ctype-simple.cc:179
static const char * strend(const char *s)
Definition: m_string.h:92
Header for compiler-dependent features.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
uint64_t uint64
Definition: my_inttypes.h:69
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:41
Some common macros.
Functions related to handling of plugins and other dynamically loaded libraries.
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:71
Log error(cerr, "ERROR")
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: buf0block_hint.cc:30
Definition: commit_order_queue.h:34
static std::string escape(const std::string &str)
Escapes (only) apostrophes.
Definition: st_units_of_measure.cc:37
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:910
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Definition: m_ctype.h:385
const uchar * to_lower
Definition: m_ctype.h:396
uchar levels_for_compare
Definition: m_ctype.h:415
const uchar * ident_map
Definition: m_ctype.h:404
uint mbmaxlenlen
Definition: m_ctype.h:410
const struct lex_state_maps_st * state_maps
Definition: m_ctype.h:403
const uchar * ctype
Definition: m_ctype.h:395
uint primary_number
Definition: m_ctype.h:387
const char * csname
Definition: m_ctype.h:390
my_wc_t max_sort_char
Definition: m_ctype.h:412
const MY_UNICASE_INFO * caseinfo
Definition: m_ctype.h:402
bool escape_with_backslash_is_dangerous
Definition: m_ctype.h:414
uint mbminlen
Definition: m_ctype.h:408
uint binary_number
Definition: m_ctype.h:388
uchar caseup_multiply
Definition: m_ctype.h:406
const uchar * sort_order
Definition: m_ctype.h:398
uint mbmaxlen
Definition: m_ctype.h:409
MY_COLLATION_HANDLER * coll
Definition: m_ctype.h:418
MY_CHARSET_HANDLER * cset
Definition: m_ctype.h:417
const char * m_coll_name
Definition: m_ctype.h:391
uint state
Definition: m_ctype.h:389
uchar casedn_multiply
Definition: m_ctype.h:407
const uchar * to_upper
Definition: m_ctype.h:397
const MY_UNI_IDX * tab_from_uni
Definition: m_ctype.h:401
struct Coll_param * coll_param
Definition: m_ctype.h:394
uint number
Definition: m_ctype.h:386
struct MY_UCA_INFO * uca
Definition: m_ctype.h:399
const uint16 * tab_to_uni
Definition: m_ctype.h:400
uchar pad_char
Definition: m_ctype.h:413
my_wc_t min_sort_char
Definition: m_ctype.h:411
enum Pad_attribute pad_attribute
If this collation is PAD_SPACE, it collates as if all inputs were padded with a given number of space...
Definition: m_ctype.h:427
const char * tailoring
Definition: m_ctype.h:393
const char * comment
Definition: m_ctype.h:392
uint strxfrm_multiply
Definition: m_ctype.h:405
Definition: str_uca_type.h:69
Definition: m_ctype.h:301
longlong(* strtoll10)(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: m_ctype.h:372
size_t(* lengthsp)(const CHARSET_INFO *, const char *ptr, size_t length)
Given a pointer and a length in bytes, returns a new length in bytes where all trailing space charact...
Definition: m_ctype.h:333
double(* strntod)(const CHARSET_INFO *, const char *s, size_t l, const char **e, int *err)
Definition: m_ctype.h:370
size_t(* well_formed_len)(const CHARSET_INFO *, const char *b, const char *e, size_t nchars, int *error)
Definition: m_ctype.h:316
ulonglong(* strntoull10rnd)(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, const char **endptr, int *error)
Definition: m_ctype.h:374
size_t(* caseup_str)(const CHARSET_INFO *, char *)
Definition: m_ctype.h:345
uint(* mbcharlen)(const CHARSET_INFO *, uint c)
Definition: m_ctype.h:305
long(* strntol)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:362
size_t(* charpos)(const CHARSET_INFO *, const char *b, const char *e, size_t pos)
Return at which byte codepoint number "pos" begins, relative to the start of the string.
Definition: m_ctype.h:314
ulonglong(* strntoull)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:368
ulong(* strntoul)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:364
longlong(* strntoll)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:366
size_t(* numchars)(const CHARSET_INFO *, const char *b, const char *e)
Definition: m_ctype.h:306
size_t(* numcells)(const CHARSET_INFO *, const char *b, const char *e)
Definition: m_ctype.h:334
int(* ctype)(const CHARSET_INFO *cs, int *ctype, const uchar *s, const uchar *e)
Definition: m_ctype.h:341
void(* fill)(const CHARSET_INFO *, char *to, size_t len, int fill)
Definition: m_ctype.h:359
my_charset_conv_wc_mb wc_mb
Definition: m_ctype.h:338
size_t(* scan)(const CHARSET_INFO *, const char *b, const char *e, int sq)
Definition: m_ctype.h:377
bool(* init)(CHARSET_INFO *, MY_CHARSET_LOADER *loader)
Definition: m_ctype.h:302
my_charset_conv_mb_wc mb_wc
Definition: m_ctype.h:337
my_charset_conv_case caseup
Definition: m_ctype.h:348
size_t(* longlong10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix, longlong val)
Definition: m_ctype.h:356
size_t(* casedn_str)(const CHARSET_INFO *, char *)
Definition: m_ctype.h:346
size_t(* long10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix, long int val)
Definition: m_ctype.h:354
my_charset_conv_case casedn
Definition: m_ctype.h:349
uint(* ismbchar)(const CHARSET_INFO *, const char *, const char *)
Definition: m_ctype.h:304
size_t(* snprintf)(const CHARSET_INFO *, char *to, size_t n, const char *fmt,...)
Definition: m_ctype.h:352
Definition: m_ctype.h:174
void reporter(enum loglevel, uint, const char *)
Definition: charset.cc:344
virtual void * mem_malloc(size_t)
Definition: charset.cc:334
virtual void * mem_realloc(void *, size_t)
Definition: charset.cc:338
virtual void * once_alloc(size_t)
Definition: charset.cc:330
char errarg[192]
Definition: m_ctype.h:176
virtual void mem_free(void *)
Definition: charset.cc:342
virtual ~MY_CHARSET_LOADER()=default
uint errcode
Definition: m_ctype.h:175
virtual int add_collation(CHARSET_INFO *)
Definition: charset.cc:218
Definition: m_ctype.h:201
int(* strcasecmp)(const CHARSET_INFO *, const char *, const char *)
Definition: m_ctype.h:265
bool(* like_range)(const CHARSET_INFO *, 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)
Definition: m_ctype.h:257
bool(* init)(CHARSET_INFO *, MY_CHARSET_LOADER *)
Definition: m_ctype.h:202
int(* wildcmp)(const CHARSET_INFO *, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many)
Definition: m_ctype.h:261
void(* uninit)(CHARSET_INFO *)
Definition: m_ctype.h:203
bool(* propagate)(const CHARSET_INFO *cs, const uchar *str, size_t len)
Definition: m_ctype.h:284
void(* hash_sort)(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Compute a sort hash for the given key.
Definition: m_ctype.h:282
int(* strnncoll)(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, bool)
Definition: m_ctype.h:205
int(* strnncollsp)(const CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t)
Compare the two strings under the pad rules given by the collation.
Definition: m_ctype.h:216
uint(* strstr)(const CHARSET_INFO *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint nmatch)
Definition: m_ctype.h:267
size_t(* strnxfrm)(const CHARSET_INFO *, uchar *dst, size_t dstlen, uint num_codepoints, const uchar *src, size_t srclen, uint flags)
Transform the string into a form such that memcmp() between transformed strings yields the correct co...
Definition: m_ctype.h:242
size_t(* strnxfrmlen)(const CHARSET_INFO *, size_t num_bytes)
Return the maximum number of output bytes needed for strnxfrm() to output all weights for any string ...
Definition: m_ctype.h:256
Definition: str_uca_type.h:120
Definition: m_ctype.h:68
uint32 sort
Definition: m_ctype.h:71
uint32 tolower
Definition: m_ctype.h:70
uint32 toupper
Definition: m_ctype.h:69
Definition: m_ctype.h:74
const MY_UNICASE_CHARACTER ** page
Definition: m_ctype.h:76
my_wc_t maxchar
Definition: m_ctype.h:75
Definition: m_ctype.h:86
uchar * ctype
Definition: m_ctype.h:88
uchar pctype
Definition: m_ctype.h:87
Definition: m_ctype.h:159
const uchar * tab
Definition: m_ctype.h:162
uint16 from
Definition: m_ctype.h:160
uint16 to
Definition: m_ctype.h:161
Definition: sql_chars.h:91
Definition: m_ctype.h:165
uint mb_len
Definition: m_ctype.h:168
uint end
Definition: m_ctype.h:167
uint beg
Definition: m_ctype.h:166
unsigned int uint
Definition: uca9-dump.cc:75
int n
Definition: xcom_base.cc:509