Commit dd7f3073 authored by Alexander Barkov's avatar Alexander Barkov

- Moving tests from t/ctype_uca_th.test to include/ctype_uca_w2.inc

  and including it from t/ctype_uca.test
- Deleting r/ctype_uca_th.result
parent a8cd030e
--echo #
--echo # Start of ctype_uca_w2.inc
--echo #
SELECT @@collation_connection;
SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME
FROM INFORMATION_SCHEMA.COLLATIONS
WHERE COLLATION_NAME LIKE 'utf8_thai_520_w2';
SET NAMES utf8;
WHERE COLLATION_NAME LIKE @@collation_connection;
--echo #
--echo # Testing strnxfrm
--echo #
CREATE TABLE t1 (a VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1;
......@@ -19,19 +22,31 @@ SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1;
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2;
SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)',
' CHARACTER SET ', @@character_set_connection,
' COLLATE ', @@collation_connection);
PREPARE stmt FROM @stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SHOW CREATE TABLE t1;
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t1 ORDER BY a DESC;
DROP TABLE t1;
--echo #
--echo # End of ctype_uca_w2.inc
--echo #
......@@ -13979,7 +13979,141 @@ SELECT * FROM t1 WHERE a='a' AND a=_utf8'a';
a
a
DROP TABLE t1;
SET NAMES utf8;
SET NAMES utf8 COLLATE utf8_thai_520_w2;
#
# Start of ctype_uca_w2.inc
#
SELECT @@collation_connection;
@@collation_connection
utf8_thai_520_w2
SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME
FROM INFORMATION_SCHEMA.COLLATIONS
WHERE COLLATION_NAME LIKE @@collation_connection;
ID SORTLEN COLLATION_NAME CHARACTER_SET_NAME
578 4 utf8_thai_520_w2 utf8
#
# Testing strnxfrm
#
CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8)))
020A020A020A020A020A020A020A020A00200020002000200020002000200020
20 020A020A020A020A020A020A020A020A00200020002000200020002000200020
2020 020A020A020A020A020A020A020A020A00200020002000200020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4)))
020A020A020A020A0020002000200020
20 020A020A020A020A0020002000200020
2020 020A020A020A020A0020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1))
020A020A020A020A
20 020A020A020A020A
2020 020A020A020A020A
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2))
0020002000200020
20 0020002000200020
2020 0020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3))
0020002000200020
20 0020002000200020
2020 0020002000200020
DROP TABLE t1;
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
a HEX(WEIGHT_STRING(a LEVEL 2))
A 0020
Á 00200032
À 00200035
 0020003C
Å 00200043
Ä 00200047
à 0020004E
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
a HEX(WEIGHT_STRING(a LEVEL 2))
à 0020004E
Ä 00200047
Å 00200043
 0020003C
À 00200035
Á 00200032
A 0020
SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)',
' CHARACTER SET ', @@character_set_connection,
' COLLATE ', @@collation_connection);
PREPARE stmt FROM @stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
a HEX(WEIGHT_STRING(a LEVEL 2))
A 0020
Á 00200032
À 00200035
 0020003C
Å 00200043
Ä 00200047
à 0020004E
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
a HEX(WEIGHT_STRING(a LEVEL 2))
à 0020004E
Ä 00200047
Å 00200043
 0020003C
À 00200035
Á 00200032
A 0020
DROP TABLE t1;
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
SELECT * FROM t1 ORDER BY a;
a
cota
cote
coté
cotë
côte
côté
côtë
cotz
SELECT * FROM t1 ORDER BY a DESC;
a
cotz
côtë
côté
côte
cotë
coté
cote
cota
DROP TABLE t1;
#
# End of ctype_uca_w2.inc
#
#
# End of MariaDB-10.1 tests
#
SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME
FROM INFORMATION_SCHEMA.COLLATIONS
WHERE COLLATION_NAME LIKE 'utf8_thai_520_w2';
ID SORTLEN COLLATION_NAME CHARACTER_SET_NAME
578 4 utf8_thai_520_w2 utf8
SET NAMES utf8;
#
# Testing strnxfrm
#
CREATE TABLE t1 (a VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8)))
020A020A020A020A020A020A020A020A00200020002000200020002000200020
20 020A020A020A020A020A020A020A020A00200020002000200020002000200020
2020 020A020A020A020A020A020A020A020A00200020002000200020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4)))
020A020A020A020A0020002000200020
20 020A020A020A020A0020002000200020
2020 020A020A020A020A0020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1))
020A020A020A020A
20 020A020A020A020A
2020 020A020A020A020A
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2))
0020002000200020
20 0020002000200020
2020 0020002000200020
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1;
HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3))
0020002000200020
20 0020002000200020
2020 0020002000200020
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
a HEX(WEIGHT_STRING(a LEVEL 2))
A 0020
Á 00200032
À 00200035
 0020003C
Å 00200043
Ä 00200047
à 0020004E
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
a HEX(WEIGHT_STRING(a LEVEL 2))
à 0020004E
Ä 00200047
Å 00200043
 0020003C
À 00200035
Á 00200032
A 0020
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2;
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
a HEX(WEIGHT_STRING(a LEVEL 2))
A 0020
Á 00200032
À 00200035
 0020003C
Å 00200043
Ä 00200047
à 0020004E
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
a HEX(WEIGHT_STRING(a LEVEL 2))
à 0020004E
Ä 00200047
Å 00200043
 0020003C
À 00200035
Á 00200032
A 0020
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2);
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
SELECT * FROM t1 ORDER BY a;
a
cota
cote
coté
cotë
côte
côté
côtë
cotz
SELECT * FROM t1 ORDER BY a DESC;
a
cotz
côtë
côté
côte
cotë
coté
cote
cota
DROP TABLE t1;
......@@ -642,7 +642,10 @@ SELECT * FROM t1 WHERE a=_utf8'a';
# Make sure this does not return "Illegal mix of collations"
SELECT * FROM t1 WHERE a='a' AND a=_utf8'a';
DROP TABLE t1;
SET NAMES utf8;
SET NAMES utf8 COLLATE utf8_thai_520_w2;
--source include/ctype_uca_w2.inc
--echo #
--echo # End of MariaDB-10.1 tests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment