From 64e89a7ed276d04c699f97186ea8f689a45c6922 Mon Sep 17 00:00:00 2001 From: V Narayanan Date: Mon, 12 Oct 2009 13:13:15 +0530 Subject: 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. --- strings/ctype-simple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'strings') 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; -- cgit v1.2.1 From ead175bb07a9101488fa59794900f65e3186a88d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 19 Oct 2009 18:23:53 +0500 Subject: Bug#45645 Mysql server close all connection and restart using lower function Problem: the "caseinfo" member of CHARSET_INFO structure was not initialized for user-defined Unicode collations, which made the server crash. Fix: initializing caseinfo properly. --- strings/ctype-uca.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'strings') diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 2ea48ddab2f..9fb18c0c472 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7858,6 +7858,8 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) return 1; } + cs->caseinfo= my_unicase_default; + if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*)))) return 1; bzero(newweights, 256*sizeof(uint16*)); -- cgit v1.2.1 From c12dad02d6014a497fec4a61f3c1df39fa9ca7f2 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 20 Oct 2009 12:47:00 +0500 Subject: A post fix for BUG#45645 Mysql server close all connection and restart using lower function - Initialized caseinfo only if it is NULL --- strings/ctype-uca.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'strings') diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 9fb18c0c472..6ae0cc3a293 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7858,7 +7858,8 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) return 1; } - cs->caseinfo= my_unicase_default; + if (!cs->caseinfo) + cs->caseinfo= my_unicase_default; if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*)))) return 1; -- cgit v1.2.1