From 54344f681dfc75170867c3e92dd726f9c28a3f41 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2007 13:34:44 +0500 Subject: Bug#27345 Incorrect data returned when range-read from utf8_danish_ci indexes Problem: like_range() returned wrong ranges for contractions (like 'ch' in Czech'). Fix: adding a special code to handle tricky cases: - contraction head followed by a wild character - full contraction - contraction part followed by another contraction part, but they are not a contraction together. mysql-test/r/ctype_uca.result: Adding test case mysql-test/t/ctype_uca.test: Adding test case strings/ctype-mb.c: Adding test case strings/ctype-uca.c: Allocate additional 256 bytes for flags "is contraction part". strings/ctype-ucs2.c: Adding test case --- strings/ctype-uca.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'strings/ctype-uca.c') diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 4dbda0b9239..81fb9ee1970 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7937,10 +7937,16 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Now process contractions */ if (ncontractions) { - uint size= 0x40*0x40*sizeof(uint16); /* 8K, for basic latin letter only */ + /* + 8K for weights for basic latin letter pairs, + plus 256 bytes for "is contraction part" flags. + */ + uint size= 0x40*0x40*sizeof(uint16) + 256; + char *contraction_flags; if (!(cs->contractions= (uint16*) (*alloc)(size))) return 1; bzero((void*)cs->contractions, size); + contraction_flags= ((char*) cs->contractions) + 0x40*0x40; for (i=0; i < rc; i++) { if (rule[i].curr[1]) @@ -7966,6 +7972,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Copy base weight applying primary difference */ cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; + /* Mark both letters as "is contraction part */ + contraction_flags[rule[i].curr[0]]= 1; + contraction_flags[rule[i].curr[1]]= 1; } } } -- cgit v1.2.1