From eb852073c3fcb53630ea70fa775d30e15cbc903a Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 9 Nov 2009 13:45:40 +0400 Subject: [PATCH] Backporting Bug#37129 LDML lacks rule --- mysql-test/r/ctype_ldml.result | Bin 7967 -> 9019 bytes mysql-test/std_data/Index.xml | 12 +++++++++++- mysql-test/t/ctype_ldml.test | 19 +++++++++++++++++++ strings/ctype-uca.c | 11 +++++++++++ strings/ctype.c | 5 ++++- 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result index 812f7f87d7dd63a2104bbee3bd2ee462c568bd21..388b1373cf968d87d8e46d3bf008b79698c9b5d6 100644 GIT binary patch delta 810 zcma)4O>fgc5EW1)b}#e-qy$ydTo2m3b0{?KrLXcvKvO)=1G(iRK%}{_zm9`M^ zETM})PJx9X>_vemCabzm%seHVaG9LvK0i2~iijV0LHhQoH9V1i>)<*<)QQv@RYFLM z_FTsvJ21Ap0|%r9CXLvf!@lkI`nGGntQSjEGye#szg7zObuj&L_wmNQJ=k+bU>c*3 z;>ai&n@wn2RcKWzxS&!s(u?(cuJ2z$CSt`USl8f_E{io?gAh@( znPJv6dOBj!5mVe6)>>+#M8ha{=*Ss3y)it89e4OzwKsIP9T&RqK-=%=W{KWYtwjFS zp=ge5HnY~K>J_7%Y^zk8C4XC`eIIjg?CH7G(-$kbwyymOXQsX1w4Sl{KL?6kzhbM& zAQeB$xD|2tnh0&M0PhO$qOSh8kf7V{@Xh6$Nzd=(FTOs^Khlc$;4;rEJ$u&p_A}qS F_ZyZr*>eB@ delta 19 bcmdn(Hs5Z7mmfn0-K8+awR{#g| diff --git a/mysql-test/std_data/Index.xml b/mysql-test/std_data/Index.xml index 40fe70ebca0..4feb868583e 100644 --- a/mysql-test/std_data/Index.xml +++ b/mysql-test/std_data/Index.xml @@ -1,10 +1,20 @@ + + + \u0000 + \u0020 + \u0028 + \u0029 + \u002B + \u002D + + a - b + b diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test index d0a5e5e4896..e177c4522ae 100644 --- a/mysql-test/t/ctype_ldml.test +++ b/mysql-test/t/ctype_ldml.test @@ -4,11 +4,30 @@ drop table if exists t1; --enable_warnings +--echo In the following tests we change the order of letter "b" +--echo making it equal to letter "a", and check that it works +--echo with all Unicode character sets set names utf8; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR show variables like 'character_sets_dir%'; +show collation like 'utf8_phone_ci'; +CREATE TABLE t1 ( + name VARCHAR(64), + phone VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_phone_ci +); +INSERT INTO t1 VALUES ('Svoj','+7 912 800 80 02'); +INSERT INTO t1 VALUES ('Hf','+7 (912) 800 80 04'); +INSERT INTO t1 VALUES ('Bar','+7-912-800-80-01'); +INSERT INTO t1 VALUES ('Ramil','(7912) 800 80 03'); +INSERT INTO t1 VALUES ('Sanja','+380 (912) 8008005'); +SELECT * FROM t1 ORDER BY phone; +SELECT * FROM t1 WHERE phone='+7(912)800-80-01'; +SELECT * FROM t1 WHERE phone='79128008001'; +SELECT * FROM t1 WHERE phone='7 9 1 2 8 0 0 8 0 0 1'; +DROP TABLE t1; + show collation like 'utf8_test_ci'; create table t1 (c1 char(1) character set utf8 collate utf8_test_ci); insert into t1 values ('a'); diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index ecf92c1b7d4..ee4d052b3b3 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7661,6 +7661,13 @@ static my_coll_lexem_num my_coll_lexem_next(MY_COLL_LEXEM *lexem) goto ex; } + if (beg[0] == '=') + { + beg++; + rc= MY_COLL_LEXEM_DIFF; + goto ex; + } + if (beg[0] == '<') { for (beg++, lexem->diff= 1; @@ -7821,6 +7828,10 @@ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, item.diff[1]= 0; item.diff[2]= 0; } + else if (lexem.diff == 0) + { + item.diff[0]= item.diff[1]= item.diff[2]= 0; + } if (nitems >= mitems) { my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Too many rules"); diff --git a/strings/ctype.c b/strings/ctype.c index 75d76aceea3..4891e657b6e 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -74,6 +74,7 @@ struct my_cs_file_section_st #define _CS_DIFF1 19 #define _CS_DIFF2 20 #define _CS_DIFF3 21 +#define _CS_IDENTICAL 22 static struct my_cs_file_section_st sec[] = @@ -108,6 +109,7 @@ static struct my_cs_file_section_st sec[] = {_CS_DIFF1, "charsets/charset/collation/rules/p"}, {_CS_DIFF2, "charsets/charset/collation/rules/s"}, {_CS_DIFF3, "charsets/charset/collation/rules/t"}, + {_CS_IDENTICAL, "charsets/charset/collation/rules/i"}, {0, NULL} }; @@ -269,6 +271,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) case _CS_DIFF1: case _CS_DIFF2: case _CS_DIFF3: + case _CS_IDENTICAL: { /* Convert collation description from @@ -276,7 +279,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) into ICU Collation Customization expression. */ char arg[16]; - const char *cmd[]= {"&","<","<<","<<<"}; + const char *cmd[]= {"&","<","<<","<<<","="}; i->cs.tailoring= i->tailoring; mstr(arg,attr,len,sizeof(arg)-1); if (i->tailoring_length + 20 < sizeof(i->tailoring))