mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
InnoDB: Treat UTF-8 strings properly in case insensitive operations
innobase/dict/dict0dict.c: Use innobase_strcasecmp() and innobase_casedn_str() instead of ut_cmp_in_lower_case() and ut_cpy_in_lower_case() innobase/include/ut0byte.h: Remove ut_cpy_in_lower_case() and ut_cmp_in_lower_case() innobase/ut/ut0byte.c: Remove ut_cpy_in_lower_case() and ut_cmp_in_lower_case() sql/ha_innodb.cc: Add innobase_strcasecmp() and innobase_casedn_str() Replace tolower() loop with innobase_casedn_str() Replace my_casedn_str() with innobase_casedn_str() Replace ut_cmp_in_lower_case() with innobase_strcasecmp()
This commit is contained in:
parent
2310f00af2
commit
e49389334c
4 changed files with 71 additions and 102 deletions
|
|
@ -29,51 +29,3 @@ ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high)
|
|||
UT_SORT_FUNCTION_BODY(ut_dulint_sort, arr, aux_arr, low, high,
|
||||
ut_dulint_cmp);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
Copies a string to a memory location, setting characters to lower case. */
|
||||
|
||||
void
|
||||
ut_cpy_in_lower_case(
|
||||
/*=================*/
|
||||
char* dest, /* in: destination */
|
||||
const char* source, /* in: source */
|
||||
ulint len) /* in: string length */
|
||||
{
|
||||
ulint i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
dest[i] = tolower(source[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
Compares two strings when converted to lower case. */
|
||||
|
||||
int
|
||||
ut_cmp_in_lower_case(
|
||||
/*=================*/
|
||||
/* out: -1, 0, 1 if str1 < str2, str1 == str2,
|
||||
str1 > str2, respectively */
|
||||
const char* str1, /* in: string1 */
|
||||
const char* str2) /* in: string2 */
|
||||
{
|
||||
for (;;) {
|
||||
int c1, c2;
|
||||
if (!*str1) {
|
||||
return(*str2 ? -1 : 0);
|
||||
} else if (!*str2) {
|
||||
return 1;
|
||||
}
|
||||
c1 = tolower(*str1++);
|
||||
c2 = tolower(*str2++);
|
||||
if (c1 < c2) {
|
||||
return(-1);
|
||||
}
|
||||
if (c1 > c2) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue