Skip to content

Commit 7992dae

Browse files
committed
Merge branch '10.1' of https://github.com/MariaDB/server into ob-10.1
2 parents 7400953 + 61492ea commit 7992dae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+17475
-215
lines changed

include/m_ctype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extern MY_UNICASE_INFO my_unicase_unicode520;
101101
*/
102102
#define MY_UCA_MAX_WEIGHT_SIZE (8+1) /* Including 0 terminator */
103103
#define MY_UCA_CONTRACTION_MAX_WEIGHT_SIZE (2*8+1) /* Including 0 terminator */
104-
#define MY_UCA_WEIGHT_LEVELS 1
104+
#define MY_UCA_WEIGHT_LEVELS 2
105105

106106
typedef struct my_contraction_t
107107
{

mysql-test/include/ctype_thai.inc

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
--echo #
2+
--echo # Start of ctype_thai.inc
3+
--echo #
4+
5+
#
6+
# Test Unicode Thai collations based on libthai testcases
7+
#
8+
9+
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin);
10+
11+
INSERT INTO t1 VALUES ('-กระแย่ง');
12+
INSERT INTO t1 VALUES ('กก');
13+
INSERT INTO t1 VALUES ('กราบ');
14+
INSERT INTO t1 VALUES ('ข่าง');
15+
INSERT INTO t1 VALUES ('ข้าง');
16+
INSERT INTO t1 VALUES ('ข้างกระดาน');
17+
INSERT INTO t1 VALUES ('ข้างขึ้น');
18+
INSERT INTO t1 VALUES ('ข้างควาย');
19+
INSERT INTO t1 VALUES ('ข้างเงิน');
20+
INSERT INTO t1 VALUES ('ข้างแรม');
21+
INSERT INTO t1 VALUES ('ข้างออก');
22+
INSERT INTO t1 VALUES ('ข้างๆ');
23+
INSERT INTO t1 VALUES ('ข้างๆ คูๆ');
24+
INSERT INTO t1 VALUES ('ขาง');
25+
INSERT INTO t1 VALUES ('แข็ง');
26+
INSERT INTO t1 VALUES ('แข่ง');
27+
INSERT INTO t1 VALUES ('แข่งขัน');
28+
INSERT INTO t1 VALUES ('แข้ง');
29+
INSERT INTO t1 VALUES ('แข้งขวา');
30+
INSERT INTO t1 VALUES ('แข็งขัน');
31+
INSERT INTO t1 VALUES ('ทูลเกล้า');
32+
INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม');
33+
INSERT INTO t1 VALUES ('ทูลเกล้าฯ');
34+
INSERT INTO t1 VALUES ('บุญญา');
35+
INSERT INTO t1 VALUES ('บุญ-หลง');
36+
INSERT INTO t1 VALUES ('บุญหลง');
37+
INSERT INTO t1 VALUES ('ป่า');
38+
INSERT INTO t1 VALUES ('ป่าน');
39+
INSERT INTO t1 VALUES ('ป้า');
40+
INSERT INTO t1 VALUES ('ป้าน');
41+
INSERT INTO t1 VALUES ('ป๊า');
42+
INSERT INTO t1 VALUES ('ป๊าน');
43+
INSERT INTO t1 VALUES ('ป๋า');
44+
INSERT INTO t1 VALUES ('ป๋าน');
45+
INSERT INTO t1 VALUES ('ปา');
46+
INSERT INTO t1 VALUES ('ปาน');
47+
INSERT INTO t1 VALUES ('แป้ง');
48+
INSERT INTO t1 VALUES ('พณิชย์');
49+
INSERT INTO t1 VALUES ('ม้า');
50+
INSERT INTO t1 VALUES ('ฯพณฯ');
51+
INSERT INTO t1 VALUES ('A');
52+
INSERT INTO t1 VALUES ('a');
53+
INSERT INTO t1 VALUES ('a\'');
54+
INSERT INTO t1 VALUES ('A-');
55+
INSERT INTO t1 VALUES ('a-');
56+
INSERT INTO t1 VALUES ('-a');
57+
INSERT INTO t1 VALUES ('A.');
58+
INSERT INTO t1 VALUES ('a.');
59+
INSERT INTO t1 VALUES ('A-1');
60+
INSERT INTO t1 VALUES ('aa');
61+
INSERT INTO t1 VALUES ('AA');
62+
INSERT INTO t1 VALUES ('A.A.');
63+
INSERT INTO t1 VALUES ('a.a.');
64+
INSERT INTO t1 VALUES ('AAA');
65+
INSERT INTO t1 VALUES ('A.A.A.');
66+
INSERT INTO t1 VALUES ('AAAA');
67+
INSERT INTO t1 VALUES ('A.A.A.L.');
68+
INSERT INTO t1 VALUES ('A.A.A.S.');
69+
INSERT INTO t1 VALUES ('Aachen');
70+
INSERT INTO t1 VALUES ('A.A.E.');
71+
INSERT INTO t1 VALUES ('A.Ae.E.');
72+
INSERT INTO t1 VALUES ('A.A.E.E.');
73+
INSERT INTO t1 VALUES ('AAES');
74+
INSERT INTO t1 VALUES ('AAF');
75+
INSERT INTO t1 VALUES ('A.Agr');
76+
INSERT INTO t1 VALUES ('aah');
77+
INSERT INTO t1 VALUES ('@@@@@');
78+
INSERT INTO t1 VALUES ('0000');
79+
INSERT INTO t1 VALUES ('9999');
80+
INSERT INTO t1 VALUES ('Aalborg');
81+
INSERT INTO t1 VALUES ('aide');
82+
INSERT INTO t1 VALUES ('air');
83+
INSERT INTO t1 VALUES ('@@@air');
84+
INSERT INTO t1 VALUES ('air@@@');
85+
INSERT INTO t1 VALUES ('C.A.F');
86+
INSERT INTO t1 VALUES ('Canon');
87+
INSERT INTO t1 VALUES ('coop');
88+
INSERT INTO t1 VALUES ('co-op');
89+
INSERT INTO t1 VALUES ('COOP');
90+
INSERT INTO t1 VALUES ('CO-OP');
91+
INSERT INTO t1 VALUES ('Copenhegen');
92+
INSERT INTO t1 VALUES ('McArthur');
93+
INSERT INTO t1 VALUES ('Mc Arthur');
94+
INSERT INTO t1 VALUES ('Mc Mahon');
95+
INSERT INTO t1 VALUES ('vice-president');
96+
INSERT INTO t1 VALUES ('vice versa');
97+
INSERT INTO t1 VALUES ('vice-versa');
98+
INSERT INTO t1 VALUES ('10 ลิตร');
99+
INSERT INTO t1 VALUES ('๑๐ ลิตร');
100+
INSERT INTO t1 VALUES ('10 litre');
101+
INSERT INTO t1 VALUES ('10 litre (10 ลิตร)');
102+
INSERT INTO t1 VALUES ('10 ลิตร (10 litre)');
103+
INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)');
104+
INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)');
105+
INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]');
106+
INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}');
107+
108+
# Sort the table according to binary 'a'
109+
# To avoid problems with unpredictable order or 'AA' and 'aa'
110+
ALTER TABLE t1 ORDER BY a;
111+
112+
SET @backup_character_set_connection=@@character_set_connection;
113+
SET @backup_collation_connection=@@collation_connection;
114+
SET NAMES utf8;
115+
SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)',
116+
' CHARACTER SET ', @backup_character_set_connection,
117+
' COLLATE ', @backup_collation_connection,
118+
' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY'
119+
' , ADD KEY a_id (a, id)');
120+
PREPARE stmt FROM @stmt;
121+
EXECUTE stmt;
122+
DEALLOCATE PREPARE stmt;
123+
SET collation_connection=@backup_collation_connection;
124+
125+
SHOW CREATE TABLE t1;
126+
127+
--echo #
128+
--echo # Ascending sort, using filesort
129+
--echo #
130+
EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a;
131+
SELECT a FROM t1 ORDER BY a, BINARY a;
132+
133+
--echo #
134+
--echo # Descending sort, using filesort
135+
--echo #
136+
EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC;
137+
SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC;
138+
139+
140+
--echo #
141+
--echo # Ascending sort, using index
142+
--echo #
143+
EXPLAIN SELECT a FROM t1 ORDER BY a, id;
144+
SELECT a FROM t1 ORDER BY a, id;
145+
146+
--echo #
147+
--echo # Descending sort, using index
148+
--echo #
149+
EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC;
150+
SELECT a FROM t1 ORDER BY a DESC, id DESC;
151+
152+
DROP TABLE t1;
153+
154+
--echo #
155+
--echo # End of ctype_thai.inc
156+
--echo #

