Commit 613253c4 authored by unknown's avatar unknown

Merge moonbone.local:/work/14583-bug-5.0-mysql

into moonbone.local:/work/14583-bug-5.1-new-mysql


BitKeeper/deleted/.del-ha_blackhole.cc~727c69ef7846623a:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
strings/ctype-ucs2.c:
  Auto merged
parents 38005eae 8f29cc3e
...@@ -685,6 +685,13 @@ hex(a) ...@@ -685,6 +685,13 @@ hex(a)
005B 005B
803D 803D
drop table t1; 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)); CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0); INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a; update t1 set b=a;
......
...@@ -421,6 +421,14 @@ insert into t1 values (0x005b); ...@@ -421,6 +421,14 @@ insert into t1 values (0x005b);
select hex(a) from t1; select hex(a) from t1;
drop table 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 # End of 4.1 tests
# #
......
...@@ -1373,14 +1373,50 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, ...@@ -1373,14 +1373,50 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); 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 *s, uint slen,
const uchar *t, uint tlen, const uchar *t, uint tlen,
my_bool diff_if_only_endspace_difference my_bool diff_if_only_endspace_difference
__attribute__((unused))) __attribute__((unused)))
{ {
/* TODO: Needs to be fixed to handle end space! */ const uchar *se, *te;
return my_strnncoll_ucs2_bin(cs,s,slen,t,tlen,0); 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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment