MySQL 8.2.0
Source Code Documentation
m_ctype.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef INCLUDE_MYSQL_STRINGS_M_CTYPE_H_
24#define INCLUDE_MYSQL_STRINGS_M_CTYPE_H_
25
26/**
27 @file include/mysql/strings/m_ctype.h
28 A better implementation of the UNIX ctype(3) library.
29*/
30
31#include <sys/types.h>
32
33#include <cassert>
34#include <cstddef>
35#include <cstdint>
36#include <cstdlib>
37#include <cstring>
38#include <deque>
39
40#include "mysql/attribute.h"
41#include "mysql/my_loglevel.h"
42#include "mysql/strings/api.h"
43#include "template_utils.h"
44
45constexpr int MY_CS_NAME_SIZE = 32;
46
47constexpr const char *CHARSET_DIR = "charsets/";
48
49typedef int myf; /* Type of MyFlags in my_funcs */
50
51/**
52 Our own version of wchar_t, ie., a type that holds a single Unicode code point
53 ("wide character"). unsigned long is always big enough to hold any character
54 in the BMP.
55*/
56typedef unsigned long my_wc_t;
57
58static inline void MY_PUT_MB2(unsigned char *s, uint16_t code) {
59 s[0] = code >> 8;
60 s[1] = code & 0xFF;
61}
62
64 uint32_t toupper;
65 uint32_t tolower;
66 uint32_t sort;
67};
68
72};
73
74struct MY_UCA_INFO;
75
77 uint8_t pctype;
78 uint8_t *ctype;
79};
80
81/* wm_wc and wc_mb return codes */
82/* clang-format off */
83static constexpr int
84 MY_CS_ILSEQ = 0; /* Wrong by sequence: wb_wc */
85static constexpr int
86 MY_CS_ILUNI = 0; /* Cannot encode Unicode to charset: wc_mb */
87static constexpr int
88 MY_CS_TOOSMALL = -101; /* Need at least one byte: wc_mb and mb_wc */
89static constexpr int
90 MY_CS_TOOSMALL2 = -102; /* Need at least two bytes: wc_mb and mb_wc */
91static constexpr int
92 MY_CS_TOOSMALL3 = -103; /* Need at least three bytes: wc_mb and mb_wc */
93
94/* These following three are currently not really used */
95static constexpr int
96 MY_CS_TOOSMALL4 = -104; /* Need at least 4 bytes: wc_mb and mb_wc */
97static constexpr int
98 MY_CS_TOOSMALL5 = -105; /* Need at least 5 bytes: wc_mb and mb_wc */
99static constexpr int
100 MY_CS_TOOSMALL6 = -106; /* Need at least 6 bytes: wc_mb and mb_wc */
101/* clang-format on */
102
103static constexpr int MY_SEQ_INTTAIL = 1;
104static constexpr int MY_SEQ_SPACES = 2;
105
106/* CHARSET_INFO::state flags */
107/* clang-format off */
108static constexpr uint32_t
109 MY_CHARSET_UNDEFINED = 0; // for unit testing
110static constexpr uint32_t
111 MY_CS_COMPILED = 1 << 0; // compiled-in charsets
112static constexpr uint32_t
113 MY_CS_CONFIG_UNUSED = 1 << 1; // unused bitmask
114static constexpr uint32_t
115 MY_CS_INDEX_UNUSED = 1 << 2; // unused bitmask
116static constexpr uint32_t
117 MY_CS_LOADED = 1 << 3; // charsets that are currently loaded
118static constexpr uint32_t
119 MY_CS_BINSORT = 1 << 4; // if binary sort order
120static constexpr uint32_t
121 MY_CS_PRIMARY = 1 << 5; // if primary collation
122static constexpr uint32_t
123 MY_CS_STRNXFRM = 1 << 6; // if _not_ set, sort_order will
124 // give same result as strnxfrm --
125 // all new collations should have
126 // this flag set,
127 // do not check it in new code
128static constexpr uint32_t
129 MY_CS_UNICODE = 1 << 7; // if a charset is BMP Unicode
130static constexpr uint32_t
131 MY_CS_READY = 1 << 8; // if a charset is initialized
132static constexpr uint32_t
133 MY_CS_AVAILABLE = 1 << 9; // if either compiled-in or loaded
134static constexpr uint32_t
135 MY_CS_CSSORT = 1 << 10; // if case sensitive sort order
136static constexpr uint32_t
137 MY_CS_HIDDEN = 1 << 11; // don't display in SHOW
138static constexpr uint32_t
139 MY_CS_PUREASCII = 1 << 12; // if a charset is pure ascii
140static constexpr uint32_t
141 MY_CS_NONASCII = 1 << 13; // if not ASCII-compatible
142static constexpr uint32_t
143 MY_CS_UNICODE_SUPPLEMENT = 1 << 14; // Non-BMP Unicode characters
144static constexpr uint32_t
145 MY_CS_LOWER_SORT = 1 << 15; // if use lower case as weight
146static constexpr uint32_t
147 MY_CS_INLINE = 1 << 16; // CS definition is C++ source
148
149/* Character repertoire flags */
150static constexpr uint32_t
151 MY_REPERTOIRE_ASCII = 1; /* Pure ASCII U+0000..U+007F */
152static constexpr uint32_t
153 MY_REPERTOIRE_EXTENDED = 2; /* Extended characters: U+0080..U+FFFF */
154static constexpr uint32_t
155 MY_REPERTOIRE_UNICODE30 = 3; /* ASCII | EXTENDED: U+0000..U+FFFF */
156
157/* Flags for strxfrm */
158static constexpr uint32_t
159 MY_STRXFRM_PAD_TO_MAXLEN = 0x00000080; /* if pad tail(for filesort) */
160
161/* clang-format on */
162
164 uint16_t from;
165 uint16_t to;
166 const uint8_t *tab;
167};
168
170 unsigned beg;
171 unsigned end;
172 unsigned mb_len;
173};
174
175struct CHARSET_INFO;
176
177/**
178 Helper structure to return error messages from collation parser/initializer.
179*/
181 static constexpr int errmsg_size = 192;
182 unsigned errcode{0}; ///< See include/mysys_err.h
183 char errarg[errmsg_size]{}; ///< Error message text
184};
185
186/**
187 User-specified callback interface for collation parser/initializer
188*/
190 public:
191 MY_CHARSET_LOADER() = default;
192 virtual ~MY_CHARSET_LOADER();
193
196
199
200 /**
201 Intercepts error messages from collation parser/initializer
202
203 @param loglevel ERROR_LEVEL or WARNING_LEVEL
204 @param errcode See include/mysys_err.h
205 */
206 virtual void reporter(enum loglevel loglevel, unsigned errcode, ...) = 0;
207
208 /**
209 Loads a file by its OS path into collation parser/initializer
210
211 @param path '\0'-terminated file path to load
212 @param size Byte size of @p path
213
214 @returns Pointer to file data on success, otherwise nullptr.
215 This is a caller's responsibility to free this pointer
216 with free().
217 */
218 virtual void *read_file(const char *path, size_t *size) = 0;
219
220 /**
221 Collation parser helper function (not overloadable).
222
223 @param cs New collation object to register in the collation library
224
225 @return MY_XML_OK on success, otherwise MY_XML_ERROR
226 */
228
229 /**
230 Allocate-and-forget version of malloc().
231 */
232 virtual void *once_alloc(size_t);
233
234 virtual void *mem_malloc(size_t size) { return malloc(size); }
235 virtual void mem_free(void *ptr) { free(ptr); }
236
237 private:
238 std::deque<void *> m_delete_list;
239};
240
242
244
245/* See strings/CHARSET_INFO.txt for information about this structure */
249 /* Collation routines */
250 int (*strnncoll)(const CHARSET_INFO *, const uint8_t *, size_t,
251 const uint8_t *, size_t, bool);
252 /**
253 Compare the two strings under the pad rules given by the collation.
254
255 Thus, for NO PAD collations, this is identical to strnncoll with is_prefix
256 set to false. For PAD SPACE collations, the two strings are conceptually
257 extended infinitely at the end using space characters (0x20) and then
258 compared under the collation's normal comparison rules, so that e.g 'a' is
259 equal to 'a '.
260 */
261 int (*strnncollsp)(const CHARSET_INFO *, const uint8_t *, size_t,
262 const uint8_t *, size_t);
263 /**
264 Transform the string into a form such that memcmp() between transformed
265 strings yields the correct collation order.
266
267 @param [out] dst Buffer for the transformed string.
268 @param [out] dstlen Number of bytes available in dstlen.
269 Must be even.
270 @param num_codepoints Treat the string as if it were of type
271 CHAR(num_codepoints). In particular, this means that if the
272 collation is a pad collation (pad_attribute is PAD_SPACE) and
273 string has fewer than "num_codepoints" codepoints, the string
274 will be transformed as if it ended in (num_codepoints-n) extra spaces.
275 If the string has more than "num_codepoints" codepoints,
276 behavior is undefined; may truncate, may crash, or do something
277 else entirely. Note that MY_STRXFRM_PAD_TO_MAXLEN overrides this;
278 if it is given for a PAD SPACE collation, this value is taken to be
279 effectively infinity.
280 @param src The source string, in the required character set
281 for the collation.
282 @param srclen Number of bytes in src.
283 @param flags ORed bitmask of MY_STRXFRM_* flags.
284
285 @return Number of bytes written to dst.
286 */
287 size_t (*strnxfrm)(const CHARSET_INFO *, uint8_t *dst, size_t dstlen,
288 unsigned num_codepoints, const uint8_t *src, size_t srclen,
289 unsigned flags);
290
291 /**
292 Return the maximum number of output bytes needed for strnxfrm()
293 to output all weights for any string of the given input length.
294 You can use this to e.g. size buffers for sort keys.
295
296 @param num_bytes Number of bytes in the input string. Note that for
297 multibyte character sets, this _must_ be a pessimistic estimate,
298 ie., one that's cs->mbmaxlen * max_num_codepoints. So for e.g.
299 the utf8mb4 string "foo", you will need to give in 12, not 3.
300 */
301 size_t (*strnxfrmlen)(const CHARSET_INFO *, size_t num_bytes);
302 bool (*like_range)(const CHARSET_INFO *, const char *s, size_t s_length,
303 char w_prefix, char w_one, char w_many, size_t res_length,
304 char *min_str, char *max_str, size_t *min_len,
305 size_t *max_len);
306 int (*wildcmp)(const CHARSET_INFO *, const char *str, const char *str_end,
307 const char *wildstr, const char *wildend, int escape,
308 int w_one, int w_many);
309
310 int (*strcasecmp)(const CHARSET_INFO *, const char *, const char *);
311
312 unsigned (*strstr)(const CHARSET_INFO *, const char *b, size_t b_length,
313 const char *s, size_t s_length, my_match_t *match,
314 unsigned nmatch);
315
316 /**
317 Compute a sort hash for the given key. This hash must preserve equality
318 under the given collation, so that a=b => H(a)=H(b). Note that this hash
319 is used for hash-based partitioning (PARTITION KEY), so you cannot change
320 it except when writing a new collation; it needs to be unchanged across
321 releases, so that the on-disk format does not change. (It is also used
322 for testing equality in the MEMORY storage engine.)
323
324 nr1 and nr2 are both in/out parameters. nr1 is the actual hash value;
325 nr2 holds extra state between invocations.
326 */
327 void (*hash_sort)(const CHARSET_INFO *cs, const uint8_t *key, size_t len,
328 uint64_t *nr1, uint64_t *nr2);
329 bool (*propagate)(const CHARSET_INFO *cs, const uint8_t *str, size_t len);
330};
331
332/* Some typedef to make it easy for C++ to make function pointers */
334 const uint8_t *, const uint8_t *);
335typedef int (*my_charset_conv_wc_mb)(const CHARSET_INFO *, my_wc_t, uint8_t *,
336 uint8_t *);
337typedef size_t (*my_charset_conv_case)(const CHARSET_INFO *, char *, size_t,
338 char *, size_t);
339
340/* See strings/CHARSET_INFO.txt about information on this structure */
343 /* Multibyte routines */
344 unsigned (*ismbchar)(const CHARSET_INFO *, const char *, const char *);
345 unsigned (*mbcharlen)(const CHARSET_INFO *, unsigned c);
346 size_t (*numchars)(const CHARSET_INFO *, const char *b, const char *e);
347
348 /**
349 Return at which byte codepoint number "pos" begins, relative to
350 the start of the string. If the string is shorter than or is
351 exactly "pos" codepoints long, returns a value equal or greater to
352 (e-b).
353 */
354 size_t (*charpos)(const CHARSET_INFO *, const char *b, const char *e,
355 size_t pos);
356 size_t (*well_formed_len)(const CHARSET_INFO *, const char *b, const char *e,
357 size_t nchars, int *error);
358 /**
359 Given a pointer and a length in bytes, returns a new length in bytes where
360 all trailing space characters are stripped. This holds even for NO PAD
361 collations.
362
363 Exception: The "binary" collation, which is used behind-the-scenes to
364 implement the BINARY type (by mapping it to CHAR(n) COLLATE "binary"),
365 returns just the length back with no stripping. It's done that way so that
366 Field_string (implementing CHAR(n)) returns the full padded width on read
367 (as opposed to a normal CHAR, where we usually strip the spaces on read),
368 but it's suboptimal, since lengthsp() is also used in a number of other
369 places, e.g. stripping trailing spaces from enum values given in by the
370 user. If you call this function, be aware of this special exception and
371 consider the implications.
372 */
373 size_t (*lengthsp)(const CHARSET_INFO *, const char *ptr, size_t length);
374 size_t (*numcells)(const CHARSET_INFO *, const char *b, const char *e);
375
376 /* Unicode conversion */
379
380 /* CTYPE scanner */
381 int (*ctype)(const CHARSET_INFO *cs, int *ctype, const uint8_t *s,
382 const uint8_t *e);
383
384 /* Functions for case and sort conversion */
385 size_t (*caseup_str)(const CHARSET_INFO *, char *);
386 size_t (*casedn_str)(const CHARSET_INFO *, char *);
387
390
391 /* Charset dependant snprintf() */
392 size_t (*snprintf)(const CHARSET_INFO *, char *to, size_t n, const char *fmt,
393 ...) MY_ATTRIBUTE((format(printf, 4, 5)));
394
395 size_t (*long10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix,
396 long int val);
397 size_t (*longlong10_to_str)(const CHARSET_INFO *, char *to, size_t n,
398 int radix, long long val);
399
400 void (*fill)(const CHARSET_INFO *, char *to, size_t len, int fill);
401
402 /* String-to-number conversion routines */
403 long (*strntol)(const CHARSET_INFO *, const char *s, size_t l, int base,
404 const char **e, int *err);
405 unsigned long (*strntoul)(const CHARSET_INFO *, const char *s, size_t l,
406 int base, const char **e, int *err);
407 long long (*strntoll)(const CHARSET_INFO *, const char *s, size_t l, int base,
408 const char **e, int *err);
409 unsigned long long (*strntoull)(const CHARSET_INFO *, const char *s, size_t l,
410 int base, const char **e, int *err);
411 double (*strntod)(const CHARSET_INFO *, const char *s, size_t l,
412 const char **e, int *err);
413 long long (*strtoll10)(const CHARSET_INFO *cs, const char *nptr,
414 const char **endptr, int *error);
415 unsigned long long (*strntoull10rnd)(const CHARSET_INFO *cs, const char *str,
416 size_t length, int unsigned_fl,
417 const char **endptr, int *error);
418 size_t (*scan)(const CHARSET_INFO *, const char *b, const char *e, int sq);
419};
420
421/* See strings/CHARSET_INFO.txt about information on this structure */
423 unsigned number;
426 unsigned state;
427 const char *csname;
428 const char *m_coll_name;
429 const char *comment;
430 const char *tailoring;
432 const uint8_t *ctype;
433 const uint8_t *to_lower;
434 const uint8_t *to_upper;
435 const uint8_t *sort_order;
436 struct MY_UCA_INFO *uca; /* This can be changed in apply_one_rule() */
437 const uint16_t *tab_to_uni;
440 const struct lex_state_maps_st *state_maps; /* parser internal data */
441 const uint8_t *ident_map; /* parser internal data */
445 unsigned mbminlen;
446 unsigned mbmaxlen;
447 unsigned mbmaxlenlen;
449 my_wc_t max_sort_char; /* For LIKE optimization */
450 uint8_t pad_char;
453
456
457 /**
458 If this collation is PAD_SPACE, it collates as if all inputs were
459 padded with a given number of spaces at the end (see the "num_codepoints"
460 flag to strnxfrm). NO_PAD simply compares unextended strings.
461
462 Note that this is fundamentally about the behavior of coll->strnxfrm.
463 */
465};
466
467/*
468 NOTE: You cannot use a CHARSET_INFO without it having been initialized first.
469 In particular, they are not initialized when a unit test starts; do not use
470 these globals indiscriminately from there, and do not add more. Instead,
471 initialize them using my_collation_get_by_name().
472*/
473
479
488// TODO(tdidriks) check name rather than address:
491
492/**
493 @note Deprecated function, please call cs->coll->wildcmp(cs...) instead.
494*/
496 const char *str, const char *str_end,
497 const char *wildstr,
498 const char *wildend, int escape,
499 int w_one, int w_many);
500
502 const char *str, const char *end,
503 const char *reject,
504 size_t reject_length);
505
507 const char *str, size_t len);
508
510
511/**
512 Detect whether a character set is ASCII compatible.
513*/
515 return (cs->state & MY_CS_NONASCII) == 0;
516}
517
518inline bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2) {
519 assert(0 != strcmp(cs1->csname, "utf8"));
520 assert(0 != strcmp(cs2->csname, "utf8"));
521 return ((cs1 == cs2) || !strcmp(cs1->csname, cs2->csname));
522}
523
525
527
528MYSQL_STRINGS_EXPORT size_t my_convert(char *to, size_t to_length,
529 const CHARSET_INFO *to_cs,
530 const char *from, size_t from_length,
531 const CHARSET_INFO *from_cs,
532 unsigned *errors);
533
535 const char *s, const char *e);
536
538 const char *wildstr,
539 const char *wildend, int escape,
540 int w_many, size_t *prefix_len);
541
542/* clang-format off */
543static constexpr uint8_t MY_CHAR_U = 01; /* Upper case */
544static constexpr uint8_t MY_CHAR_L = 02; /* Lower case */
545static constexpr uint8_t MY_CHAR_NMR = 04; /* Numeral (digit) */
546static constexpr uint8_t MY_CHAR_SPC = 010; /* Spacing character */
547static constexpr uint8_t MY_CHAR_PNT = 020; /* Punctuation */
548static constexpr uint8_t MY_CHAR_CTR = 040; /* Control character */
549static constexpr uint8_t MY_CHAR_B = 0100; /* Blank */
550static constexpr uint8_t MY_CHAR_X = 0200; /* heXadecimal digit */
551/* clang-format on */
552
553/* The following functions make sense only for one-byte character sets.
554They will not fail for multibyte character sets, but will not produce
555the expected results. They may have some limited usability like
556e.g. for utf8mb3/utf8mb4, meaningful results will be produced for
557values < 0x7F. */
558
559inline bool my_isascii(char ch) { return (ch & ~0177) == 0; }
560
561inline char my_toupper(const CHARSET_INFO *cs, char ch) {
562 return static_cast<char>(cs->to_upper[static_cast<uint8_t>(ch)]);
563}
564
565inline char my_tolower(const CHARSET_INFO *cs, char ch) {
566 return static_cast<char>(cs->to_lower[static_cast<uint8_t>(ch)]);
567}
568
569inline bool my_isalpha(const CHARSET_INFO *cs, char ch) {
570 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] &
571 (MY_CHAR_U | MY_CHAR_L)) != 0;
572}
573
574inline bool my_isupper(const CHARSET_INFO *cs, char ch) {
575 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_U) != 0;
576}
577
578inline bool my_islower(const CHARSET_INFO *cs, char ch) {
579 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_L) != 0;
580}
581
582inline bool my_isdigit(const CHARSET_INFO *cs, char ch) {
583 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_NMR) != 0;
584}
585
586inline bool my_isxdigit(const CHARSET_INFO *cs, char ch) {
587 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_X) != 0;
588}
589
590inline bool my_isalnum(const CHARSET_INFO *cs, char ch) {
591 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] &
592 (MY_CHAR_U | MY_CHAR_L | MY_CHAR_NMR)) != 0;
593}
594
595inline bool my_isspace(const CHARSET_INFO *cs, char ch) {
596 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_SPC) != 0;
597}
598
599inline bool my_ispunct(const CHARSET_INFO *cs, char ch) {
600 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_PNT) != 0;
601}
602
603inline bool my_isgraph(const CHARSET_INFO *cs, char ch) {
604 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] &
606}
607
608inline bool my_iscntrl(const CHARSET_INFO *cs, char ch) {
609 return ((cs->ctype + 1)[static_cast<uint8_t>(ch)] & MY_CHAR_CTR) != 0;
610}
611
612inline bool my_isvar(const CHARSET_INFO *cs, char ch) {
613 return my_isalnum(cs, ch) || (ch == '_');
614}
615
616inline bool my_isvar_start(const CHARSET_INFO *cs, char ch) {
617 return my_isalpha(cs, ch) || (ch == '_');
618}
619
620// Properties of character sets.
621inline bool my_binary_compare(const CHARSET_INFO *cs) {
622 return (cs->state & MY_CS_BINSORT) != 0;
623}
624
625inline bool use_strnxfrm(const CHARSET_INFO *cs) {
626 return (cs->state & MY_CS_STRNXFRM) != 0;
627}
628
629// Interfaces to member functions.
630inline size_t my_strnxfrm(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen,
631 const uint8_t *src, size_t srclen) {
632 return cs->coll->strnxfrm(cs, dst, dstlen, dstlen, src, srclen, 0);
633}
634
635inline int my_strnncoll(const CHARSET_INFO *cs, const uint8_t *a,
636 size_t a_length, const uint8_t *b, size_t b_length) {
637 return cs->coll->strnncoll(cs, a, a_length, b, b_length, false);
638}
639
640inline bool my_like_range(const CHARSET_INFO *cs, const char *s,
641 size_t s_length, char w_prefix, char w_one,
642 char w_many, size_t res_length, char *min_str,
643 char *max_str, size_t *min_len, size_t *max_len) {
644 return cs->coll->like_range(cs, s, s_length, w_prefix, w_one, w_many,
645 res_length, min_str, max_str, min_len, max_len);
646}
647
648inline int my_wildcmp(const CHARSET_INFO *cs, const char *str,
649 const char *str_end, const char *wildstr,
650 const char *wildend, int escape, int w_one, int w_many) {
651 return cs->coll->wildcmp(cs, str, str_end, wildstr, wildend, escape, w_one,
652 w_many);
653}
654
655inline int my_strcasecmp(const CHARSET_INFO *cs, const char *s1,
656 const char *s2) {
657 return cs->coll->strcasecmp(cs, s1, s2);
658}
659
660inline size_t my_charpos(const CHARSET_INFO *cs, const char *beg,
661 const char *end, size_t pos) {
662 return cs->cset->charpos(cs, beg, end, pos);
663}
664
665inline size_t my_charpos(const CHARSET_INFO *cs, const unsigned char *beg,
666 const unsigned char *end, size_t pos) {
667 return cs->cset->charpos(cs, pointer_cast<const char *>(beg),
668 pointer_cast<const char *>(end), pos);
669}
670
671inline bool use_mb(const CHARSET_INFO *cs) {
672 return cs->cset->ismbchar != nullptr;
673}
674
675inline unsigned my_ismbchar(const CHARSET_INFO *cs, const char *str,
676 const char *strend) {
677 return cs->cset->ismbchar(cs, str, strend);
678}
679
680inline unsigned my_ismbchar(const CHARSET_INFO *cs, const uint8_t *str,
681 const uint8_t *strend) {
682 return cs->cset->ismbchar(cs, pointer_cast<const char *>(str),
683 pointer_cast<const char *>(strend));
684}
685
686inline unsigned my_mbcharlen(const CHARSET_INFO *cs, unsigned first_byte) {
687 return cs->cset->mbcharlen(cs, first_byte);
688}
689
690/**
691 Get the length of gb18030 code by the given two leading bytes
692
693 @param[in] cs charset_info
694 @param[in] first_byte first byte of gb18030 code
695 @param[in] second_byte second byte of gb18030 code
696 @return the length of gb18030 code starting with given two bytes,
697 the length would be 2 or 4 for valid gb18030 code,
698 or 0 for invalid gb18030 code
699*/
700inline unsigned my_mbcharlen_2(const CHARSET_INFO *cs, uint8_t first_byte,
701 uint8_t second_byte) {
702 return cs->cset->mbcharlen(cs,
703 ((first_byte & 0xFF) << 8) + (second_byte & 0xFF));
704}
705
706/**
707 Get the maximum length of leading bytes needed to determine the length of a
708 multi-byte gb18030 code
709
710 @param[in] cs charset_info
711 @return number of leading bytes we need, would be 2 for gb18030
712 and 1 for all other charsets
713*/
714inline unsigned my_mbmaxlenlen(const CHARSET_INFO *cs) {
715 return cs->mbmaxlenlen;
716}
717
718/**
719 Judge if the given byte is a possible leading byte for a charset.
720 For gb18030 whose mbmaxlenlen is 2, we can't determine the length of
721 a multi-byte character by looking at the first byte only
722
723 @param[in] cs charset_info
724 @param[in] leading_byte possible leading byte
725 @return true if it is, otherwise false
726*/
727inline bool my_ismb1st(const CHARSET_INFO *cs, unsigned leading_byte) {
728 return my_mbcharlen(cs, leading_byte) > 1 ||
729 (my_mbmaxlenlen(cs) == 2 && my_mbcharlen(cs, leading_byte) == 0);
730}
731
732inline size_t my_caseup_str(const CHARSET_INFO *cs, char *str) {
733 return cs->cset->caseup_str(cs, str);
734}
735
736inline size_t my_casedn_str(const CHARSET_INFO *cs, char *str) {
737 return cs->cset->casedn_str(cs, str);
738}
739
740inline long my_strntol(const CHARSET_INFO *cs, const char *str, size_t length,
741 int base, const char **end, int *err) {
742 return cs->cset->strntol(cs, str, length, base, end, err);
743}
744
745inline unsigned long my_strntoul(const CHARSET_INFO *cs, const char *str,
746 size_t length, int base, const char **end,
747 int *err) {
748 return cs->cset->strntoul(cs, str, length, base, end, err);
749}
750
751inline int64_t my_strntoll(const CHARSET_INFO *cs, const char *str,
752 size_t length, int base, const char **end,
753 int *err) {
754 return cs->cset->strntoll(cs, str, length, base, end, err);
755}
756
757inline uint64_t my_strntoull(const CHARSET_INFO *cs, const char *str,
758 size_t length, int base, const char **end,
759 int *err) {
760 return cs->cset->strntoull(cs, str, length, base, end, err);
761}
762
763inline double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length,
764 const char **end, int *err) {
765 return cs->cset->strntod(cs, str, length, end, err);
766}
767
769 return (cs->mbminlen == 1);
770}
771
772#endif // INCLUDE_MYSQL_STRINGS_M_CTYPE_H_
#define MYSQL_STRINGS_EXPORT
Definition: api.h:46
static Mysys_charset_loader * loader
Definition: charset.cc:184
User-specified callback interface for collation parser/initializer.
Definition: m_ctype.h:189
virtual ~MY_CHARSET_LOADER()
Definition: ctype.cc:1157
virtual void * mem_malloc(size_t size)
Definition: m_ctype.h:234
MY_CHARSET_LOADER()=default
virtual void * once_alloc(size_t)
Allocate-and-forget version of malloc().
Definition: ctype.cc:1285
MY_CHARSET_LOADER & operator=(const MY_CHARSET_LOADER &&)=delete
MY_CHARSET_LOADER(const MY_CHARSET_LOADER &)=delete
virtual void mem_free(void *ptr)
Definition: m_ctype.h:235
std::deque< void * > m_delete_list
Definition: m_ctype.h:238
int add_collation(CHARSET_INFO *cs)
Collation parser helper function (not overloadable).
Definition: ctype.cc:1163
MY_CHARSET_LOADER(const MY_CHARSET_LOADER &&)=delete
virtual void * read_file(const char *path, size_t *size)=0
Loads a file by its OS path into collation parser/initializer.
MY_CHARSET_LOADER & operator=(const MY_CHARSET_LOADER &)=delete
virtual void reporter(enum loglevel loglevel, unsigned errcode,...)=0
Intercepts error messages from collation parser/initializer.
static int flags[50]
Definition: hp_test1.cc:39
#define malloc(A)
Definition: lexyy.cc:914
#define free(A)
Definition: lexyy.cc:915
static constexpr int MY_CS_TOOSMALL4
Definition: m_ctype.h:96
static constexpr int MY_SEQ_SPACES
Definition: m_ctype.h:104
static constexpr uint32_t MY_CS_PUREASCII
Definition: m_ctype.h:139
static constexpr uint8_t MY_CHAR_CTR
Definition: m_ctype.h:548
static void MY_PUT_MB2(unsigned char *s, uint16_t code)
Definition: m_ctype.h:58
static constexpr int MY_CS_TOOSMALL
Definition: m_ctype.h:88
static constexpr uint8_t MY_CHAR_L
Definition: m_ctype.h:544
int myf
Definition: m_ctype.h:49
char my_tolower(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:565
static constexpr uint8_t MY_CHAR_NMR
Definition: m_ctype.h:545
int my_strcasecmp(const CHARSET_INFO *cs, const char *s1, const char *s2)
Definition: m_ctype.h:655
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)
Definition: m_ctype.h:640
static constexpr uint32_t MY_REPERTOIRE_UNICODE30
Definition: m_ctype.h:155
static constexpr uint32_t MY_CS_READY
Definition: m_ctype.h:131
static constexpr uint32_t MY_CS_INLINE
Definition: m_ctype.h:147
static constexpr uint8_t MY_CHAR_PNT
Definition: m_ctype.h:547
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:508
static constexpr uint32_t MY_CS_NONASCII
Definition: m_ctype.h:141
int(* my_charset_conv_wc_mb)(const CHARSET_INFO *, my_wc_t, uint8_t *, uint8_t *)
Definition: m_ctype.h:335
static constexpr uint32_t MY_CS_STRNXFRM
Definition: m_ctype.h:123
bool my_isvar_start(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:616
constexpr int MY_CS_NAME_SIZE
Definition: m_ctype.h:45
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_tolower_ci
Definition: ctype-utf8.cc:5829
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_bin
Definition: ctype-utf8.cc:7822
static constexpr uint32_t MY_CS_BINSORT
Definition: m_ctype.h:119
bool my_isxdigit(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:586
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_latin1_bin
Definition: ctype-latin1.cc:670
static constexpr int MY_CS_ILUNI
Definition: m_ctype.h:86
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_0900_ai_ci
Definition: ctype-uca.cc:9610
static constexpr uint32_t MY_STRXFRM_PAD_TO_MAXLEN
Definition: m_ctype.h:159
bool my_isupper(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:574
int64_t my_strntoll(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:751
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_unicode_ci
Definition: ctype-uca.cc:6131
size_t my_charpos(const CHARSET_INFO *cs, const char *beg, const char *end, size_t pos)
Definition: m_ctype.h:660
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.
Definition: ctype.cc:911
uint64_t my_strntoull(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:757
bool my_isalnum(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:590
static constexpr uint32_t MY_CS_LOWER_SORT
Definition: m_ctype.h:145
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)
Definition: m_ctype.h:648
size_t my_casedn_str(const CHARSET_INFO *cs, char *str)
Definition: m_ctype.h:736
static constexpr uint8_t MY_CHAR_SPC
Definition: m_ctype.h:546
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...
Definition: ctype.cc:998
bool my_ispunct(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:599
static constexpr uint32_t MY_CS_UNICODE_SUPPLEMENT
Definition: m_ctype.h:143
bool my_isvar(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:612
unsigned long my_strntoul(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:745
bool my_isdigit(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:582
static constexpr int MY_CS_TOOSMALL3
Definition: m_ctype.h:92
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.
Definition: m_ctype.h:700
size_t(* my_charset_conv_case)(const CHARSET_INFO *, char *, size_t, char *, size_t)
Definition: m_ctype.h:337
MYSQL_STRINGS_EXPORT unsigned my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len)
Definition: ctype.cc:777
int(* my_charset_conv_mb_wc)(const CHARSET_INFO *, my_wc_t *, const uint8_t *, const uint8_t *)
Definition: m_ctype.h:333
static constexpr uint32_t MY_CS_AVAILABLE
Definition: m_ctype.h:133
bool my_isspace(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:595
double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: m_ctype.h:763
bool use_strnxfrm(const CHARSET_INFO *cs)
Definition: m_ctype.h:625
static constexpr uint32_t MY_REPERTOIRE_EXTENDED
Definition: m_ctype.h:153
unsigned long 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:56
static constexpr int MY_SEQ_INTTAIL
Definition: m_ctype.h:103
bool my_iscntrl(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:608
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:365
unsigned my_mbcharlen(const CHARSET_INFO *cs, unsigned first_byte)
Definition: m_ctype.h:686
static constexpr uint32_t MY_CHARSET_UNDEFINED
Definition: m_ctype.h:109
static constexpr int MY_CS_TOOSMALL5
Definition: m_ctype.h:98
static constexpr uint32_t MY_CS_UNICODE
Definition: m_ctype.h:129
unsigned my_ismbchar(const CHARSET_INFO *cs, const char *str, const char *strend)
Definition: m_ctype.h:675
bool my_isascii(char ch)
Definition: m_ctype.h:559
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_general_ci
Definition: ctype-utf8.cc:7786
static constexpr uint32_t MY_CS_HIDDEN
Definition: m_ctype.h:137
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 're...
Definition: my_strchr.cc:63
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.
Definition: ctype.cc:970
bool my_ismb1st(const CHARSET_INFO *cs, unsigned leading_byte)
Judge if the given byte is a possible leading byte for a charset.
Definition: m_ctype.h:727
static constexpr int MY_CS_ILSEQ
Definition: m_ctype.h:84
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf16le_general_ci
Definition: ctype-ucs2.cc:1598
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_gb18030_chinese_ci
Definition: ctype-gb18030.cc:20430
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_0900_bin
Definition: ctype-uca.cc:11481
bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2)
Definition: m_ctype.h:518
size_t my_strnxfrm(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, const uint8_t *src, size_t srclen)
Definition: m_ctype.h:630
MYSQL_STRINGS_EXPORT int(* my_string_stack_guard)(int)
Definition: collations_internal.cc:42
static constexpr uint32_t MY_CS_CONFIG_UNUSED
Definition: m_ctype.h:113
long my_strntol(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:740
static constexpr uint32_t MY_CS_LOADED
Definition: m_ctype.h:117
static constexpr uint32_t MY_CS_INDEX_UNUSED
Definition: m_ctype.h:115
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_bin
Definition: ctype-utf8.cc:5899
constexpr const char * CHARSET_DIR
Definition: m_ctype.h:47
bool use_mb(const CHARSET_INFO *cs)
Definition: m_ctype.h:671
MYSQL_STRINGS_EXPORT unsigned my_charset_repertoire(const CHARSET_INFO *cs)
Definition: ctype.cc:799
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.
Definition: m_ctype.h:714
bool my_isalpha(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:569
size_t my_caseup_str(const CHARSET_INFO *cs, char *str)
Definition: m_ctype.h:732
static constexpr uint32_t MY_REPERTOIRE_ASCII
Definition: m_ctype.h:151
bool is_supported_parser_charset(const CHARSET_INFO *cs)
Definition: m_ctype.h:768
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_general_ci
Definition: ctype-utf8.cc:5794
MYSQL_STRINGS_EXPORT unsigned my_strxfrm_flag_normalize(unsigned flags)
Definition: ctype-simple.cc:1496
MYSQL_STRINGS_EXPORT bool my_charset_is_ascii_based(const CHARSET_INFO *cs)
Detect whether a character set is ASCII compatible.
Definition: m_ctype.h:514
static constexpr uint8_t MY_CHAR_X
Definition: m_ctype.h:550
static constexpr int MY_CS_TOOSMALL2
Definition: m_ctype.h:90
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)
Definition: ctype-mb.cc:1039
bool my_islower(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:578
static constexpr uint32_t MY_CS_PRIMARY
Definition: m_ctype.h:121
bool my_binary_compare(const CHARSET_INFO *cs)
Definition: m_ctype.h:621
static constexpr uint32_t MY_CS_COMPILED
Definition: m_ctype.h:111
static constexpr uint8_t MY_CHAR_B
Definition: m_ctype.h:549
int my_strnncoll(const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
Definition: m_ctype.h:635
bool my_isgraph(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:603
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_filename
Definition: ctype-utf8.cc:7056
static constexpr uint32_t MY_CS_CSSORT
Definition: m_ctype.h:135
char my_toupper(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:561
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf32_unicode_ci
Definition: ctype-uca.cc:7836
Pad_attribute
Definition: m_ctype.h:243
@ NO_PAD
Definition: m_ctype.h:243
@ PAD_SPACE
Definition: m_ctype.h:243
static constexpr int MY_CS_TOOSMALL6
Definition: m_ctype.h:100
static constexpr uint8_t MY_CHAR_U
Definition: m_ctype.h:543
static const char * strend(const char *s)
Definition: m_string.h:68
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:40
static char * path
Definition: mysqldump.cc:148
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1085
Definition: commit_order_queue.h:33
static std::string escape(const std::string &str)
Escapes (only) apostrophes.
Definition: st_units_of_measure.cc:38
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:75
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:921
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:191
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Definition: m_ctype.h:422
uint8_t casedn_multiply
Definition: m_ctype.h:444
uint8_t pad_char
Definition: m_ctype.h:450
const struct lex_state_maps_st * state_maps
Definition: m_ctype.h:440
const uint16_t * tab_to_uni
Definition: m_ctype.h:437
unsigned binary_number
Definition: m_ctype.h:425
const uint8_t * ctype
Definition: m_ctype.h:432
const char * csname
Definition: m_ctype.h:427
my_wc_t max_sort_char
Definition: m_ctype.h:449
const MY_UNICASE_INFO * caseinfo
Definition: m_ctype.h:439
bool escape_with_backslash_is_dangerous
Definition: m_ctype.h:451
unsigned number
Definition: m_ctype.h:423
const uint8_t * to_lower
Definition: m_ctype.h:433
uint8_t caseup_multiply
Definition: m_ctype.h:443
unsigned mbmaxlenlen
Definition: m_ctype.h:447
unsigned mbmaxlen
Definition: m_ctype.h:446
unsigned strxfrm_multiply
Definition: m_ctype.h:442
MY_COLLATION_HANDLER * coll
Definition: m_ctype.h:455
const uint8_t * sort_order
Definition: m_ctype.h:435
MY_CHARSET_HANDLER * cset
Definition: m_ctype.h:454
const char * m_coll_name
Definition: m_ctype.h:428
const uint8_t * ident_map
Definition: m_ctype.h:441
uint8_t levels_for_compare
Definition: m_ctype.h:452
unsigned mbminlen
Definition: m_ctype.h:445
const MY_UNI_IDX * tab_from_uni
Definition: m_ctype.h:438
struct Coll_param * coll_param
Definition: m_ctype.h:431
struct MY_UCA_INFO * uca
Definition: m_ctype.h:436
const uint8_t * to_upper
Definition: m_ctype.h:434
my_wc_t min_sort_char
Definition: m_ctype.h:448
unsigned primary_number
Definition: m_ctype.h:424
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:464
const char * tailoring
Definition: m_ctype.h:430
unsigned state
Definition: m_ctype.h:426
const char * comment
Definition: m_ctype.h:429
Definition: str_uca_type.h:73
Helper structure to return error messages from collation parser/initializer.
Definition: m_ctype.h:180
unsigned errcode
See include/mysys_err.h.
Definition: m_ctype.h:182
char errarg[errmsg_size]
Error message text.
Definition: m_ctype.h:183
static constexpr int errmsg_size
Definition: m_ctype.h:181
Definition: m_ctype.h:341
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:373
double(* strntod)(const CHARSET_INFO *, const char *s, size_t l, const char **e, int *err)
Definition: m_ctype.h:411
long long(* strtoll10)(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: m_ctype.h:413
int(* ctype)(const CHARSET_INFO *cs, int *ctype, const uint8_t *s, const uint8_t *e)
Definition: m_ctype.h:381
size_t(* well_formed_len)(const CHARSET_INFO *, const char *b, const char *e, size_t nchars, int *error)
Definition: m_ctype.h:356
size_t(* caseup_str)(const CHARSET_INFO *, char *)
Definition: m_ctype.h:385
unsigned long long(* strntoull10rnd)(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_fl, const char **endptr, int *error)
Definition: m_ctype.h:415
unsigned(* ismbchar)(const CHARSET_INFO *, const char *, const char *)
Definition: m_ctype.h:344
unsigned long long(* strntoull)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:409
unsigned long(* strntoul)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:405
bool(* init)(CHARSET_INFO *, MY_CHARSET_LOADER *loader, MY_CHARSET_ERRMSG *)
Definition: m_ctype.h:342
long(* strntol)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:403
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:354
size_t(* longlong10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix, long long val)
Definition: m_ctype.h:397
size_t(* numchars)(const CHARSET_INFO *, const char *b, const char *e)
Definition: m_ctype.h:346
size_t(* numcells)(const CHARSET_INFO *, const char *b, const char *e)
Definition: m_ctype.h:374
void(* fill)(const CHARSET_INFO *, char *to, size_t len, int fill)
Definition: m_ctype.h:400
my_charset_conv_wc_mb wc_mb
Definition: m_ctype.h:378
size_t(* scan)(const CHARSET_INFO *, const char *b, const char *e, int sq)
Definition: m_ctype.h:418
long long(* strntoll)(const CHARSET_INFO *, const char *s, size_t l, int base, const char **e, int *err)
Definition: m_ctype.h:407
my_charset_conv_mb_wc mb_wc
Definition: m_ctype.h:377
unsigned(* mbcharlen)(const CHARSET_INFO *, unsigned c)
Definition: m_ctype.h:345
my_charset_conv_case caseup
Definition: m_ctype.h:388
size_t(* casedn_str)(const CHARSET_INFO *, char *)
Definition: m_ctype.h:386
size_t(* long10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix, long int val)
Definition: m_ctype.h:395
my_charset_conv_case casedn
Definition: m_ctype.h:389
size_t(* snprintf)(const CHARSET_INFO *, char *to, size_t n, const char *fmt,...)
Definition: m_ctype.h:392
Definition: m_ctype.h:246
int(* strcasecmp)(const CHARSET_INFO *, const char *, const char *)
Definition: m_ctype.h:310
size_t(* strnxfrm)(const CHARSET_INFO *, uint8_t *dst, size_t dstlen, unsigned num_codepoints, const uint8_t *src, size_t srclen, unsigned flags)
Transform the string into a form such that memcmp() between transformed strings yields the correct co...
Definition: m_ctype.h:287
unsigned(* strstr)(const CHARSET_INFO *, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
Definition: m_ctype.h:312
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:302
int(* strnncoll)(const CHARSET_INFO *, const uint8_t *, size_t, const uint8_t *, size_t, bool)
Definition: m_ctype.h:250
void(* hash_sort)(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Compute a sort hash for the given key.
Definition: m_ctype.h:327
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:306
bool(* propagate)(const CHARSET_INFO *cs, const uint8_t *str, size_t len)
Definition: m_ctype.h:329
bool(* init)(CHARSET_INFO *, MY_CHARSET_LOADER *, MY_CHARSET_ERRMSG *)
Definition: m_ctype.h:247
int(* strnncollsp)(const CHARSET_INFO *, const uint8_t *, size_t, const uint8_t *, size_t)
Compare the two strings under the pad rules given by the collation.
Definition: m_ctype.h:261
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:301
void(* uninit)(CHARSET_INFO *, MY_CHARSET_LOADER *)
Definition: m_ctype.h:248
Definition: str_uca_type.h:124
Definition: m_ctype.h:63
uint32_t tolower
Definition: m_ctype.h:65
uint32_t toupper
Definition: m_ctype.h:64
uint32_t sort
Definition: m_ctype.h:66
Definition: m_ctype.h:69
const MY_UNICASE_CHARACTER ** page
Definition: m_ctype.h:71
my_wc_t maxchar
Definition: m_ctype.h:70
Definition: m_ctype.h:76
uint8_t * ctype
Definition: m_ctype.h:78
uint8_t pctype
Definition: m_ctype.h:77
Definition: m_ctype.h:163
uint16_t to
Definition: m_ctype.h:165
uint16_t from
Definition: m_ctype.h:164
const uint8_t * tab
Definition: m_ctype.h:166
Definition: sql_chars.h:89
Definition: m_ctype.h:169
unsigned mb_len
Definition: m_ctype.h:172
unsigned beg
Definition: m_ctype.h:170
unsigned end
Definition: m_ctype.h:171
int n
Definition: xcom_base.cc:508