summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorV Narayanan <v.narayanan@sun.com>2009-10-12 13:13:15 +0530
committerV Narayanan <v.narayanan@sun.com>2009-10-12 13:13:15 +0530
commit64e89a7ed276d04c699f97186ea8f689a45c6922 (patch)
treefcc774647b659c9e249e99fa5c0dc29ee60a65ee /strings
parentf1c2f6e84e21598c231e177fe147b7d7a2b4f192 (diff)
downloadmariadb-git-64e89a7ed276d04c699f97186ea8f689a45c6922.tar.gz
Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
In MySQL when the mapping for space is changed to something other than 0x20 by defining a different collation, then space is not ignored when comparing two strings. This was happening because the function that performs the comparison of two strings while ignoring ending spaces, was comparing the collation value of a space with the ascii value of the ' ' character. This should be changed to do comparison between the collated values. mysql-test/r/ctype_ldml.result: Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 Result file for test case. mysql-test/std_data/Index.xml: Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 Added entry for new test collation in the index file. mysql-test/std_data/latin1.xml: Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 Added support for new collation for test. mysql-test/t/ctype_ldml.test: Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 Added test case to ensure trailing spaces are not ignored. strings/ctype-simple.c: Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20 change my_strnncollsp_simple to compare collated values when checking for trailing spaces. Currently the comparison happens between a collated value and the ascii value.
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-simple.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 7de00025eda..4f3aaa6f668 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -185,8 +185,8 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length,
}
for (end= a + a_length-length; a < end ; a++)
{
- if (map[*a] != ' ')
- return (map[*a] < ' ') ? -swap : swap;
+ if (map[*a] != map[' '])
+ return (map[*a] < map[' ']) ? -swap : swap;
}
}
return res;