diff options
author | unknown <marko@hundin.mysql.fi> | 2004-10-18 16:00:57 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-10-18 16:00:57 +0300 |
commit | e49389334ccdaf23a56a52064741d606f0c2db27 (patch) | |
tree | 7f0a2ed2f29ff30384cab06f13ca9dceae6c7373 /sql/ha_innodb.cc | |
parent | 2310f00af2bedf78a98836ab953f7dfc71654d3d (diff) | |
download | mariadb-git-e49389334ccdaf23a56a52064741d606f0c2db27.tar.gz |
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()
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 28f95611ae7..14c16890e65 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -429,6 +429,36 @@ innobase_mysql_print_thd( putc('\n', f); } +/********************************************************************** +Compares NUL-terminated UTF-8 strings case insensitively. + +NOTE that the exact prototype of this function has to be in +/innobase/dict/dict0dict.c! */ +extern "C" +int +innobase_strcasecmp( +/*================*/ + /* out: 0 if a=b, <0 if a<b, >1 if a>b */ + const char* a, /* in: first string to compare */ + const char* b) /* in: second string to compare */ +{ + return(my_strcasecmp(system_charset_info, a, b)); +} + +/********************************************************************** +Makes all characters in a NUL-terminated UTF-8 string lower case. + +NOTE that the exact prototype of this function has to be in +/innobase/dict/dict0dict.c! */ +extern "C" +void +innobase_casedn_str( +/*================*/ + char* a) /* in/out: string to put in lower case */ +{ + my_casedn_str(system_charset_info, a); +} + /************************************************************************* Creates a temporary file. */ extern "C" @@ -687,14 +717,7 @@ innobase_query_caching_of_table_permitted( separator between db and table */ norm_name[full_name_len] = '\0'; #ifdef __WIN__ - /* Put to lower case */ - - char* ptr = norm_name; - - while (*ptr != '\0') { - *ptr = tolower(*ptr); - ptr++; - } + innobase_casedn_str(norm_name); #endif /* The call of row_search_.. will start a new transaction if it is not yet started */ @@ -3559,9 +3582,9 @@ create_index( field = form->field[j]; - if (0 == ut_cmp_in_lower_case( - (char*)field->field_name, - (char*)key_part->field->field_name)) { + if (0 == innobase_strcasecmp( + field->field_name, + key_part->field->field_name)) { /* Found the corresponding column */ break; @@ -4003,7 +4026,7 @@ innobase_drop_database( namebuf[len] = '/'; namebuf[len + 1] = '\0'; #ifdef __WIN__ - my_casedn_str(system_charset_info, namebuf); + innobase_casedn_str(namebuf); #endif trx = trx_allocate_for_mysql(); trx->mysql_thd = current_thd; |