MDEV-5180 Data type for WEIGHT_STRING is too short in some cases

(a bug in upstream)
This commit is contained in:
Alexander Barkov 2013-10-25 15:01:03 +04:00
parent a6e28ce5e6
commit 71f8ca654e
32 changed files with 3325 additions and 43 deletions

View File

@ -188,6 +188,7 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */ #define MY_CS_NONASCII 8192 /* if not ASCII-compatible */
#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */ #define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */
#define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */ #define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */
#define MY_CS_STRNXFRM_BAD_NWEIGHTS 0x10000 /* strnxfrm ignores "nweights" */
#define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_UNDEFINED 0
/* Character repertoire flags */ /* Character repertoire flags */
@ -672,6 +673,7 @@ size_t my_strnxfrm_mb(CHARSET_INFO *,
size_t my_strnxfrm_unicode(CHARSET_INFO *, size_t my_strnxfrm_unicode(CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights, uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags); const uchar *src, size_t srclen, uint flags);
size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t);
size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights, uchar *dst, size_t dstlen, uint nweights,

View File

@ -1,4 +1,39 @@
select @@collation_connection; select @@collation_connection;
#
# MDEV-5180 Data type for WEIGHT_STRING is too short in some cases
#
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
SELECT HEX(ws) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
SELECT HEX(ws) FROM t2;
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
SELECT HEX(ws) FROM t2;
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
SELECT HEX(ws) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
#
# End of MDEV-5180
#
select hex(weight_string('a')); select hex(weight_string('a'));
select hex(weight_string('A')); select hex(weight_string('A'));
select hex(weight_string('abc')); select hex(weight_string('abc'));

View File

@ -565,6 +565,72 @@ set names big5;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
big5_chinese_ci big5_chinese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET big5 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -758,6 +824,72 @@ set collation_connection=big5_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
big5_bin big5_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET big5 COLLATE big5_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -255,6 +255,72 @@ set names cp1250 collate cp1250_czech_cs;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
cp1250_czech_cs cp1250_czech_cs
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
A402
SELECT HEX(ws) FROM t2;
HEX(ws)
A402
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
A402 A402

View File

@ -19543,6 +19543,72 @@ set names cp932;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
cp932_japanese_ci cp932_japanese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET cp932 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -19736,6 +19802,72 @@ set collation_connection=cp932_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
cp932_bin cp932_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -32621,6 +32621,72 @@ set names eucjpms;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
eucjpms_japanese_ci eucjpms_japanese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET eucjpms NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -32988,6 +33054,72 @@ set collation_connection=eucjpms_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
eucjpms_bin eucjpms_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -24612,6 +24612,72 @@ set names euckr;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
euckr_korean_ci euckr_korean_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET euckr NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -24805,6 +24871,72 @@ set collation_connection=euckr_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
euckr_bin euckr_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -558,6 +558,72 @@ set names gb2312;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
gb2312_chinese_ci gb2312_chinese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET gb2312 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -751,6 +817,72 @@ set collation_connection=gb2312_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
gb2312_bin gb2312_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -590,6 +590,72 @@ set names gbk;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
gbk_chinese_ci gbk_chinese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET gbk NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -957,6 +1023,72 @@ set collation_connection=gbk_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
gbk_bin gbk_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -3342,6 +3342,72 @@ set @@collation_connection=latin1_swedish_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin1_swedish_ci latin1_swedish_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -3520,6 +3586,72 @@ set @@collation_connection=latin1_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin1_bin latin1_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61
@ -3698,6 +3830,72 @@ set @@collation_connection=latin1_general_cs;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin1_general_cs latin1_general_cs
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
42
SELECT HEX(ws) FROM t2;
HEX(ws)
42
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4242424242
SELECT HEX(ws) FROM t2;
HEX(ws)
4242424242
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
424242
SELECT HEX(ws) FROM t2;
HEX(ws)
424242
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
42424242422020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
42424242422020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
42 42
@ -3876,6 +4074,72 @@ set @@collation_connection=binary;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
binary binary
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varbinary(1) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varbinary(5) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161610000000000
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161610000000000
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -415,6 +415,72 @@ set @@collation_connection=latin1_german2_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin1_german2_ci latin1_german2_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) COLLATE latin1_german2_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) COLLATE latin1_german2_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41

