164
158
bool (*init)(charset_info_st&, unsigned char *(*alloc)(size_t));
165
159
/* Collation routines */
166
int (*strnncoll)(const charset_info_st*,
167
const unsigned char *, size_t, const unsigned char *, size_t, bool);
168
int (*strnncollsp)(const charset_info_st*,
169
const unsigned char *, size_t, const unsigned char *, size_t,
170
bool diff_if_only_endspace_difference);
171
size_t (*strnxfrm)(const charset_info_st*,
172
unsigned char *dst, size_t dstlen, uint32_t nweights,
173
const unsigned char *src, size_t srclen, uint32_t flags);
174
size_t (*strnxfrmlen)(const charset_info_st*, size_t);
175
bool (*like_range)(const charset_info_st*,
176
const char *s, size_t s_length,
177
char escape, char w_one, char w_many,
179
char *min_str, char *max_str,
180
size_t *min_len, size_t *max_len);
181
int (*wildcmp)(const charset_info_st*,
182
const char *str,const char *str_end,
183
const char *wildstr,const char *wildend,
184
int escape,int w_one, int w_many);
186
int (*strcasecmp)(const charset_info_st*, const char *, const char *);
188
uint32_t (*instr)(const charset_info_st*,
189
const char *b, size_t b_length,
190
const char *s, size_t s_length,
191
my_match_t *match, uint32_t nmatch);
160
int (*strnncoll)(const charset_info_st*, const unsigned char*, size_t, const unsigned char*, size_t, bool);
161
int (*strnncollsp)(const charset_info_st*, const unsigned char*, size_t, const unsigned char*, size_t, bool diff_if_only_endspace_difference);
162
size_t (*strnxfrm)(const charset_info_st*, unsigned char *dst, size_t dstlen, uint32_t nweights, const unsigned char *src, size_t srclen, uint32_t flags);
163
size_t (*strnxfrmlen)(const charset_info_st*, size_t);
164
bool (*like_range)(const charset_info_st*, const char *s, size_t s_length, char escape, char w_one, char w_many,
165
size_t res_length, char *min_str, char *max_str, size_t *min_len, size_t *max_len);
166
int (*wildcmp)(const charset_info_st*, const char *str,const char *str_end, const char *wildstr, const char *wildend, int escape,int w_one, int w_many);
168
int (*strcasecmp)(const charset_info_st*, const char*, const char *);
170
uint32_t (*instr)(const charset_info_st*, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint32_t nmatch);
193
172
/* Hash calculation */
194
void (*hash_sort)(const charset_info_st *cs, const unsigned char *key, size_t len,
195
uint32_t *nr1, uint32_t *nr2);
196
bool (*propagate)(const charset_info_st *cs, const unsigned char *str, size_t len);
173
void (*hash_sort)(const charset_info_st*, const unsigned char *key, size_t len, uint32_t *nr1, uint32_t *nr2);
199
177
/* See strings/charset_info_st.txt about information on this structure */
200
typedef struct my_charset_handler_st
178
struct MY_CHARSET_HANDLER
202
void (*init_unused)();
203
180
/* Multibyte routines */
204
uint32_t (*ismbchar)(const charset_info_st*, const char *, const char *);
205
uint32_t (*mbcharlen)(const charset_info_st*, uint32_t c);
206
size_t (*numchars)(const charset_info_st*, const char *b, const char *e);
207
size_t (*charpos)(const charset_info_st*, const char *b, const char *e, size_t pos);
208
size_t (*well_formed_len)(const charset_info_st&, str_ref, size_t nchars, int *error);
209
size_t (*lengthsp)(const charset_info_st*, const char *ptr, size_t length);
210
size_t (*numcells)(const charset_info_st*, const char *b, const char *e);
181
uint32_t (*ismbchar)(const charset_info_st*, const char*, const char *);
182
uint32_t (*mbcharlen)(const charset_info_st*, uint32_t c);
183
size_t (*numchars)(const charset_info_st*, const char *b, const char *e);
184
size_t (*charpos)(const charset_info_st*, const char *b, const char *e, size_t pos);
185
size_t (*well_formed_len)(const charset_info_st&, str_ref, size_t nchars, int *error);
186
size_t (*lengthsp)(const charset_info_st*, const char *ptr, size_t length);
187
size_t (*numcells)(const charset_info_st*, const char *b, const char *e);
212
189
/* Unicode conversion */
213
190
my_charset_conv_mb_wc mb_wc;
214
191
my_charset_conv_wc_mb wc_mb;
216
193
/* CTYPE scanner */
217
int (*ctype)(const charset_info_st *cs, int *ctype,
218
const unsigned char *s, const unsigned char *e);
194
int (*ctype)(const charset_info_st *cs, int *ctype, const unsigned char *s, const unsigned char *e);
220
196
/* Functions for case and sort conversion */
221
size_t (*caseup_str)(const charset_info_st*, char *);
222
size_t (*casedn_str)(const charset_info_st*, char *);
197
size_t (*caseup_str)(const charset_info_st*, char *);
198
size_t (*casedn_str)(const charset_info_st*, char *);
224
200
my_charset_conv_case caseup;
225
201
my_charset_conv_case casedn;
227
203
/* Charset dependant snprintf() */
228
size_t (*snprintf)(const charset_info_st*, char *to, size_t n,
204
size_t (*snprintf)(const charset_info_st*, char *to, size_t n, const char *fmt, ...)
231
205
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
232
206
__attribute__((format(printf, 4, 5)))
235
size_t (*long10_to_str)(const charset_info_st*, char *to, size_t n,
236
int radix, long int val);
237
size_t (*int64_t10_to_str)(const charset_info_st*, char *to, size_t n,
238
int radix, int64_t val);
209
size_t (*long10_to_str)(const charset_info_st*, char *to, size_t n, int radix, long int val);
210
size_t (*int64_t10_to_str)(const charset_info_st*, char *to, size_t n, int radix, int64_t val);
240
212
void (*fill)(const charset_info_st*, char *to, size_t len, int fill);
242
214
/* String-to-number conversion routines */
243
long (*strntol)(const charset_info_st*, const char *s, size_t l,
244
int base, char **e, int *err);
245
unsigned long (*strntoul)(const charset_info_st*, const char *s, size_t l,
246
int base, char **e, int *err);
247
int64_t (*strntoll)(const charset_info_st*, const char *s, size_t l,
248
int base, char **e, int *err);
249
uint64_t (*strntoull)(const charset_info_st*, const char *s, size_t l,
250
int base, char **e, int *err);
251
double (*strntod)(const charset_info_st*, char *s, size_t l, char **e,
253
int64_t (*strtoll10)(const charset_info_st *cs,
254
const char *nptr, char **endptr, int *error);
255
uint64_t (*strntoull10rnd)(const charset_info_st *cs,
256
const char *str, size_t length,
258
char **endptr, int *error);
259
size_t (*scan)(const charset_info_st*, const char *b, const char *e,
261
} MY_CHARSET_HANDLER;
215
long (*strntol)(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
216
unsigned long (*strntoul)(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
217
int64_t (*strntoll)(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
218
uint64_t (*strntoull)(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
219
double (*strntod)(const charset_info_st*, char *s, size_t l, char **e, int *err);
220
int64_t (*strtoll10)(const charset_info_st *cs, const char *nptr, char **endptr, int *error);
221
uint64_t (*strntoull10rnd)(const charset_info_st *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error);
222
size_t (*scan)(const charset_info_st*, const char *b, const char *e, int sq);
264
225
/* See strings/charset_info_st.txt about information on this structure */
265
226
struct charset_info_st
331
284
extern DRIZZLED_API charset_info_st my_charset_utf8mb4_general_ci;
332
285
extern DRIZZLED_API charset_info_st my_charset_utf8mb4_unicode_ci;
333
286
size_t my_strnxfrmlen_simple(const charset_info_st*, size_t);
334
extern int my_strnncollsp_simple(const charset_info_st*, const unsigned char *, size_t,
335
const unsigned char *, size_t,
336
bool diff_if_only_endspace_difference);
337
extern size_t my_lengthsp_8bit(const charset_info_st* cs, const char *ptr, size_t length);
338
extern uint32_t my_instr_simple(const charset_info_st*,
339
const char *b, size_t b_length,
340
const char *s, size_t s_length,
341
my_match_t *match, uint32_t nmatch);
287
extern int my_strnncollsp_simple(const charset_info_st*, const unsigned char*, size_t, const unsigned char*, size_t, bool diff_if_only_endspace_difference);
288
extern size_t my_lengthsp_8bit(const charset_info_st*, const char *ptr, size_t length);
289
extern uint32_t my_instr_simple(const charset_info_st*, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, uint32_t nmatch);
342
290
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
343
291
extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
344
292
extern int my_strcasecmp_mb(const charset_info_st* cs, const char *s, const char *t);
345
extern bool my_parse_charset_xml(const char *bug, size_t len,
346
int (*add)(charset_info_st *cs));
293
extern bool my_parse_charset_xml(const char *bug, size_t len, int (*add)(charset_info_st *cs));
348
295
DRIZZLED_API const charset_info_st *get_charset(uint32_t cs_number);
349
296
DRIZZLED_API const charset_info_st *get_charset_by_name(const char *cs_name);
350
297
DRIZZLED_API const charset_info_st *get_charset_by_csname(const char *cs_name, uint32_t cs_flags);
352
299
/* Functions for 8bit */
353
int my_mb_ctype_8bit(const charset_info_st*,int *, const unsigned char *,const unsigned char *);
354
int my_mb_ctype_mb(const charset_info_st*,int *, const unsigned char *,const unsigned char *);
356
size_t my_scan_8bit(const charset_info_st* cs, const char *b, const char *e, int sq);
358
size_t my_snprintf_8bit(const charset_info_st*, char *to, size_t n,
359
const char *fmt, ...)
360
__attribute__((format(printf, 4, 5)));
362
long my_strntol_8bit(const charset_info_st*, const char *s, size_t l, int base,
364
unsigned long my_strntoul_8bit(const charset_info_st*, const char *s, size_t l, int base,
366
int64_t my_strntoll_8bit(const charset_info_st*, const char *s, size_t l, int base,
368
uint64_t my_strntoull_8bit(const charset_info_st*, const char *s, size_t l, int base,
370
double my_strntod_8bit(const charset_info_st*, char *s, size_t l,char **e,
372
size_t my_long10_to_str_8bit(const charset_info_st*, char *to, size_t l, int radix,
374
size_t my_int64_t10_to_str_8bit(const charset_info_st*, char *to, size_t l, int radix,
376
int64_t my_strtoll10_8bit(const charset_info_st* cs,
377
const char *nptr, char **endptr, int *error);
378
int64_t my_strtoll10_ucs2(charset_info_st *cs,
379
const char *nptr, char **endptr, int *error);
381
uint64_t my_strntoull10rnd_8bit(const charset_info_st* cs,
382
const char *str, size_t length, int
383
unsigned_fl, char **endptr, int *error);
384
uint64_t my_strntoull10rnd_ucs2(charset_info_st *cs,
385
const char *str, size_t length,
386
int unsigned_fl, char **endptr, int *error);
388
void my_fill_8bit(const charset_info_st* cs, char* to, size_t l, int fill);
390
bool my_like_range_simple(const charset_info_st* cs,
300
int my_mb_ctype_8bit(const charset_info_st*,int *, const unsigned char*,const unsigned char *);
301
int my_mb_ctype_mb(const charset_info_st*,int *, const unsigned char*,const unsigned char *);
303
size_t my_scan_8bit(const charset_info_st*, const char *b, const char *e, int sq);
304
size_t my_snprintf_8bit(const charset_info_st*, char *to, size_t n, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
306
long my_strntol_8bit(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
307
unsigned long my_strntoul_8bit(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
308
int64_t my_strntoll_8bit(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
309
uint64_t my_strntoull_8bit(const charset_info_st*, const char *s, size_t l, int base, char **e, int *err);
310
double my_strntod_8bit(const charset_info_st*, char *s, size_t l,char **e, int *err);
311
size_t my_long10_to_str_8bit(const charset_info_st*, char *to, size_t l, int radix, long int val);
312
size_t my_int64_t10_to_str_8bit(const charset_info_st*, char *to, size_t l, int radix, int64_t val);
313
int64_t my_strtoll10_8bit(const charset_info_st*, const char *nptr, char **endptr, int *error);
314
int64_t my_strtoll10_ucs2(charset_info_st *cs, const char *nptr, char **endptr, int *error);
316
uint64_t my_strntoull10rnd_8bit(const charset_info_st*, const char *str, size_t length, int unsigned_fl, char **endptr, int *error);
317
uint64_t my_strntoull10rnd_ucs2(charset_info_st *cs, const char *str, size_t length, int unsigned_fl, char **endptr, int *error);
319
void my_fill_8bit(const charset_info_st*, char* to, size_t l, int fill);
321
bool my_like_range_simple(const charset_info_st*,
391
322
const char *ptr, size_t ptr_length,
392
323
char escape, char w_one, char w_many,
393
324
size_t res_length,
394
325
char *min_str, char *max_str,
395
326
size_t *min_length, size_t *max_length);
397
bool my_like_range_mb(const charset_info_st* cs,
328
bool my_like_range_mb(const charset_info_st*,
398
329
const char *ptr, size_t ptr_length,
399
330
char escape, char w_one, char w_many,
400
331
size_t res_length,
401
332
char *min_str, char *max_str,
402
333
size_t *min_length, size_t *max_length);
404
bool my_like_range_ucs2(const charset_info_st* cs,
335
bool my_like_range_ucs2(const charset_info_st*,
405
336
const char *ptr, size_t ptr_length,
406
337
char escape, char w_one, char w_many,
407
338
size_t res_length,
408
339
char *min_str, char *max_str,
409
340
size_t *min_length, size_t *max_length);
411
bool my_like_range_utf16(const charset_info_st* cs,
342
bool my_like_range_utf16(const charset_info_st*,
412
343
const char *ptr, size_t ptr_length,
413
344
char escape, char w_one, char w_many,
414
345
size_t res_length,
415
346
char *min_str, char *max_str,
416
347
size_t *min_length, size_t *max_length);
418
bool my_like_range_utf32(const charset_info_st* cs,
349
bool my_like_range_utf32(const charset_info_st*,
419
350
const char *ptr, size_t ptr_length,
420
351
char escape, char w_one, char w_many,
421
352
size_t res_length,
515
446
- positive number if s > t
516
447
- 0 is the strings are equal
518
int my_wc_mb_filename(const charset_info_st*,
519
my_wc_t wc, unsigned char *s, unsigned char *e);
521
int my_mb_wc_filename(const charset_info_st*,
522
my_wc_t *pwc, const unsigned char *s, const unsigned char *e);
525
unsigned int my_ismbchar_utf8mb4(const charset_info_st* cs, const char *b, const char *e);
449
int my_wc_mb_filename(const charset_info_st*, my_wc_t wc, unsigned char *s, unsigned char *e);
451
int my_mb_wc_filename(const charset_info_st*, my_wc_t *pwc, const unsigned char *s, const unsigned char *e);
454
unsigned int my_ismbchar_utf8mb4(const charset_info_st*, const char *b, const char *e);
526
455
unsigned int my_mbcharlen_utf8mb4(const charset_info_st*, uint32_t c);
528
457
size_t my_strnxfrmlen_utf8mb4(const charset_info_st*, size_t len);
530
my_strnxfrm_utf8mb4(const charset_info_st* cs,
459
my_strnxfrm_utf8mb4(const charset_info_st*,
531
460
unsigned char *dst, size_t dstlen, uint32_t nweights,
532
461
const unsigned char *src, size_t srclen, uint32_t flags);
534
int my_wildcmp_utf8mb4(const charset_info_st* cs,
463
int my_wildcmp_utf8mb4(const charset_info_st*,
535
464
const char *str, const char *strend,
536
465
const char *wildstr, const char *wildend,
537
466
int escape, int w_one, int w_many);
538
int my_strnncollsp_utf8mb4(const charset_info_st* cs,
467
int my_strnncollsp_utf8mb4(const charset_info_st*,
539
468
const unsigned char *s, size_t slen,
540
469
const unsigned char *t, size_t tlen,
541
470
bool diff_if_only_endspace_difference);
542
int my_strcasecmp_utf8mb4(const charset_info_st* cs,
471
int my_strcasecmp_utf8mb4(const charset_info_st*,
543
472
const char *s, const char *t);
545
int my_strnncoll_utf8mb4(const charset_info_st* cs,
474
int my_strnncoll_utf8mb4(const charset_info_st*,
546
475
const unsigned char *s, size_t slen,
547
476
const unsigned char *t, size_t tlen,
548
477
bool t_is_prefix);
550
int my_mb_wc_utf8mb4(const charset_info_st* cs,
479
int my_mb_wc_utf8mb4(const charset_info_st*,
551
480
my_wc_t * pwc, const unsigned char *s, const unsigned char *e);
553
int my_wc_mb_utf8mb4(const charset_info_st* cs,
482
int my_wc_mb_utf8mb4(const charset_info_st*,
554
483
my_wc_t wc, unsigned char *r, unsigned char *e);
556
size_t my_caseup_str_utf8mb4(const charset_info_st* cs, char *src);
557
size_t my_casedn_str_utf8mb4(const charset_info_st* cs, char *src);
485
size_t my_caseup_str_utf8mb4(const charset_info_st*, char *src);
486
size_t my_casedn_str_utf8mb4(const charset_info_st*, char *src);
559
size_t my_caseup_utf8mb4(const charset_info_st* cs, char *src, size_t srclen,
488
size_t my_caseup_utf8mb4(const charset_info_st*, char *src, size_t srclen,
560
489
char *dst, size_t dstlen);
561
size_t my_casedn_utf8mb4(const charset_info_st* cs,
490
size_t my_casedn_utf8mb4(const charset_info_st*,
562
491
char *src, size_t srclen,
563
492
char *dst, size_t dstlen);
566
int my_strnncoll_any_uca(const charset_info_st* cs,
495
int my_strnncoll_any_uca(const charset_info_st*,
567
496
const unsigned char *s, size_t slen,
568
497
const unsigned char *t, size_t tlen,
569
498
bool t_is_prefix);
571
int my_strnncollsp_any_uca(const charset_info_st* cs,
500
int my_strnncollsp_any_uca(const charset_info_st*,
572
501
const unsigned char *s, size_t slen,
573
502
const unsigned char *t, size_t tlen,
574
503
bool diff_if_only_endspace_difference);
576
void my_hash_sort_any_uca(const charset_info_st* cs,
505
void my_hash_sort_any_uca(const charset_info_st*,
577
506
const unsigned char *s, size_t slen,
578
507
uint32_t *n1, uint32_t *n2);
580
size_t my_strnxfrm_any_uca(const charset_info_st* cs,
509
size_t my_strnxfrm_any_uca(const charset_info_st*,
581
510
unsigned char *dst, size_t dstlen, uint32_t nweights,
582
511
const unsigned char *src, size_t srclen,
585
int my_wildcmp_uca(const charset_info_st* cs,
514
int my_wildcmp_uca(const charset_info_st*,
586
515
const char *str,const char *str_end,
587
516
const char *wildstr,const char *wildend,
588
517
int escape, int w_one, int w_many);