diff options
-rw-r--r-- | heap/hp_hash.c | 10 | ||||
-rw-r--r-- | mysql-test/r/ctype_latin1_de.result | 15 | ||||
-rw-r--r-- | mysql-test/t/ctype_latin1_de.test | 10 | ||||
-rw-r--r-- | sql/item_sum.cc | 4 |
4 files changed, 34 insertions, 5 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 2a946dcd7b9..2843407f3fe 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -371,8 +371,9 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_strnncoll(seg->charset,(uchar*) rec1+seg->start,seg->length, - (uchar*) rec2+seg->start,seg->length)) + if (seg->charset->coll->strnncollsp(seg->charset, + (uchar*) rec1+seg->start,seg->length, + (uchar*) rec2+seg->start,seg->length)) return 1; } else @@ -404,8 +405,9 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_strnncoll(seg->charset,(uchar*) rec+seg->start, seg->length, - (uchar*) key, seg->length)) + if (seg->charset->coll->strnncollsp(seg->charset, + (uchar*) rec+seg->start, seg->length, + (uchar*) key, seg->length)) return 1; } else diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index e0cb7008899..418bd65e0dc 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -264,3 +264,18 @@ select * from t1 where word like CAST(0xDF as CHAR); word word2 ß ß drop table t1; +CREATE TABLE t1 ( +s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci +); +INSERT INTO t1 VALUES ('Ü'); +INSERT INTO t1 VALUES ('ue'); +SELECT DISTINCT s1 FROM t1; +s1 +Ü +SELECT s1,COUNT(*) FROM t1 GROUP BY s1; +s1 COUNT(*) +Ü 2 +SELECT COUNT(DISTINCT s1) FROM t1; +COUNT(DISTINCT s1) +1 +DROP TABLE t1; diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index 22a4e14158d..0bbd9fa95e4 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -73,3 +73,13 @@ select * from t1 where word like 'AE'; select * from t1 where word like binary 0xDF; select * from t1 where word like CAST(0xDF as CHAR); drop table t1; + +CREATE TABLE t1 ( +s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci +); +INSERT INTO t1 VALUES ('Ü'); +INSERT INTO t1 VALUES ('ue'); +SELECT DISTINCT s1 FROM t1; +SELECT s1,COUNT(*) FROM t1 GROUP BY s1; +SELECT COUNT(DISTINCT s1) FROM t1; +DROP TABLE t1; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index aa146926eb5..3bd131c0e60 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1023,7 +1023,9 @@ int simple_str_key_cmp(void* arg, byte* key1, byte* key2) Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; CHARSET_INFO *cs=item->key_charset; uint len=item->key_length; - return my_strnncoll(cs, (const uchar*) key1, len, (const uchar*) key2, len); + return cs->coll->strnncollsp(cs, + (const uchar*) key1, len, + (const uchar*) key2, len); } /* |