1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-21581 Helper functions and methods for CHARSET_INFO

This commit is contained in:
Alexander Barkov
2020-01-26 20:27:13 +04:00
parent dd68ba74f3
commit f1e13fdc8d
118 changed files with 1416 additions and 1025 deletions

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009, 2013 Monty Program Ab.
Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -338,9 +338,9 @@ to_ascii(CHARSET_INFO *cs,
const char *srcend= src + src_length;
char *dst0= dst, *dstend= dst + dst_length - 1;
while (dst < dstend &&
(cnvres= (cs->cset->mb_wc)(cs, &wc,
(const uchar*) src,
(const uchar*) srcend)) > 0 &&
(cnvres= cs->mb_wc(&wc,
(const uchar*) src,
(const uchar*) srcend)) > 0 &&
wc < 128)
{
src+= cnvres;
@ -734,9 +734,7 @@ bool parse_date_time_format(timestamp_type format_type,
this. If separators are used, they must be between each part
*/
if (format_length == 6 && !need_p &&
!my_strnncoll(&my_charset_bin,
(const uchar *) format, 6,
(const uchar *) format_str, 6))
!my_charset_bin.strnncoll(format, 6, format_str, 6))
return 0;
if (separator_map == (1 | 2))
{
@ -757,9 +755,9 @@ bool parse_date_time_format(timestamp_type format_type,
Between DATE and TIME we also allow space as separator
*/
if ((format_length == 12 && !need_p &&
!my_strnncoll(&my_charset_bin,
(const uchar *) format, 12,
(const uchar*) known_date_time_formats[INTERNAL_FORMAT].datetime_format,
!my_charset_bin.strnncoll(
format, 12,
known_date_time_formats[INTERNAL_FORMAT].datetime_format,
12)) ||
(separators == 5 && separator_map == (1 | 2 | 8 | 16)))
return 0;