1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-26669 Add MY_COLLATION_HANDLER functions min_str() and max_str()

This commit is contained in:
Alexander Barkov
2021-09-23 18:46:37 +04:00
parent 7697216371
commit 0d68b0a2d6
23 changed files with 683 additions and 87 deletions

View File

@@ -16,6 +16,7 @@
#include "strings_def.h"
#include <m_ctype.h>
#include "ctype-simple.h"
#include "my_sys.h" /* Needed for MY_ERRNO_ERANGE */
#include <errno.h>
@@ -891,6 +892,35 @@ cnv:
}
size_t my_min_str_8bit_simple(CHARSET_INFO *cs,
uchar *dst, size_t dst_size,
size_t nchars)
{
set_if_smaller(dst_size, nchars);
memset(dst, cs->min_sort_char, dst_size);
return dst_size;
}
size_t my_min_str_8bit_simple_nopad(CHARSET_INFO *cs,
uchar *dst, size_t dst_size,
size_t nchars)
{
/* For NOPAD collations, the empty string is always the smallest */
return 0;
}
size_t my_max_str_8bit_simple(CHARSET_INFO *cs,
uchar *dst, size_t dst_size,
size_t nchars)
{
set_if_smaller(dst_size, nchars);
memset(dst, cs->max_sort_char, dst_size);
return dst_size;
}
/*
** Compare string against string with wildcard
** 0 if matched
@@ -2104,7 +2134,9 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
my_strcasecmp_8bit,
my_instr_simple,
my_hash_sort_simple,
my_propagate_simple
my_propagate_simple,
my_min_str_8bit_simple,
my_max_str_8bit_simple
};
@@ -2120,5 +2152,7 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler =
my_strcasecmp_8bit,
my_instr_simple,
my_hash_sort_simple_nopad,
my_propagate_simple
my_propagate_simple,
my_min_str_8bit_simple_nopad,
my_max_str_8bit_simple
};