From: eugene Date: December 28 2005 2:23pm Subject: bk commit into 5.0 tree (evgen:1.2008) List-Archive: http://lists.mysql.com/commits/444 Message-Id: <20051228142313.216C723EB1@localhost.moonbone.local> Below is the list of changes that have just been committed into a local 5.0 repository of evgen. When evgen does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2008 05/12/28 17:23:08 evgen@stripped +5 -0 Manual merge strings/ctype-ucs2.c 1.58 05/12/28 17:23:05 evgen@stripped +0 -1 Manual merge mysql-test/r/ctype_ucs.result 1.40 05/12/28 17:23:05 evgen@stripped +0 -0 Manual merge BitKeeper/deleted/.del-ha_blackhole.cc~727c69ef7846623a 1.5 05/12/28 17:20:17 evgen@stripped +0 -0 Auto merged sql/sql_update.cc 1.183 05/12/28 17:20:17 evgen@stripped +0 -0 Auto merged mysql-test/t/ctype_ucs.test 1.36 05/12/28 17:20:17 evgen@stripped +0 -0 Auto merged BitKeeper/deleted/.del-ha_blackhole.cc~727c69ef7846623a 1.1.3.2 05/12/28 17:20:17 evgen@stripped +0 -0 Merge rename: libmysqld/ha_blackhole.cc -> BitKeeper/deleted/.del-ha_blackhole.cc~727c69ef7846623a # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: evgen # Host: moonbone.local # Root: /work/14583-bug-5.0-mysql/RESYNC --- 1.39/mysql-test/r/ctype_ucs.result 2005-10-06 16:36:53 +04:00 +++ 1.40/mysql-test/r/ctype_ucs.result 2005-12-28 17:23:05 +03:00 @@ -685,6 +685,13 @@ 005B 803D drop table t1; +create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB; +insert into t1 values('a'); +create index t1f1 on t1(f1); +select f1 from t1 where f1 like 'a%'; +f1 +a +drop table t1; CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3)); INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0); update t1 set b=a; --- 1.35/mysql-test/t/ctype_ucs.test 2005-10-06 16:36:54 +04:00 +++ 1.36/mysql-test/t/ctype_ucs.test 2005-12-28 17:20:17 +03:00 @@ -421,6 +421,14 @@ select hex(a) from t1; drop table t1; +# +# Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation +# +create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB; +insert into t1 values('a'); +create index t1f1 on t1(f1); +select f1 from t1 where f1 like 'a%'; +drop table t1; # End of 4.1 tests # --- 1.57/strings/ctype-ucs2.c 2005-10-20 00:47:02 +04:00 +++ 1.58/strings/ctype-ucs2.c 2005-12-28 17:23:05 +03:00 @@ -1373,14 +1373,50 @@ return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); } -static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs, +static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *s, uint slen, const uchar *t, uint tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { - /* TODO: Needs to be fixed to handle end space! */ - return my_strnncoll_ucs2_bin(cs,s,slen,t,tlen,0); + const uchar *se, *te; + uint minlen; + + /* extra safety to make sure the lengths are even numbers */ + slen= (slen >> 1) << 1; + tlen= (tlen >> 1) << 1; + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 2) + { + int s_wc= s[0] * 256 + s[1]; + int t_wc= t[0] * 256 + t[1]; + if ( s_wc != t_wc ) + return s_wc > t_wc ? 1 : -1; + + s+= 2; + t+= 2; + } + + if (slen != tlen) + { + int swap= 1; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 2) + { + if (s[0] || s[1] != ' ') + return (s[0] == 0 && s[1] < ' ') ? -swap : swap; + } + } + return 0; }