View File

@ -392,6 +392,72 @@ set names latin2;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin2_general_ci latin2_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -498,6 +564,72 @@ set collation_connection=latin2_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin2_bin latin2_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -58,6 +58,72 @@ strcmp('a\t','a ')
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
latin2_czech_cs latin2_czech_cs
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0301030103010300
SELECT HEX(ws) FROM t2;
HEX(ws)
0301030103010300
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
030303030301030303030301030303030301030303030300
SELECT HEX(ws) FROM t2;
HEX(ws)
030303030301030303030301030303030301030303030300
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
030303030301030303030301030303030301030303030300
SELECT HEX(ws) FROM t2;
HEX(ws)
030303030301030303030301030303030301030303030300
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
030303030301030303030301030303030301030303030300
SELECT HEX(ws) FROM t2;
HEX(ws)
030303030301030303030301030303030301030303030300
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0301030103010300 0301030103010300

View File

@ -14572,6 +14572,72 @@ set names sjis;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
sjis_japanese_ci sjis_japanese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET sjis NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -14765,6 +14831,72 @@ set collation_connection=sjis_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
sjis_bin sjis_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -3004,6 +3004,72 @@ set collation_connection=tis620_thai_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
tis620_thai_ci tis620_thai_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET tis620 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET tis620 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61
@ -3116,6 +3182,72 @@ set collation_connection=tis620_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
tis620_bin tis620_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -3333,6 +3333,72 @@ set collation_connection=ucs2_unicode_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
ucs2_unicode_ci ucs2_unicode_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E33
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(80) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E330E330E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
0E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(160) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0E330E330E330E330E3302090209020902090209
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E3302090209020902090209
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0E33 0E33
@ -3511,6 +3577,72 @@ set @@collation_connection=utf8_unicode_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf8_unicode_ci utf8_unicode_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E33
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(80) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E330E330E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
0E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(160) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0E330E330E330E330E3302090209020902090209
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E3302090209020902090209
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0E33 0E33

View File

@ -4273,6 +4273,72 @@ set collation_connection=ucs2_general_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
ucs2_general_ci ucs2_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0041 0041
@ -4451,6 +4517,72 @@ set collation_connection=ucs2_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
ucs2_bin ucs2_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0061
SELECT HEX(ws) FROM t2;
HEX(ws)
0061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00610061006100610061
SELECT HEX(ws) FROM t2;
HEX(ws)
00610061006100610061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
006100610061
SELECT HEX(ws) FROM t2;
HEX(ws)
006100610061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0061006100610061006100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0061006100610061006100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0061 0061

View File

@ -24926,6 +24926,72 @@ set names ujis;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
ujis_japanese_ci ujis_japanese_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
41
SELECT HEX(ws) FROM t2;
HEX(ws)
41
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET ujis NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
4141414141
SELECT HEX(ws) FROM t2;
HEX(ws)
4141414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
414141
SELECT HEX(ws) FROM t2;
HEX(ws)
414141
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
41414141412020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
41414141412020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
41 41
@ -25293,6 +25359,72 @@ set collation_connection=ujis_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
ujis_bin ujis_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
61
SELECT HEX(ws) FROM t2;
HEX(ws)
61
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
6161616161
SELECT HEX(ws) FROM t2;
HEX(ws)
6161616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
616161
SELECT HEX(ws) FROM t2;
HEX(ws)
616161
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
61616161612020202020
SELECT HEX(ws) FROM t2;
HEX(ws)
61616161612020202020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
61 61

View File

@ -1337,6 +1337,72 @@ set collation_connection=utf16_general_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf16_general_ci utf16_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf16 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf16 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0041 0041
@ -1521,6 +1587,72 @@ set collation_connection=utf16_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf16_bin utf16_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061000061000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
000061000061000061000061000061000020000020000020000020000020
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061000020000020000020000020000020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
000061 000061

View File

@ -2487,6 +2487,72 @@ set collation_connection=utf16_unicode_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf16_unicode_ci utf16_unicode_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E33
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(80) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E330E330E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
0E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(160) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0E330E330E330E330E3302090209020902090209
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E3302090209020902090209
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0E33 0E33

