diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result index 752a4fba630..500b0497890 100644 --- a/mysql-test/r/ndb_charset.result +++ b/mysql-test/r/ndb_charset.result @@ -305,31 +305,6 @@ count(*) 48 drop table t1; create table t1 ( -a char(5) character set ucs2, -b varchar(7) character set utf8, -primary key(a, b) -) engine=ndb; -insert into t1 values -('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '), -('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'), -('a','C '),('B ','d'),('c','E '),('D','f'); -insert into t1 values('d','f'); -ERROR 23000: Duplicate entry '' for key 1 -select a,b,length(a),length(b) from t1 order by a,b limit 3; -a b length(a) length(b) -a A 2 2 -A b 2 2 -a C 2 2 -select a,b,length(a),length(b) from t1 order by a desc, b desc limit 3; -a b length(a) length(b) -F f 2 3 -E f 2 1 -e E 2 1 -select a,b,length(a),length(b) from t1 where a='c' and b='c'; -a b length(a) length(b) -c C 2 5 -drop table t1; -create table t1 ( a char(10) primary key ) engine=ndb; insert into t1 values ('jonas % '); diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test index ab2bbcc3ad8..6a191636f1e 100644 --- a/mysql-test/t/ndb_charset.test +++ b/mysql-test/t/ndb_charset.test @@ -217,24 +217,24 @@ select count(*) from t1 x, t1 y, t1 z where x.a = y.a and y.a = z.a; drop table t1; # minimal multi-byte test - -create table t1 ( - a char(5) character set ucs2, - b varchar(7) character set utf8, - primary key(a, b) -) engine=ndb; +# removed by jonas as this requires a configure --with-extra-charsets +#create table t1 ( +# a char(5) character set ucs2, +# b varchar(7) character set utf8, +# primary key(a, b) +#) engine=ndb; # -insert into t1 values - ('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '), - ('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'), - ('a','C '),('B ','d'),('c','E '),('D','f'); --- error 1062 -insert into t1 values('d','f'); +#insert into t1 values +# ('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '), +# ('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'), +# ('a','C '),('B ','d'),('c','E '),('D','f'); +#-- error 1062 +#insert into t1 values('d','f'); # -select a,b,length(a),length(b) from t1 order by a,b limit 3; -select a,b,length(a),length(b) from t1 order by a desc, b desc limit 3; -select a,b,length(a),length(b) from t1 where a='c' and b='c'; -drop table t1; +#select a,b,length(a),length(b) from t1 order by a,b limit 3; +#select a,b,length(a),length(b) from t1 order by a desc, b desc limit 3; +#select a,b,length(a),length(b) from t1 where a='c' and b='c'; +#drop table t1; # bug create table t1 ( diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index 1e280ae0fac..82f99d0e7fd 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -545,6 +545,15 @@ NdbSqlUtil::cmpDate(const void* info, const void* p1, unsigned n1, const void* p assert(! full); return CmpUnknown; #else + char t1[4], t2[4]; + if (n1 == 3 && n2 == 3) + { + memcpy(t1, p1, 3); + memcpy(t2, p2, 3); + p1 = t1; + p2 = t2; + n1 = n2 = 4; + } if (n2 >= 4) { // may access 4-th byte const uchar* v1 = (const uchar*)p1; const uchar* v2 = (const uchar*)p2;