Bug #11755818 : LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN
COLLATIONS ARE USED. ISSUE : ------- Code points of HALF WIDTH KATAKANA in SJIS/CP932 range from A1 to DF. In function my_wildcmp_mb_bin_impl while comparing such single byte code points, there is a code which compares signed character with unsigned character. Because of this, comparisons of two same code points representing a HALF WIDTH KATAKANA character always fails. Solution: --------- A code point of HALF WIDTH KATAKANA at-least need 8 bits. Promoting the variable from uchar to int will fix the issue.
This commit is contained in:
parent
b9bc2bd434
commit
471569e072
35
mysql-test/r/ctype_cp932.result
Normal file
35
mysql-test/r/ctype_cp932.result
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#
|
||||||
|
# Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE
|
||||||
|
# USED.
|
||||||
|
#
|
||||||
|
SET @old_character_set_client= @@character_set_client;
|
||||||
|
SET @old_character_set_connection= @@character_set_connection;
|
||||||
|
SET @old_character_set_results= @@character_set_results;
|
||||||
|
SET character_set_client= 'utf8';
|
||||||
|
SET character_set_connection= 'utf8';
|
||||||
|
SET character_set_results= 'utf8';
|
||||||
|
CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin);
|
||||||
|
INSERT INTO t1 VALUES('カカ');
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '_カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%_カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin;
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '_カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%_カ';
|
||||||
|
a
|
||||||
|
カカ
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET @@character_set_client= @old_character_set_client;
|
||||||
|
SET @@character_set_connection= @old_character_set_connection;
|
||||||
|
SET @@character_set_results= @old_character_set_results;
|
29
mysql-test/t/ctype_cp932.test
Normal file
29
mysql-test/t/ctype_cp932.test
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
-- source include/have_cp932.inc
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE
|
||||||
|
--echo # USED.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET @old_character_set_client= @@character_set_client;
|
||||||
|
SET @old_character_set_connection= @@character_set_connection;
|
||||||
|
SET @old_character_set_results= @@character_set_results;
|
||||||
|
SET character_set_client= 'utf8';
|
||||||
|
SET character_set_connection= 'utf8';
|
||||||
|
SET character_set_results= 'utf8';
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin);
|
||||||
|
INSERT INTO t1 VALUES('カカ');
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%カ';
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '_カ';
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%_カ';
|
||||||
|
|
||||||
|
ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin;
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%カ';
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '_カ';
|
||||||
|
SELECT * FROM t1 WHERE a LIKE '%_カ';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
## Reset to initial values
|
||||||
|
SET @@character_set_client= @old_character_set_client;
|
||||||
|
SET @@character_set_connection= @old_character_set_connection;
|
||||||
|
SET @@character_set_results= @old_character_set_results;
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
/* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -1044,7 +1044,7 @@ static int my_wildcmp_mb_bin_impl(CHARSET_INFO *cs,
|
|||||||
}
|
}
|
||||||
if (*wildstr == w_many)
|
if (*wildstr == w_many)
|
||||||
{ /* Found w_many */
|
{ /* Found w_many */
|
||||||
uchar cmp;
|
int cmp;
|
||||||
const char* mb = wildstr;
|
const char* mb = wildstr;
|
||||||
int mb_len=0;
|
int mb_len=0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user