mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
ha_innodb.cc:
A partial bugfix to a multibyte charset / column prefix index bug: my_charpos() does not handle right some cases, we try to mask the bug for ASCII chars < 128 in the UTF-8 charset sql/ha_innodb.cc: A partial bugfix to a multibyte charset / column prefix index bug: my_charpos() does not handle right some cases, we try to mask the bug for ASCII chars < 128 in the UTF-8 charset
This commit is contained in:
@@ -5317,13 +5317,10 @@ innobase_get_at_most_n_mbchars(
|
|||||||
ulint data_len, /* in: length of the string in bytes */
|
ulint data_len, /* in: length of the string in bytes */
|
||||||
const char* str) /* in: character string */
|
const char* str) /* in: character string */
|
||||||
{
|
{
|
||||||
ulint byte_length; /* string length in bytes. */
|
|
||||||
ulint char_length; /* character length in bytes */
|
ulint char_length; /* character length in bytes */
|
||||||
ulint n_chars; /* number of characters in prefix */
|
ulint n_chars; /* number of characters in prefix */
|
||||||
CHARSET_INFO* charset; /* charset used in the field */
|
CHARSET_INFO* charset; /* charset used in the field */
|
||||||
|
|
||||||
byte_length = data_len;
|
|
||||||
|
|
||||||
charset = get_charset(charset_id, MYF(MY_WME));
|
charset = get_charset(charset_id, MYF(MY_WME));
|
||||||
|
|
||||||
ut_ad(charset);
|
ut_ad(charset);
|
||||||
@@ -5339,13 +5336,42 @@ innobase_get_at_most_n_mbchars(
|
|||||||
full character. */
|
full character. */
|
||||||
|
|
||||||
if (charset->mbmaxlen > 1) {
|
if (charset->mbmaxlen > 1) {
|
||||||
|
/* ulint right_value; */
|
||||||
|
|
||||||
/* my_charpos() returns the byte length of the first n_chars
|
/* my_charpos() returns the byte length of the first n_chars
|
||||||
characters, or the end of the last full character */
|
characters, or the end of the last full character */
|
||||||
|
|
||||||
char_length = my_charpos(charset, str,
|
char_length = my_charpos(charset, str,
|
||||||
str + byte_length, n_chars);
|
str + data_len, n_chars);
|
||||||
|
|
||||||
|
/*################################################*/
|
||||||
|
/* TODO: my_charpos sometimes returns a non-sensical value
|
||||||
|
that is BIGGER than data_len: try to fix this bug partly with
|
||||||
|
these heuristics. This is NOT a complete bug fix! */
|
||||||
|
|
||||||
|
if (char_length > data_len) {
|
||||||
|
char_length = data_len;
|
||||||
|
}
|
||||||
|
/*################################################*/
|
||||||
|
|
||||||
|
/* printf("data_len %lu, n_chars %lu, char_len %lu\n",
|
||||||
|
data_len, n_chars, char_length);
|
||||||
|
if (data_len < n_chars) {
|
||||||
|
right_value = data_len;
|
||||||
|
} else {
|
||||||
|
right_value = n_chars;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (right_value != char_length) {
|
||||||
|
printf("ERRRRRROOORRRRRRRRRRRR!!!!!!!!!\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
char_length = prefix_len;
|
if (data_len < prefix_len) {
|
||||||
|
char_length = data_len;
|
||||||
|
} else {
|
||||||
|
char_length = prefix_len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(char_length);
|
return(char_length);
|
||||||
|
Reference in New Issue
Block a user