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,4 +1,4 @@
/* Copyright (C) 2010, 2019, MariaDB Corporation.
/* Copyright (C) 2010, 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
@ -44,9 +44,8 @@ void engine_option_value::link(engine_option_value **start,
/* check duplicates to avoid writing them to frm*/
for(opt= *start;
opt && ((opt->parsed && !opt->value.str) ||
my_strnncoll(system_charset_info,
(uchar *)name.str, name.length,
(uchar*)opt->name.str, opt->name.length));
system_charset_info->strnncoll(name.str, name.length,
opt->name.str, opt->name.length));
opt= opt->next) /* no-op */;
if (opt)
{
@ -187,9 +186,8 @@ static bool set_one_value(ha_create_table_option *opt,
for (end=start;
*end && *end != ',';
end++) /* no-op */;
if (!my_strnncoll(system_charset_info,
(uchar*)start, end-start,
(uchar*)value->str, value->length))
if (!system_charset_info->strnncoll(start, end-start,
value->str, value->length))
{
*val= num;
DBUG_RETURN(0);
@ -211,29 +209,17 @@ static bool set_one_value(ha_create_table_option *opt,
if (!value->str)
DBUG_RETURN(0);
if (!my_strnncoll(system_charset_info,
(const uchar*)"NO", 2,
(uchar *)value->str, value->length) ||
!my_strnncoll(system_charset_info,
(const uchar*)"OFF", 3,
(uchar *)value->str, value->length) ||
!my_strnncoll(system_charset_info,
(const uchar*)"0", 1,
(uchar *)value->str, value->length))
if (!system_charset_info->strnncoll("NO", 2, value->str, value->length) ||
!system_charset_info->strnncoll("OFF", 3, value->str, value->length) ||
!system_charset_info->strnncoll("0", 1, value->str, value->length))
{
*val= FALSE;
DBUG_RETURN(FALSE);
}
if (!my_strnncoll(system_charset_info,
(const uchar*)"YES", 3,
(uchar *)value->str, value->length) ||
!my_strnncoll(system_charset_info,
(const uchar*)"ON", 2,
(uchar *)value->str, value->length) ||
!my_strnncoll(system_charset_info,
(const uchar*)"1", 1,
(uchar *)value->str, value->length))
if (!system_charset_info->strnncoll("YES", 3, value->str, value->length) ||
!system_charset_info->strnncoll("ON", 2, value->str, value->length) ||
!system_charset_info->strnncoll("1", 1, value->str, value->length))
{
*val= TRUE;
DBUG_RETURN(FALSE);
@ -295,9 +281,8 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
for (val= *option_list; val; val= val->next)
{
last= val;
if (my_strnncoll(system_charset_info,
(uchar*)opt->name, opt->name_length,
(uchar*)val->name.str, val->name.length))
if (system_charset_info->strnncoll(opt->name, opt->name_length,
val->name.str, val->name.length))
continue;
/* skip duplicates (see engine_option_value constructor above) */
@ -809,9 +794,8 @@ bool is_engine_option_known(engine_option_value *opt,
for (; rules->name; rules++)
{
if (!my_strnncoll(system_charset_info,
(uchar*)rules->name, rules->name_length,
(uchar*)opt->name.str, opt->name.length))
if (!system_charset_info->strnncoll(rules->name, rules->name_length,
opt->name.str, opt->name.length))
return true;
}
return false;