From 6d6b38c27fcac1da19a11fa07a5f02c2c22635fe Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Nov 2004 11:58:40 +0400 Subject: Bug #6737: REGEXP gives wrong result with case sensitive collation: - A new flag MY_CS_CSSORT was introduced for case sensitivity. - Item_func_regexp doesn't substiture ICASE not only for binary collations but for case sensitive collations as well. --- strings/ctype-czech.c | 12 ++++++------ strings/ctype-win1250ch.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'strings') diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 6f9e9f74d35..2177a18504e 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -589,12 +589,12 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler = CHARSET_INFO my_charset_latin2_czech_ci = { - 2,0,0, /* number */ - MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ - "latin2", /* cs name */ - "latin2_czech_cs", /* name */ - "", /* comment */ - NULL, /* tailoring */ + 2,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ + "latin2", /* cs name */ + "latin2_czech_cs", /* name */ + "", /* comment */ + NULL, /* tailoring */ ctype_czech, to_lower_czech, to_upper_czech, diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index b4dbda3e8ed..4ada3d47bf5 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -624,12 +624,12 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler = CHARSET_INFO my_charset_cp1250_czech_ci = { - 34,0,0, /* number */ - MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ - "cp1250", /* cs name */ - "cp1250_czech_cs", /* name */ - "", /* comment */ - NULL, /* tailoring */ + 34,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ + "cp1250", /* cs name */ + "cp1250_czech_cs", /* name */ + "", /* comment */ + NULL, /* tailoring */ ctype_win1250ch, to_lower_win1250ch, to_upper_win1250ch, -- cgit v1.2.1 From abb53b6f99ffdabb41b71dca70f93701bea9c772 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Nov 2004 13:02:27 +0400 Subject: uca-dump.c: Mofidications to dump secondary and tertiary weigthts And some minor improvements strings/uca-dump.c: Mofidications to dump secondary and tertiary weigthts And some minor improvements --- strings/uca-dump.c | 80 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 24 deletions(-) (limited to 'strings') diff --git a/strings/uca-dump.c b/strings/uca-dump.c index 6836c321526..c9642598c3c 100644 --- a/strings/uca-dump.c +++ b/strings/uca-dump.c @@ -23,13 +23,14 @@ struct uca_item_st #define MY_UCA_PSHIFT 8 #endif +static char *pname[]= {"", "2", "3"}; + int main(int ac, char **av) { char str[256]; char *weights[64]; struct uca_item_st uca[64*1024]; - size_t code, page, w; - int pagemaxlen[MY_UCA_NPAGES]; + size_t code, w; int pageloaded[MY_UCA_NPAGES]; bzero(uca, sizeof(uca)); @@ -155,14 +156,20 @@ int main(int ac, char **av) printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK); printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT); - for (w=0; w<1; w++) + for (w=0; w<3; w++) { + size_t page; + int pagemaxlen[MY_UCA_NPAGES]; + for (page=0; page < MY_UCA_NPAGES; page++) { size_t offs; size_t maxnum= 0; size_t nchars= 0; size_t mchars; + size_t ndefs= 0; + + pagemaxlen[page]= 0; /* Skip this page if no weights were loaded @@ -183,15 +190,37 @@ int main(int ac, char **av) code= page*MY_UCA_NCHARS+offs; /* Calculate only non-zero weights */ - num=0; - for (i=0; i < uca[code].num; i++) + for (num=0, i=0; i < uca[code].num; i++) if (uca[code].weight[w][i]) num++; maxnum= maxnum < num ? num : maxnum; + + /* Check if default weight */ + if (w == 1 && num == 1) + { + /* 0020 0000 ... */ + if (uca[code].weight[w][0] == 0x0020) + ndefs++; + } + else if (w == 2 && num == 1) + { + /* 0002 0000 ... */ + if (uca[code].weight[w][0] == 0x0002) + ndefs++; + } } maxnum++; + /* + If the page have only default weights + then no needs to dump it, skip. + */ + if (ndefs == MY_UCA_NCHARS) + { + printf("/* Don't dump w=%d pg=%3X: ndefs=%d */\n",w, page, ndefs); + continue; + } switch (maxnum) { case 0: mchars= 8; break; @@ -210,8 +239,8 @@ int main(int ac, char **av) */ - printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n", - page, page*MY_UCA_NCHARS, maxnum); + printf("uint16 page%03Xdata%s[]= { /* %04X (%d weights per char) */\n", + page, pname[w], page*MY_UCA_NCHARS, maxnum); for (offs=0; offs < MY_UCA_NCHARS; offs++) { @@ -251,25 +280,28 @@ int main(int ac, char **av) } printf("};\n\n"); } - } - printf("uchar ucal[%d]={\n",MY_UCA_NPAGES); - for (page=0; page < MY_UCA_NPAGES; page++) - { - printf("%d%s%s",pagemaxlen[page],page Date: Mon, 22 Nov 2004 18:17:41 +0400 Subject: uca-dump.c: Better variable names in dump. Dump tertiary weight in reverse order, to sort upper letters before their lower counterparts. strings/uca-dump.c: Better variable names in dump. Dump tertiary weight in reverse order, to sort upper letters before their lower counterparts. --- strings/uca-dump.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'strings') diff --git a/strings/uca-dump.c b/strings/uca-dump.c index c9642598c3c..db5cb7e999a 100644 --- a/strings/uca-dump.c +++ b/strings/uca-dump.c @@ -218,7 +218,6 @@ int main(int ac, char **av) */ if (ndefs == MY_UCA_NCHARS) { - printf("/* Don't dump w=%d pg=%3X: ndefs=%d */\n",w, page, ndefs); continue; } switch (maxnum) @@ -263,7 +262,17 @@ int main(int ac, char **av) for (i=0; i < maxnum; i++) { - printf("0x%04X",(int)weight[i]); + /* + Invert weights for secondary level to + sort upper case letters before their + lower case counter part. + */ + int tmp= weight[i]; + if (w == 2 && tmp) + tmp= (int)(0x100 - weight[i]); + + + printf("0x%04X", tmp); if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum)) printf(","); nchars++; @@ -281,7 +290,7 @@ int main(int ac, char **av) printf("};\n\n"); } - printf("uchar ucal%s[%d]={\n", pname[w], MY_UCA_NPAGES); + printf("uchar uca_length%s[%d]={\n", pname[w], MY_UCA_NPAGES); for (page=0; page < MY_UCA_NPAGES; page++) { printf("%d%s%s",pagemaxlen[page],page