View File

@ -1578,6 +1578,72 @@ SET NAMES utf8, collation_connection=utf16le_general_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf16le_general_ci utf16le_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf16le NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf16le NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0041 0041
@ -1762,6 +1828,72 @@ SET NAMES utf8, collation_connection=utf16le_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf16le_bin utf16le_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061000061000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
000061000061000061000061000061000020000020000020000020000020
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061000020000020000020000020000020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
000061 000061

View File

@ -1390,6 +1390,72 @@ set collation_connection=utf32_general_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf32_general_ci utf32_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf32 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf32 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0041 0041
@ -1574,6 +1640,72 @@ set collation_connection=utf32_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf32_bin utf32_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061000061000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
000061000061000061000061000061000020000020000020000020000020
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061000020000020000020000020000020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
000061 000061

View File

@ -2507,6 +2507,72 @@ set collation_connection=utf32_unicode_ci;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf32_unicode_ci utf32_unicode_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E33
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(80) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0E330E330E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
0E330E330E33
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E33
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(160) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0E330E330E330E330E3302090209020902090209
SELECT HEX(ws) FROM t2;
HEX(ws)
0E330E330E330E330E3302090209020902090209
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0E33 0E33

View File

@ -5139,6 +5139,72 @@ set names utf8;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf8_general_ci utf8_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0041 0041
@ -5317,6 +5383,72 @@ set @@collation_connection=utf8_bin;
select @@collation_connection; select @@collation_connection;
@@collation_connection @@collation_connection
utf8_bin utf8_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0061
SELECT HEX(ws) FROM t2;
HEX(ws)
0061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00610061006100610061
SELECT HEX(ws) FROM t2;
HEX(ws)
00610061006100610061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
006100610061
SELECT HEX(ws) FROM t2;
HEX(ws)
006100610061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0061006100610061006100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0061006100610061006100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a')); select hex(weight_string('a'));
hex(weight_string('a')) hex(weight_string('a'))
0061 0061

View File

