1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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,5 @@
/* Copyright (c) 2010, Oracle and/or its affiliates
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
@ -28,8 +29,8 @@ test_like_range_for_charset(CHARSET_INFO *cs, const char *src, size_t src_len)
size_t min_len, max_len, min_well_formed_len, max_well_formed_len;
int error= 0;
cs->coll->like_range(cs, src, src_len, '\\', '_', '%',
sizeof(min_str), min_str, max_str, &min_len, &max_len);
my_ci_like_range(cs, src, src_len, '\\', '_', '%',
sizeof(min_str), min_str, max_str, &min_len, &max_len);
diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, cs->name);
min_well_formed_len= my_well_formed_length(cs,
min_str, min_str + min_len,
@ -626,8 +627,8 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
for (p= param; p->a; p++)
{
char ahex[64], bhex[64];
int res= cs->coll->strnncollsp(cs, (uchar *) p->a, p->alen,
(uchar *) p->b, p->blen);
int res= my_ci_strnncollsp(cs, (const uchar *) p->a, p->alen,
(const uchar *) p->b, p->blen);
str2hex(ahex, sizeof(ahex), p->a, p->alen);
str2hex(bhex, sizeof(bhex), p->b, p->blen);
diag("%-20s %-10s %-10s %10d %10d%s",
@ -640,8 +641,8 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
else
{
/* Test in reverse order */
res= cs->coll->strnncollsp(cs, (uchar *) p->b, p->blen,
(uchar *) p->a, p->alen);
res= my_ci_strnncollsp(cs, (const uchar *) p->b, p->blen,
(const uchar *) p->a, p->alen);
if (!eqres(res, -p->res))
{
diag("Comparison in reverse order failed. Expected %d, got %d",
@ -776,9 +777,9 @@ int main()
}
ok(failed == 0, "Testing my_like_range_xxx() functions");
diag("Testing cs->coll->strnncollsp()");
diag("my_ci_strnncollsp()");
failed= test_strcollsp();
ok(failed == 0, "Testing cs->coll->strnncollsp()");
ok(failed == 0, "Testing my_ci_strnncollsp()");
return exit_status();
}