trim spaces from CHAR() BINARY consistently
This commit is contained in:
parent
401f3fb418
commit
a60c0569f3
@ -62,6 +62,7 @@ a b
|
|||||||
hello hello
|
hello hello
|
||||||
select * from t1 ignore index (b) where b="hello ";
|
select * from t1 ignore index (b) where b="hello ";
|
||||||
a b
|
a b
|
||||||
|
hello hello
|
||||||
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
|
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
|
||||||
select * from t1 where b="hello ";
|
select * from t1 where b="hello ";
|
||||||
a b
|
a b
|
||||||
|
@ -75,6 +75,21 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
return cmp ? cmp : (int) (slen - tlen);
|
return cmp ? cmp : (int) (slen - tlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int my_strnncollsp_binary(CHARSET_INFO * cs,
|
||||||
|
const uchar *s, uint slen,
|
||||||
|
const uchar *t, uint tlen)
|
||||||
|
{
|
||||||
|
int len, cmp;
|
||||||
|
|
||||||
|
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
|
||||||
|
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
|
||||||
|
|
||||||
|
len = ( slen > tlen ) ? tlen : slen;
|
||||||
|
|
||||||
|
cmp= memcmp(s,t,len);
|
||||||
|
return cmp ? cmp : (int) (slen - tlen);
|
||||||
|
}
|
||||||
|
|
||||||
static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)),
|
static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
char *str __attribute__((unused)))
|
char *str __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -308,7 +323,7 @@ CHARSET_INFO my_charset_bin =
|
|||||||
NULL, /* tab_from_uni */
|
NULL, /* tab_from_uni */
|
||||||
0, /* strxfrm_multiply */
|
0, /* strxfrm_multiply */
|
||||||
my_strnncoll_binary, /* strnncoll */
|
my_strnncoll_binary, /* strnncoll */
|
||||||
my_strnncoll_binary,
|
my_strnncollsp_binary,
|
||||||
my_strnxfrm_bin, /* strxnfrm */
|
my_strnxfrm_bin, /* strxnfrm */
|
||||||
my_like_range_simple, /* like_range */
|
my_like_range_simple, /* like_range */
|
||||||
my_wildcmp_bin, /* wildcmp */
|
my_wildcmp_bin, /* wildcmp */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user