@ -2583,5 +2583,499 @@ DROP TABLE t1;
# End of 5.5 tests # End of 5.5 tests
# #
# #
# WL#3664 WEIGHT_STRING
#
set names utf8mb4;
select @@collation_connection;
@@collation_connection
utf8mb4_general_ci
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
0041
SELECT HEX(ws) FROM t2;
HEX(ws)
0041
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
00410041004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
00410041004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
004100410041
SELECT HEX(ws) FROM t2;
HEX(ws)
004100410041
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
0041004100410041004100200020002000200020
SELECT HEX(ws) FROM t2;
HEX(ws)
0041004100410041004100200020002000200020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a'));
hex(weight_string('a'))
0041
select hex(weight_string('A'));
hex(weight_string('A'))
0041
select hex(weight_string('abc'));
hex(weight_string('abc'))
004100420043
select hex(weight_string('abc' as char(2)));
hex(weight_string('abc' as char(2)))
00410042
select hex(weight_string('abc' as char(3)));
hex(weight_string('abc' as char(3)))
004100420043
select hex(weight_string('abc' as char(5)));
hex(weight_string('abc' as char(5)))
00410042004300200020
select hex(weight_string('abc', 1, 2, 0xC0));
hex(weight_string('abc', 1, 2, 0xC0))
00
select hex(weight_string('abc', 2, 2, 0xC0));
hex(weight_string('abc', 2, 2, 0xC0))
0041
select hex(weight_string('abc', 3, 2, 0xC0));
hex(weight_string('abc', 3, 2, 0xC0))
004100
select hex(weight_string('abc', 4, 2, 0xC0));
hex(weight_string('abc', 4, 2, 0xC0))
00410042
select hex(weight_string('abc', 5, 2, 0xC0));
hex(weight_string('abc', 5, 2, 0xC0))
0041004200
select hex(weight_string('abc',25, 2, 0xC0));
hex(weight_string('abc',25, 2, 0xC0))
00410042002000200020002000200020002000200020002000
select hex(weight_string('abc', 1, 3, 0xC0));
hex(weight_string('abc', 1, 3, 0xC0))
00
select hex(weight_string('abc', 2, 3, 0xC0));
hex(weight_string('abc', 2, 3, 0xC0))
0041
select hex(weight_string('abc', 3, 3, 0xC0));
hex(weight_string('abc', 3, 3, 0xC0))
004100
select hex(weight_string('abc', 4, 3, 0xC0));
hex(weight_string('abc', 4, 3, 0xC0))
00410042
select hex(weight_string('abc', 5, 3, 0xC0));
hex(weight_string('abc', 5, 3, 0xC0))
0041004200
select hex(weight_string('abc',25, 3, 0xC0));
hex(weight_string('abc',25, 3, 0xC0))
00410042004300200020002000200020002000200020002000
select hex(weight_string('abc', 1, 4, 0xC0));
hex(weight_string('abc', 1, 4, 0xC0))
00
select hex(weight_string('abc', 2, 4, 0xC0));
hex(weight_string('abc', 2, 4, 0xC0))
0041
select hex(weight_string('abc', 3, 4, 0xC0));
hex(weight_string('abc', 3, 4, 0xC0))
004100
select hex(weight_string('abc', 4, 4, 0xC0));
hex(weight_string('abc', 4, 4, 0xC0))
00410042
select hex(weight_string('abc', 5, 4, 0xC0));
hex(weight_string('abc', 5, 4, 0xC0))
0041004200
select hex(weight_string('abc',25, 4, 0xC0));
hex(weight_string('abc',25, 4, 0xC0))
00410042004300200020002000200020002000200020002000
select @@collation_connection;
@@collation_connection
utf8mb4_general_ci
select hex(weight_string(cast(_latin1 0x80 as char)));
hex(weight_string(cast(_latin1 0x80 as char)))
20AC
select hex(weight_string(cast(_latin1 0x808080 as char)));
hex(weight_string(cast(_latin1 0x808080 as char)))
20AC20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(2)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(2)))
20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(3)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(3)))
20AC20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(5)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(5)))
20AC20AC20AC00200020
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0))
20
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0))
20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0))
20AC20
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0))
20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0))
20AC20AC00
select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0))
20AC20AC002000200020002000200020002000200020002000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0))
20
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0))
20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0))
20AC20
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0))
20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0))
20AC20AC20
select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0))
20AC20AC20AC00200020002000200020002000200020002000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0))
20
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0))
20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0))
20AC20
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0))
20AC20AC
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0))
20AC20AC20
select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0))
20AC20AC20AC00200020002000200020002000200020002000
select @@collation_connection;
@@collation_connection
utf8mb4_general_ci
select hex(weight_string('a' LEVEL 1));
hex(weight_string('a' LEVEL 1))
0041
select hex(weight_string('A' LEVEL 1));
hex(weight_string('A' LEVEL 1))
0041
select hex(weight_string('abc' LEVEL 1));
hex(weight_string('abc' LEVEL 1))
004100420043
select hex(weight_string('abc' as char(2) LEVEL 1));
hex(weight_string('abc' as char(2) LEVEL 1))
00410042
select hex(weight_string('abc' as char(3) LEVEL 1));
hex(weight_string('abc' as char(3) LEVEL 1))
004100420043
select hex(weight_string('abc' as char(5) LEVEL 1));
hex(weight_string('abc' as char(5) LEVEL 1))
00410042004300200020
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
20002000430042004100
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
FFBEFFBDFFBCFFDFFFDF
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFFFDFFFBCFFBDFFBEFF
set @@collation_connection=utf8mb4_bin;
select @@collation_connection;
@@collation_connection
utf8mb4_bin
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
000061000061000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(9) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
000061000061000061
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ws` varbinary(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
000061000061000061000061000061000020000020000020000020000020
SELECT HEX(ws) FROM t2;
HEX(ws)
000061000061000061000061000061000020000020000020000020000020
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a'));
hex(weight_string('a'))
000061
select hex(weight_string('A'));
hex(weight_string('A'))
000041
select hex(weight_string('abc'));
hex(weight_string('abc'))
000061000062000063
select hex(weight_string('abc' as char(2)));
hex(weight_string('abc' as char(2)))
000061000062
select hex(weight_string('abc' as char(3)));
hex(weight_string('abc' as char(3)))
000061000062000063
select hex(weight_string('abc' as char(5)));
hex(weight_string('abc' as char(5)))
000061000062000063000020000020
select hex(weight_string('abc', 1, 2, 0xC0));
hex(weight_string('abc', 1, 2, 0xC0))
00
select hex(weight_string('abc', 2, 2, 0xC0));
hex(weight_string('abc', 2, 2, 0xC0))
0000
select hex(weight_string('abc', 3, 2, 0xC0));
hex(weight_string('abc', 3, 2, 0xC0))
000061
select hex(weight_string('abc', 4, 2, 0xC0));
hex(weight_string('abc', 4, 2, 0xC0))
00006100
select hex(weight_string('abc', 5, 2, 0xC0));
hex(weight_string('abc', 5, 2, 0xC0))
0000610000
select hex(weight_string('abc',25, 2, 0xC0));
hex(weight_string('abc',25, 2, 0xC0))
00006100006200002000002000002000002000002000002000
select hex(weight_string('abc', 1, 3, 0xC0));
hex(weight_string('abc', 1, 3, 0xC0))
00
select hex(weight_string('abc', 2, 3, 0xC0));
hex(weight_string('abc', 2, 3, 0xC0))
0000
select hex(weight_string('abc', 3, 3, 0xC0));
hex(weight_string('abc', 3, 3, 0xC0))
000061
select hex(weight_string('abc', 4, 3, 0xC0));
hex(weight_string('abc', 4, 3, 0xC0))
00006100
select hex(weight_string('abc', 5, 3, 0xC0));
hex(weight_string('abc', 5, 3, 0xC0))
0000610000
select hex(weight_string('abc',25, 3, 0xC0));
hex(weight_string('abc',25, 3, 0xC0))
00006100006200006300002000002000002000002000002000
select hex(weight_string('abc', 1, 4, 0xC0));
hex(weight_string('abc', 1, 4, 0xC0))
00
select hex(weight_string('abc', 2, 4, 0xC0));
hex(weight_string('abc', 2, 4, 0xC0))
0000
select hex(weight_string('abc', 3, 4, 0xC0));
hex(weight_string('abc', 3, 4, 0xC0))
000061
select hex(weight_string('abc', 4, 4, 0xC0));
hex(weight_string('abc', 4, 4, 0xC0))
00006100
select hex(weight_string('abc', 5, 4, 0xC0));
hex(weight_string('abc', 5, 4, 0xC0))
0000610000
select hex(weight_string('abc',25, 4, 0xC0));
hex(weight_string('abc',25, 4, 0xC0))
00006100006200006300002000002000002000002000002000
select @@collation_connection;
@@collation_connection
utf8mb4_bin
select hex(weight_string(cast(_latin1 0x80 as char)));
hex(weight_string(cast(_latin1 0x80 as char)))
0020AC
select hex(weight_string(cast(_latin1 0x808080 as char)));
hex(weight_string(cast(_latin1 0x808080 as char)))
0020AC0020AC0020AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(2)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(2)))
0020AC0020AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(3)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(3)))
0020AC0020AC0020AC
select hex(weight_string(cast(_latin1 0x808080 as char) as char(5)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(5)))
0020AC0020AC0020AC000020000020
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0))
00
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0))
0020
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0))
0020AC
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0))
0020AC00
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0))
0020AC0020
select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0))
0020AC0020AC00002000002000002000002000002000002000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0))
00
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0))
0020
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0))
0020AC
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0))
0020AC00
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0))
0020AC0020
select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0))
0020AC0020AC0020AC00002000002000002000002000002000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0))
00
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0))
0020
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0))
0020AC
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0))
0020AC00
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0))
0020AC0020
select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0))
0020AC0020AC0020AC00002000002000002000002000002000
select @@collation_connection;
@@collation_connection
utf8mb4_bin
select hex(weight_string('a' LEVEL 1));
hex(weight_string('a' LEVEL 1))
000061
select hex(weight_string('A' LEVEL 1));
hex(weight_string('A' LEVEL 1))
000041
select hex(weight_string('abc' LEVEL 1));
hex(weight_string('abc' LEVEL 1))
000061000062000063
select hex(weight_string('abc' as char(2) LEVEL 1));
hex(weight_string('abc' as char(2) LEVEL 1))
000061000062
select hex(weight_string('abc' as char(3) LEVEL 1));
hex(weight_string('abc' as char(3) LEVEL 1))
000061000062000063
select hex(weight_string('abc' as char(5) LEVEL 1));
hex(weight_string('abc' as char(5) LEVEL 1))
000061000062000063000020000020
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
200000200000630000620000610000
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
FFFF9EFFFF9DFFFF9CFFFFDFFFFFDF
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF
#
# End of 5.6 tests
#
#
# End of tests # End of tests
# #

View File

@ -1829,6 +1829,26 @@ DROP TABLE t1;
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
--echo #
--echo # WL#3664 WEIGHT_STRING
--echo #
set names utf8mb4;
--source include/weight_string.inc
--source include/weight_string_euro.inc
--source include/weight_string_l1.inc
set @@collation_connection=utf8mb4_bin;
--source include/weight_string.inc
--source include/weight_string_euro.inc
--source include/weight_string_l1.inc
--echo #
--echo # End of 5.6 tests
--echo #
--echo # --echo #
--echo # End of tests --echo # End of tests
--echo # --echo #

View File

@ -3547,8 +3547,13 @@ void Item_func_weight_string::fix_length_and_dec()
otherwise calculate max_length using argument's max_length otherwise calculate max_length using argument's max_length
and "nweights". and "nweights".
*/ */
max_length= result_length ? result_length : if (!(max_length= result_length))
cs->mbmaxlen * MY_MAX(args[0]->max_length, nweights); {
uint char_length;
char_length= ((cs->state & MY_CS_STRNXFRM_BAD_NWEIGHTS) || !nweights) ?
args[0]->max_char_length() : nweights;
max_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
}
maybe_null= 1; maybe_null= 1;
} }
@ -3570,9 +3575,35 @@ String *Item_func_weight_string::val_str(String *str)
explicitly, otherwise calculate result length explicitly, otherwise calculate result length
from argument and "nweights". from argument and "nweights".
*/ */
tmp_length= result_length ? result_length : if (!(tmp_length= result_length))
cs->coll->strnxfrmlen(cs, cs->mbmaxlen * {
MY_MAX(res->length(), nweights)); uint char_length;
if (cs->state & MY_CS_STRNXFRM_BAD_NWEIGHTS)
{
/*
latin2_czech_cs and cp1250_czech_cs do not support
the "nweights" limit in strnxfrm(). Use the full length.
*/
char_length= res->length();
}
else
{
/*
If we don't need to pad the result with spaces, then it should be
OK to calculate character length of the argument approximately:
"res->length() / cs->mbminlen" can return a number that is
bigger than the real number of characters in the string, so
we'll allocate a little bit more memory but avoid calling
the slow res->numchars().
In case if we do need to pad with spaces, we call res->numchars()
to know the true number of characters.
*/
if (!(char_length= nweights))
char_length= (flags & MY_STRXFRM_PAD_WITH_SPACE) ?
res->numchars() : (res->length() / cs->mbminlen);
}
tmp_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
}
if(tmp_length > current_thd->variables.max_allowed_packet) if(tmp_length > current_thd->variables.max_allowed_packet)
{ {

View File

@ -625,7 +625,7 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
struct charset_info_st my_charset_latin2_czech_ci = struct charset_info_st my_charset_latin2_czech_ci =
{ {
2,0,0, /* number */ 2,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|MY_CS_STRNXFRM_BAD_NWEIGHTS, /* state */
"latin2", /* cs name */ "latin2", /* cs name */
"latin2_czech_cs", /* name */ "latin2_czech_cs", /* name */
"", /* comment */ "", /* comment */

View File

@ -9484,6 +9484,12 @@ static size_t my_strnxfrm_any_uca(CHARSET_INFO *cs,
dst, dstlen, nweights, src, srclen, flags); dst, dstlen, nweights, src, srclen, flags);
} }
static size_t my_strnxfrmlen_any_uca(CHARSET_INFO *cs, size_t len)
{
/* UCA uses 2 bytes per weight */
return (len + cs->mbmaxlen - 1) / cs->mbmaxlen * cs->strxfrm_multiply * 2;
}
#ifdef HAVE_CHARSET_ucs2 #ifdef HAVE_CHARSET_ucs2
/* /*
@ -9529,7 +9535,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_strnncoll_ucs2_uca, my_strnncoll_ucs2_uca,
my_strnncollsp_ucs2_uca, my_strnncollsp_ucs2_uca,
my_strnxfrm_ucs2_uca, my_strnxfrm_ucs2_uca,
my_strnxfrmlen_simple, my_strnxfrmlen_any_uca,
my_like_range_generic, my_like_range_generic,
my_wildcmp_uca, my_wildcmp_uca,
NULL, NULL,
@ -10260,7 +10266,7 @@ MY_COLLATION_HANDLER my_collation_any_uca_handler =
my_strnncoll_any_uca, my_strnncoll_any_uca,
my_strnncollsp_any_uca, my_strnncollsp_any_uca,
my_strnxfrm_any_uca, my_strnxfrm_any_uca,
my_strnxfrmlen_simple, my_strnxfrmlen_any_uca,
my_like_range_mb, my_like_range_mb,
my_wildcmp_uca, my_wildcmp_uca,
NULL, NULL,
@ -11733,7 +11739,7 @@ MY_COLLATION_HANDLER my_collation_utf32_uca_handler =
my_strnncoll_any_uca, my_strnncoll_any_uca,
my_strnncollsp_any_uca, my_strnncollsp_any_uca,
my_strnxfrm_any_uca, my_strnxfrm_any_uca,
my_strnxfrmlen_simple, my_strnxfrmlen_any_uca,
my_like_range_generic, my_like_range_generic,
my_wildcmp_uca, my_wildcmp_uca,
NULL, NULL,
@ -12464,7 +12470,7 @@ MY_COLLATION_HANDLER my_collation_utf16_uca_handler =
my_strnncoll_any_uca, my_strnncoll_any_uca,
my_strnncollsp_any_uca, my_strnncollsp_any_uca,
my_strnxfrm_any_uca, my_strnxfrm_any_uca,
my_strnxfrmlen_simple, my_strnxfrmlen_any_uca,
my_like_range_generic, my_like_range_generic,
my_wildcmp_uca, my_wildcmp_uca,
NULL, NULL,

View File

@ -1626,7 +1626,7 @@ static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler =
my_strnncoll_utf16, my_strnncoll_utf16,
my_strnncollsp_utf16, my_strnncollsp_utf16,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_simple, my_strnxfrmlen_unicode,
my_like_range_generic, my_like_range_generic,
my_wildcmp_utf16_ci, my_wildcmp_utf16_ci,
my_strcasecmp_mb2_or_mb4, my_strcasecmp_mb2_or_mb4,
@ -2200,13 +2200,6 @@ my_strnncollsp_utf32(CHARSET_INFO *cs,
} }
static size_t
my_strnxfrmlen_utf32(CHARSET_INFO *cs __attribute__((unused)), size_t len)
{
return len / 2;
}
static uint static uint
my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)), my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)),
const char *b __attribute__((unused)), const char *b __attribute__((unused)),
@ -2721,7 +2714,7 @@ static MY_COLLATION_HANDLER my_collation_utf32_general_ci_handler =
my_strnncoll_utf32, my_strnncoll_utf32,
my_strnncollsp_utf32, my_strnncollsp_utf32,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf32, my_strnxfrmlen_unicode,
my_like_range_generic, my_like_range_generic,
my_wildcmp_utf32_ci, my_wildcmp_utf32_ci,
my_strcasecmp_mb2_or_mb4, my_strcasecmp_mb2_or_mb4,
@ -3340,7 +3333,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
my_strnncoll_ucs2, my_strnncoll_ucs2,
my_strnncollsp_ucs2, my_strnncollsp_ucs2,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_simple, my_strnxfrmlen_unicode,
my_like_range_generic, my_like_range_generic,
my_wildcmp_ucs2_ci, my_wildcmp_ucs2_ci,
my_strcasecmp_mb2_or_mb4, my_strcasecmp_mb2_or_mb4,
@ -3356,7 +3349,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
my_strnncoll_ucs2_bin, my_strnncoll_ucs2_bin,
my_strnncollsp_ucs2_bin, my_strnncollsp_ucs2_bin,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_simple, my_strnxfrmlen_unicode,
my_like_range_generic, my_like_range_generic,
my_wildcmp_ucs2_bin, my_wildcmp_ucs2_bin,
my_strcasecmp_mb2_or_mb4, my_strcasecmp_mb2_or_mb4,

View File

@ -2218,6 +2218,16 @@ my_strnxfrm_unicode(CHARSET_INFO *cs,
} }
/*
For BMP-only collations that use 2 bytes per weight.
*/
size_t
my_strnxfrmlen_unicode(CHARSET_INFO *cs, size_t len)
{
return ((len + cs->mbmaxlen - 1) / cs->mbmaxlen) * 2;
}
/* /*
Store sorting weights using 3 bytes per character. Store sorting weights using 3 bytes per character.
This function is shared between utf8mb4_bin, utf16_bin, utf32_bin. This function is shared between utf8mb4_bin, utf16_bin, utf32_bin.
@ -2989,13 +2999,6 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
} }
static
size_t my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
size_t len)
{
return (len * 2 + 2) / 3;
}
static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
{ {
my_wc_t wc; my_wc_t wc;
@ -3032,7 +3035,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
my_strnncoll_utf8, my_strnncoll_utf8,
my_strnncollsp_utf8, my_strnncollsp_utf8,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf8, my_strnxfrmlen_unicode,
my_like_range_mb, my_like_range_mb,
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
@ -3048,7 +3051,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_bin_handler =
my_strnncoll_mb_bin, my_strnncoll_mb_bin,
my_strnncollsp_mb_bin, my_strnncollsp_mb_bin,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf8, my_strnxfrmlen_unicode,
my_like_range_mb, my_like_range_mb,
my_wildcmp_mb_bin, my_wildcmp_mb_bin,
my_strcasecmp_mb_bin, my_strcasecmp_mb_bin,
@ -3328,7 +3331,7 @@ static MY_COLLATION_HANDLER my_collation_cs_handler =
my_strnncoll_utf8_cs, my_strnncoll_utf8_cs,
my_strnncollsp_utf8_cs, my_strnncollsp_utf8_cs,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf8, my_strnxfrmlen_unicode,
my_like_range_simple, my_like_range_simple,
my_wildcmp_mb, my_wildcmp_mb,
my_strcasecmp_utf8, my_strcasecmp_utf8,
@ -4601,7 +4604,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
my_strnncoll_utf8, my_strnncoll_utf8,
my_strnncollsp_utf8, my_strnncollsp_utf8,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf8, my_strnxfrmlen_unicode,
my_like_range_mb, my_like_range_mb,
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
@ -5428,14 +5431,6 @@ my_wildcmp_utf8mb4(CHARSET_INFO *cs,
} }
static size_t
my_strnxfrmlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), size_t len)
{
/* TODO: fix when working on WL "Unicode new version" */
return (len * 2 + 2) / 4;
}
static uint static uint
my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e) my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e)
{ {
@ -5468,7 +5463,7 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler=
my_strnncoll_utf8mb4, my_strnncoll_utf8mb4,
my_strnncollsp_utf8mb4, my_strnncollsp_utf8mb4,
my_strnxfrm_unicode, my_strnxfrm_unicode,
my_strnxfrmlen_utf8mb4, my_strnxfrmlen_unicode,
my_like_range_mb, my_like_range_mb,
my_wildcmp_utf8mb4, my_wildcmp_utf8mb4,
my_strcasecmp_utf8mb4, my_strcasecmp_utf8mb4,

View File

@ -691,7 +691,7 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
struct charset_info_st my_charset_cp1250_czech_ci = struct charset_info_st my_charset_cp1250_czech_ci =
{ {
34,0,0, /* number */ 34,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT|MY_CS_STRNXFRM_BAD_NWEIGHTS, /* state */
"cp1250", /* cs name */ "cp1250", /* cs name */
"cp1250_czech_cs", /* name */ "cp1250_czech_cs", /* name */
"", /* comment */ "", /* comment */