mysql-test/include/ctype_uca_w2.inc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
--echo #
2+
--echo # Start of ctype_uca_w2.inc
3+
--echo #
4+
5+
SELECT @@collation_connection;
6+
7+
SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME
8+
FROM INFORMATION_SCHEMA.COLLATIONS
9+
WHERE COLLATION_NAME LIKE @@collation_connection;
10+
11+
--echo #
12+
--echo # Testing strnxfrm
13+
--echo #
14+
15+
CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
16+
SHOW CREATE TABLE t1;
17+
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
18+
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
19+
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1;
20+
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) FROM t1;
21+
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1;
22+
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1;
23+
DROP TABLE t1;
24+
25+
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
26+
SHOW CREATE TABLE t1;
27+
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
28+
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
29+
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
30+
31+
SET @backup_character_set_connection=@@character_set_connection;
32+
SET @backup_collation_connection=@@collation_connection;
33+
34+
SET NAMES utf8;
35+
SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin,
36+
' CHARACTER SET ', @backup_character_set_connection,
37+
' COLLATE ', @backup_collation_connection);
38+
PREPARE stmt FROM @stmt;
39+
EXECUTE stmt;
40+
DEALLOCATE PREPARE stmt;
41+
SET collation_connection=@backup_collation_connection;
42+
43+
SHOW CREATE TABLE t1;
44+
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
45+
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC;
46+
DROP TABLE t1;
47+
48+
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
49+
SHOW CREATE TABLE t1;
50+
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
51+
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
52+
SELECT * FROM t1 ORDER BY a;
53+
SELECT * FROM t1 ORDER BY a DESC;
54+
DROP TABLE t1;
55+
56+
--echo #
57+
--echo # End of ctype_uca_w2.inc
58+
--echo #

0 commit comments

Comments
 (0)