From bc546225c08d46f33bf0630a7755ef568b9ac3cc Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 30 May 2016 16:56:29 +0400 Subject: [PATCH] Adding collations utf8mb4_thai_520_w2, ucs2_thai_520_w2, utf16_thai_520_w2, utf32_thai_520_w2 --- mysql-test/include/ctype_thai.inc | 9 +- mysql-test/include/ctype_uca_w2.inc | 12 +- mysql-test/r/ctype_like_range.result | 735 ++++++++++++++++++ mysql-test/r/ctype_uca.result | 699 ++++++++++++++++- mysql-test/r/ctype_utf16_uca.result | 687 ++++++++++++++++ mysql-test/r/ctype_utf32_uca.result | 687 ++++++++++++++++ mysql-test/r/ctype_utf8mb4_uca.result | 687 ++++++++++++++++ .../funcs/r/db_alter_collate_ascii.result | 4 + .../funcs/r/db_alter_collate_utf8.result | 4 + mysql-test/t/ctype_like_range.test | 15 + mysql-test/t/ctype_uca.test | 5 + mysql-test/t/ctype_utf16_uca.test | 13 + mysql-test/t/ctype_utf32_uca.test | 13 + mysql-test/t/ctype_utf8mb4_uca.test | 13 + mysys/charset-def.c | 12 +- strings/ctype-uca.c | 163 +++- strings/ctype-utf8.c | 36 +- 17 files changed, 3764 insertions(+), 30 deletions(-) diff --git a/mysql-test/include/ctype_thai.inc b/mysql-test/include/ctype_thai.inc index fb42decff5e..f72de9e93b6 100644 --- a/mysql-test/include/ctype_thai.inc +++ b/mysql-test/include/ctype_thai.inc @@ -109,14 +109,19 @@ INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); # To avoid problems with unpredictable order or 'AA' and 'aa' ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', - ' CHARACTER SET ', @@character_set_connection, - ' COLLATE ', @@collation_connection, + ' CHARACTER SET ', @backup_character_set_connection, + ' COLLATE ', @backup_collation_connection, ' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' ' , ADD KEY a_id (a, id)'); PREPARE stmt FROM @stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; + SHOW CREATE TABLE t1; --echo # diff --git a/mysql-test/include/ctype_uca_w2.inc b/mysql-test/include/ctype_uca_w2.inc index d3074b82510..86ed7ddd134 100644 --- a/mysql-test/include/ctype_uca_w2.inc +++ b/mysql-test/include/ctype_uca_w2.inc @@ -28,12 +28,18 @@ 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; -SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)', - ' CHARACTER SET ', @@character_set_connection, - ' COLLATE ', @@collation_connection); +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; + +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, + ' CHARACTER SET ', @backup_character_set_connection, + ' COLLATE ', @backup_collation_connection); PREPARE stmt FROM @stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; + 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; diff --git a/mysql-test/r/ctype_like_range.result b/mysql-test/r/ctype_like_range.result index 84c4f562190..be66c680e3a 100644 --- a/mysql-test/r/ctype_like_range.result +++ b/mysql-test/r/ctype_like_range.result @@ -874,6 +874,153 @@ id name val 36 mn E5BD9F 36 mx E5BD9F 36 sp -------------------------------- +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_thai_520_w2; +SELECT * FROM v1; +id name val +1 a +1 mn +1 mx +1 sp -------------------------------- +2 a _ +2 mn 09 +2 mx EFBFBF +2 sp -------------------------------- +3 a % +3 mn 09090909090909090909090909090909 +3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20 +3 sp -------------------------------- +4 a \_ +4 mn 5F +4 mx 5F +4 sp -------------------------------- +5 a \% +5 mn 25 +5 mx 25 +5 sp -------------------------------- +6 a \ +6 mn 5C +6 mx 5C +6 sp -------------------------------- +7 a a +7 mn 61 +7 mx 61 +7 sp -------------------------------- +8 a c +8 mn 63 +8 mx 63 +8 sp -------------------------------- +9 a a_ +9 mn 6109 +9 mx 61EFBFBF +9 sp -------------------------------- +10 a c_ +10 mn 6309 +10 mx 63EFBFBF +10 sp -------------------------------- +11 a a% +11 mn 61090909090909090909090909090909 +11 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF +11 sp -------------------------------- +12 a c% +12 mn 63090909090909090909090909090909 +12 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF +12 sp -------------------------------- +13 a aa +13 mn 6161 +13 mx 6161 +13 sp -------------------------------- +14 a cc +14 mn 6363 +14 mx 6363 +14 sp -------------------------------- +15 a ch +15 mn 6368 +15 mx 6368 +15 sp -------------------------------- +16 a aa_ +16 mn 616109 +16 mx 6161EFBFBF +16 sp -------------------------------- +17 a cc_ +17 mn 636309 +17 mx 6363EFBFBF +17 sp -------------------------------- +18 a ch_ +18 mn 636809 +18 mx 6368EFBFBF +18 sp -------------------------------- +19 a aa% +19 mn 61610909090909090909090909090909 +19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020 +19 sp -------------------------------- +20 a cc% +20 mn 63630909090909090909090909090909 +20 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020 +20 sp -------------------------------- +21 a ch% +21 mn 63680909090909090909090909090909 +21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020 +21 sp -------------------------------- +22 a aaa +22 mn 616161 +22 mx 616161 +22 sp -------------------------------- +23 a ccc +23 mn 636363 +23 mx 636363 +23 sp -------------------------------- +24 a cch +24 mn 636368 +24 mx 636368 +24 sp -------------------------------- +25 a aaa_ +25 mn 61616109 +25 mx 616161EFBFBF +25 sp -------------------------------- +26 a ccc_ +26 mn 63636309 +26 mx 636363EFBFBF +26 sp -------------------------------- +27 a cch_ +27 mn 63636809 +27 mx 636368EFBFBF +27 sp -------------------------------- +28 a aaa% +28 mn 61616109090909090909090909090909 +28 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20 +28 sp -------------------------------- +29 a ccc% +29 mn 63636309090909090909090909090909 +29 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20 +29 sp -------------------------------- +30 a cch% +30 mn 63636809090909090909090909090909 +30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20 +30 sp -------------------------------- +31 a aaaaaaaaaaaaaaaaaaaa +31 mn 6161616161 +31 mx 6161616161 +31 sp -------------------------------- +32 a caaaaaaaaaaaaaaaaaaa +32 mn 6361616161 +32 mx 6361616161 +32 sp -------------------------------- +33 a Х +33 mn D0A5 +33 mx D0A5 +33 sp -------------------------------- +34 a џ +34 mn D19F +34 mx D19F +34 sp -------------------------------- +35 a ┥ +35 mn E294A5 +35 mx E294A5 +35 sp -------------------------------- +36 a 彟 +36 mn E5BD9F +36 mx E5BD9F +36 sp -------------------------------- ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4; SELECT * FROM v1; id name val @@ -1462,6 +1609,153 @@ id name val 36 mn E5BD9F 36 mx E5BD9F 36 sp -------------------------------- +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2; +SELECT * FROM v1; +id name val +1 a +1 mn +1 mx +1 sp -------------------------------- +2 a _ +2 mn 09 +2 mx EFBFBF +2 sp -------------------------------- +3 a % +3 mn 09090909090909090909090909090909 +3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20 +3 sp -------------------------------- +4 a \_ +4 mn 5F +4 mx 5F +4 sp -------------------------------- +5 a \% +5 mn 25 +5 mx 25 +5 sp -------------------------------- +6 a \ +6 mn 5C +6 mx 5C +6 sp -------------------------------- +7 a a +7 mn 61 +7 mx 61 +7 sp -------------------------------- +8 a c +8 mn 63 +8 mx 63 +8 sp -------------------------------- +9 a a_ +9 mn 6109 +9 mx 61EFBFBF +9 sp -------------------------------- +10 a c_ +10 mn 6309 +10 mx 63EFBFBF +10 sp -------------------------------- +11 a a% +11 mn 61090909090909090909090909090909 +11 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF +11 sp -------------------------------- +12 a c% +12 mn 63090909090909090909090909090909 +12 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF +12 sp -------------------------------- +13 a aa +13 mn 6161 +13 mx 6161 +13 sp -------------------------------- +14 a cc +14 mn 6363 +14 mx 6363 +14 sp -------------------------------- +15 a ch +15 mn 6368 +15 mx 6368 +15 sp -------------------------------- +16 a aa_ +16 mn 616109 +16 mx 6161EFBFBF +16 sp -------------------------------- +17 a cc_ +17 mn 636309 +17 mx 6363EFBFBF +17 sp -------------------------------- +18 a ch_ +18 mn 636809 +18 mx 6368EFBFBF +18 sp -------------------------------- +19 a aa% +19 mn 61610909090909090909090909090909 +19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020 +19 sp -------------------------------- +20 a cc% +20 mn 63630909090909090909090909090909 +20 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020 +20 sp -------------------------------- +21 a ch% +21 mn 63680909090909090909090909090909 +21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020 +21 sp -------------------------------- +22 a aaa +22 mn 616161 +22 mx 616161 +22 sp -------------------------------- +23 a ccc +23 mn 636363 +23 mx 636363 +23 sp -------------------------------- +24 a cch +24 mn 636368 +24 mx 636368 +24 sp -------------------------------- +25 a aaa_ +25 mn 61616109 +25 mx 616161EFBFBF +25 sp -------------------------------- +26 a ccc_ +26 mn 63636309 +26 mx 636363EFBFBF +26 sp -------------------------------- +27 a cch_ +27 mn 63636809 +27 mx 636368EFBFBF +27 sp -------------------------------- +28 a aaa% +28 mn 61616109090909090909090909090909 +28 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20 +28 sp -------------------------------- +29 a ccc% +29 mn 63636309090909090909090909090909 +29 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20 +29 sp -------------------------------- +30 a cch% +30 mn 63636809090909090909090909090909 +30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20 +30 sp -------------------------------- +31 a aaaaaaaaaaaaaaaaaaaa +31 mn 61616161 +31 mx 61616161 +31 sp -------------------------------- +32 a caaaaaaaaaaaaaaaaaaa +32 mn 63616161 +32 mx 63616161 +32 sp -------------------------------- +33 a Х +33 mn D0A5 +33 mx D0A5 +33 sp -------------------------------- +34 a џ +34 mn D19F +34 mx D19F +34 sp -------------------------------- +35 a ┥ +35 mn E294A5 +35 mx E294A5 +35 sp -------------------------------- +36 a 彟 +36 mn E5BD9F +36 mx E5BD9F +36 sp -------------------------------- ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci; SELECT * FROM v1; id name val @@ -2197,6 +2491,153 @@ id name val 36 mn 5F5F 36 mx 5F5F 36 sp -------------------------------- +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2; +SELECT * FROM v1; +id name val +1 a +1 mn +1 mx +1 sp -------------------------------- +2 a _ +2 mn 0009 +2 mx FFFF +2 sp -------------------------------- +3 a % +3 mn 00090009000900090009000900090009 +3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +3 sp -------------------------------- +4 a \_ +4 mn 005F +4 mx 005F +4 sp -------------------------------- +5 a \% +5 mn 0025 +5 mx 0025 +5 sp -------------------------------- +6 a \ +6 mn 005C +6 mx 005C +6 sp -------------------------------- +7 a a +7 mn 0061 +7 mx 0061 +7 sp -------------------------------- +8 a c +8 mn 0063 +8 mx 0063 +8 sp -------------------------------- +9 a a_ +9 mn 00610009 +9 mx 0061FFFF +9 sp -------------------------------- +10 a c_ +10 mn 00630009 +10 mx 0063FFFF +10 sp -------------------------------- +11 a a% +11 mn 00610009000900090009000900090009 +11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF +11 sp -------------------------------- +12 a c% +12 mn 00630009000900090009000900090009 +12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF +12 sp -------------------------------- +13 a aa +13 mn 00610061 +13 mx 00610061 +13 sp -------------------------------- +14 a cc +14 mn 00630063 +14 mx 00630063 +14 sp -------------------------------- +15 a ch +15 mn 00630068 +15 mx 00630068 +15 sp -------------------------------- +16 a aa_ +16 mn 006100610009 +16 mx 00610061FFFF +16 sp -------------------------------- +17 a cc_ +17 mn 006300630009 +17 mx 00630063FFFF +17 sp -------------------------------- +18 a ch_ +18 mn 006300680009 +18 mx 00630068FFFF +18 sp -------------------------------- +19 a aa% +19 mn 00610061000900090009000900090009 +19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF +19 sp -------------------------------- +20 a cc% +20 mn 00630063000900090009000900090009 +20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF +20 sp -------------------------------- +21 a ch% +21 mn 00630068000900090009000900090009 +21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF +21 sp -------------------------------- +22 a aaa +22 mn 006100610061 +22 mx 006100610061 +22 sp -------------------------------- +23 a ccc +23 mn 006300630063 +23 mx 006300630063 +23 sp -------------------------------- +24 a cch +24 mn 006300630068 +24 mx 006300630068 +24 sp -------------------------------- +25 a aaa_ +25 mn 0061006100610009 +25 mx 006100610061FFFF +25 sp -------------------------------- +26 a ccc_ +26 mn 0063006300630009 +26 mx 006300630063FFFF +26 sp -------------------------------- +27 a cch_ +27 mn 0063006300680009 +27 mx 006300630068FFFF +27 sp -------------------------------- +28 a aaa% +28 mn 00610061006100090009000900090009 +28 mx 006100610061FFFFFFFFFFFFFFFFFFFF +28 sp -------------------------------- +29 a ccc% +29 mn 00630063006300090009000900090009 +29 mx 006300630063FFFFFFFFFFFFFFFFFFFF +29 sp -------------------------------- +30 a cch% +30 mn 00630063006800090009000900090009 +30 mx 006300630068FFFFFFFFFFFFFFFFFFFF +30 sp -------------------------------- +31 a aaaaaaaaaaaaaaaaaaaa +31 mn 00610061006100610061006100610061 +31 mx 00610061006100610061006100610061 +31 sp -------------------------------- +32 a caaaaaaaaaaaaaaaaaaa +32 mn 00630061006100610061006100610061 +32 mx 00630061006100610061006100610061 +32 sp -------------------------------- +33 a Х +33 mn 0425 +33 mx 0425 +33 sp -------------------------------- +34 a џ +34 mn 045F +34 mx 045F +34 sp -------------------------------- +35 a ┥ +35 mn 2525 +35 mx 2525 +35 sp -------------------------------- +36 a 彟 +36 mn 5F5F +36 mx 5F5F +36 sp -------------------------------- ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16; SELECT * FROM v1; id name val @@ -2785,6 +3226,153 @@ id name val 36 mn 5F5F 36 mx 5F5F 36 sp -------------------------------- +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_thai_520_w2; +SELECT * FROM v1; +id name val +1 a +1 mn +1 mx +1 sp -------------------------------- +2 a _ +2 mn 0009 +2 mx FFFF +2 sp -------------------------------- +3 a % +3 mn 00090009000900090009000900090009 +3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +3 sp -------------------------------- +4 a \_ +4 mn 005F +4 mx 005F +4 sp -------------------------------- +5 a \% +5 mn 0025 +5 mx 0025 +5 sp -------------------------------- +6 a \ +6 mn 005C +6 mx 005C +6 sp -------------------------------- +7 a a +7 mn 0061 +7 mx 0061 +7 sp -------------------------------- +8 a c +8 mn 0063 +8 mx 0063 +8 sp -------------------------------- +9 a a_ +9 mn 00610009 +9 mx 0061FFFF +9 sp -------------------------------- +10 a c_ +10 mn 00630009 +10 mx 0063FFFF +10 sp -------------------------------- +11 a a% +11 mn 00610009000900090009000900090009 +11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF +11 sp -------------------------------- +12 a c% +12 mn 00630009000900090009000900090009 +12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF +12 sp -------------------------------- +13 a aa +13 mn 00610061 +13 mx 00610061 +13 sp -------------------------------- +14 a cc +14 mn 00630063 +14 mx 00630063 +14 sp -------------------------------- +15 a ch +15 mn 00630068 +15 mx 00630068 +15 sp -------------------------------- +16 a aa_ +16 mn 006100610009 +16 mx 00610061FFFF +16 sp -------------------------------- +17 a cc_ +17 mn 006300630009 +17 mx 00630063FFFF +17 sp -------------------------------- +18 a ch_ +18 mn 006300680009 +18 mx 00630068FFFF +18 sp -------------------------------- +19 a aa% +19 mn 00610061000900090009000900090009 +19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF +19 sp -------------------------------- +20 a cc% +20 mn 00630063000900090009000900090009 +20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF +20 sp -------------------------------- +21 a ch% +21 mn 00630068000900090009000900090009 +21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF +21 sp -------------------------------- +22 a aaa +22 mn 006100610061 +22 mx 006100610061 +22 sp -------------------------------- +23 a ccc +23 mn 006300630063 +23 mx 006300630063 +23 sp -------------------------------- +24 a cch +24 mn 006300630068 +24 mx 006300630068 +24 sp -------------------------------- +25 a aaa_ +25 mn 0061006100610009 +25 mx 006100610061FFFF +25 sp -------------------------------- +26 a ccc_ +26 mn 0063006300630009 +26 mx 006300630063FFFF +26 sp -------------------------------- +27 a cch_ +27 mn 0063006300680009 +27 mx 006300630068FFFF +27 sp -------------------------------- +28 a aaa% +28 mn 00610061006100090009000900090009 +28 mx 006100610061FFFFFFFFFFFFFFFFFFFF +28 sp -------------------------------- +29 a ccc% +29 mn 00630063006300090009000900090009 +29 mx 006300630063FFFFFFFFFFFFFFFFFFFF +29 sp -------------------------------- +30 a cch% +30 mn 00630063006800090009000900090009 +30 mx 006300630068FFFFFFFFFFFFFFFFFFFF +30 sp -------------------------------- +31 a aaaaaaaaaaaaaaaaaaaa +31 mn 0061006100610061 +31 mx 0061006100610061 +31 sp -------------------------------- +32 a caaaaaaaaaaaaaaaaaaa +32 mn 0063006100610061 +32 mx 0063006100610061 +32 sp -------------------------------- +33 a Х +33 mn 0425 +33 mx 0425 +33 sp -------------------------------- +34 a џ +34 mn 045F +34 mx 045F +34 sp -------------------------------- +35 a ┥ +35 mn 2525 +35 mx 2525 +35 sp -------------------------------- +36 a 彟 +36 mn 5F5F +36 mx 5F5F +36 sp -------------------------------- ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci; SELECT * FROM v1; id name val @@ -3520,6 +4108,153 @@ id name val 36 mn 00005F5F 36 mx 00005F5F 36 sp -------------------------------- +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_thai_520_w2; +SELECT * FROM v1; +id name val +1 a +1 mn +1 mx +1 sp -------------------------------- +2 a _ +2 mn 00000009 +2 mx 0000FFFF +2 sp -------------------------------- +3 a % +3 mn 00000009000000090000000900000009 +3 mx 0000FFFF0000FFFF0000FFFF0000FFFF +3 sp -------------------------------- +4 a \_ +4 mn 0000005F +4 mx 0000005F +4 sp -------------------------------- +5 a \% +5 mn 00000025 +5 mx 00000025 +5 sp -------------------------------- +6 a \ +6 mn 0000005C +6 mx 0000005C +6 sp -------------------------------- +7 a a +7 mn 00000061 +7 mx 00000061 +7 sp -------------------------------- +8 a c +8 mn 00000063 +8 mx 00000063 +8 sp -------------------------------- +9 a a_ +9 mn 0000006100000009 +9 mx 000000610000FFFF +9 sp -------------------------------- +10 a c_ +10 mn 0000006300000009 +10 mx 000000630000FFFF +10 sp -------------------------------- +11 a a% +11 mn 00000061000000090000000900000009 +11 mx 000000610000FFFF0000FFFF0000FFFF +11 sp -------------------------------- +12 a c% +12 mn 00000063000000090000000900000009 +12 mx 000000630000FFFF0000FFFF0000FFFF +12 sp -------------------------------- +13 a aa +13 mn 0000006100000061 +13 mx 0000006100000061 +13 sp -------------------------------- +14 a cc +14 mn 0000006300000063 +14 mx 0000006300000063 +14 sp -------------------------------- +15 a ch +15 mn 0000006300000068 +15 mx 0000006300000068 +15 sp -------------------------------- +16 a aa_ +16 mn 000000610000006100000009 +16 mx 00000061000000610000FFFF +16 sp -------------------------------- +17 a cc_ +17 mn 000000630000006300000009 +17 mx 00000063000000630000FFFF +17 sp -------------------------------- +18 a ch_ +18 mn 000000630000006800000009 +18 mx 00000063000000680000FFFF +18 sp -------------------------------- +19 a aa% +19 mn 00000061000000610000000900000009 +19 mx 00000061000000610000FFFF0000FFFF +19 sp -------------------------------- +20 a cc% +20 mn 00000063000000630000000900000009 +20 mx 00000063000000630000FFFF0000FFFF +20 sp -------------------------------- +21 a ch% +21 mn 00000063000000680000000900000009 +21 mx 00000063000000680000FFFF0000FFFF +21 sp -------------------------------- +22 a aaa +22 mn 000000610000006100000061 +22 mx 000000610000006100000061 +22 sp -------------------------------- +23 a ccc +23 mn 000000630000006300000063 +23 mx 000000630000006300000063 +23 sp -------------------------------- +24 a cch +24 mn 000000630000006300000068 +24 mx 000000630000006300000068 +24 sp -------------------------------- +25 a aaa_ +25 mn 00000061000000610000006100000009 +25 mx 0000006100000061000000610000FFFF +25 sp -------------------------------- +26 a ccc_ +26 mn 00000063000000630000006300000009 +26 mx 0000006300000063000000630000FFFF +26 sp -------------------------------- +27 a cch_ +27 mn 00000063000000630000006800000009 +27 mx 0000006300000063000000680000FFFF +27 sp -------------------------------- +28 a aaa% +28 mn 00000061000000610000006100000009 +28 mx 0000006100000061000000610000FFFF +28 sp -------------------------------- +29 a ccc% +29 mn 00000063000000630000006300000009 +29 mx 0000006300000063000000630000FFFF +29 sp -------------------------------- +30 a cch% +30 mn 00000063000000630000006800000009 +30 mx 0000006300000063000000680000FFFF +30 sp -------------------------------- +31 a aaaaaaaaaaaaaaaaaaaa +31 mn 00000061000000610000006100000061 +31 mx 00000061000000610000006100000061 +31 sp -------------------------------- +32 a caaaaaaaaaaaaaaaaaaa +32 mn 00000063000000610000006100000061 +32 mx 00000063000000610000006100000061 +32 sp -------------------------------- +33 a Х +33 mn 00000425 +33 mx 00000425 +33 sp -------------------------------- +34 a џ +34 mn 0000045F +34 mx 0000045F +34 sp -------------------------------- +35 a ┥ +35 mn 00002525 +35 mx 00002525 +35 sp -------------------------------- +36 a 彟 +36 mn 00005F5F +36 mx 00005F5F +36 sp -------------------------------- ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci; SELECT * FROM v1; id name val diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 0a3c02ff68a..1609e7fc320 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -14052,12 +14052,16 @@ a HEX(WEIGHT_STRING(a LEVEL 2)) À 00200035 Á 00200032 A 0020 -SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)', -' CHARACTER SET ', @@character_set_connection, -' COLLATE ', @@collation_connection); +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); PREPARE stmt FROM @stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -14215,14 +14219,18 @@ INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', -' CHARACTER SET ', @@character_set_connection, -' COLLATE ', @@collation_connection, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, ' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' ' , ADD KEY a_id (a, id)'); PREPARE stmt FROM @stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -14651,6 +14659,687 @@ DROP TABLE t1; # # End of ctype_thai.inc # +SET NAMES utf8; +SET collation_connection=ucs2_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +ucs2_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 +642 4 ucs2_thai_520_w2 ucs2 +# +# 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 ucs2 COLLATE ucs2_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 +0020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +00200020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4))) + 020A020A020A020A0020002000200020 +0020 020A020A020A020A0020002000200020 +00200020 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 +0020 020A020A020A020A +00200020 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 +0020 0020002000200020 +00200020 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 +0020 0020002000200020 +00200020 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 ucs2 COLLATE ucs2_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 @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET ucs2 COLLATE ucs2_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 ucs2 COLLATE ucs2_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 +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# # # End of MariaDB-10.1 tests # diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result index ac2ed9b2c5b..1ee06062fb6 100644 --- a/mysql-test/r/ctype_utf16_uca.result +++ b/mysql-test/r/ctype_utf16_uca.result @@ -6605,3 +6605,690 @@ DROP TABLE t1; # # End of MariaDB-10.0 tests # +# +# Start of 10.1 tests +# +SET NAMES utf8; +SET collation_connection=utf16_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +utf16_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 +674 4 utf16_thai_520_w2 utf16 +# +# 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 utf16 COLLATE utf16_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 +0020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +00200020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4))) + 020A020A020A020A0020002000200020 +0020 020A020A020A020A0020002000200020 +00200020 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 +0020 020A020A020A020A +00200020 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 +0020 0020002000200020 +00200020 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 +0020 0020002000200020 +00200020 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 utf16 COLLATE utf16_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 @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf16 COLLATE utf16_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 utf16 COLLATE utf16_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 +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result index 89a9e23bf45..dab23a80a43 100644 --- a/mysql-test/r/ctype_utf32_uca.result +++ b/mysql-test/r/ctype_utf32_uca.result @@ -6625,3 +6625,690 @@ DROP TABLE t1; # # End of MariaDB-10.0 tests # +# +# Start of 10.1 tests +# +SET NAMES utf8; +SET collation_connection=utf32_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +utf32_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 +738 4 utf32_thai_520_w2 utf32 +# +# 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 utf32 COLLATE utf32_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 +00000020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +0000002000000020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4))) + 020A020A020A020A0020002000200020 +00000020 020A020A020A020A0020002000200020 +0000002000000020 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 +00000020 020A020A020A020A +0000002000000020 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 +00000020 0020002000200020 +0000002000000020 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 +00000020 0020002000200020 +0000002000000020 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 utf32 COLLATE utf32_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 @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf32 COLLATE utf32_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 utf32 COLLATE utf32_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 +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf8mb4_uca.result b/mysql-test/r/ctype_utf8mb4_uca.result index 1057b9743f4..b711dfb65c8 100644 --- a/mysql-test/r/ctype_utf8mb4_uca.result +++ b/mysql-test/r/ctype_utf8mb4_uca.result @@ -5315,3 +5315,690 @@ DROP TABLE t1; # # End of MariaDB-10.0 tests # +# +# Start of 10.1 tests +# +SET NAMES utf8; +SET collation_connection=utf8mb4_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_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 +610 4 utf8mb4_thai_520_w2 utf8mb4 +# +# 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 utf8mb4 COLLATE utf8mb4_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 utf8mb4 COLLATE utf8mb4_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 @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_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 utf8mb4 COLLATE utf8mb4_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 +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# +# +# End of 10.1 tests +# diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result index a37a9218aa2..ee127d76bcc 100644 --- a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result +++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result @@ -114,6 +114,7 @@ ucs2_vietnamese_ci ucs2 151 # # ucs2_general_mysql500_ci ucs2 159 # # ucs2_croatian_ci ucs2 640 # # ucs2_myanmar_ci ucs2 641 # # +ucs2_thai_520_w2 ucs2 642 # # cp866_general_ci cp866 36 Yes # # cp866_bin cp866 68 # # keybcs2_general_ci keybcs2 37 Yes # # @@ -156,6 +157,7 @@ utf8mb4_unicode_520_ci utf8mb4 246 # # utf8mb4_vietnamese_ci utf8mb4 247 # # utf8mb4_croatian_ci utf8mb4 608 # # utf8mb4_myanmar_ci utf8mb4 609 # # +utf8mb4_thai_520_w2 utf8mb4 610 # # cp1251_bulgarian_ci cp1251 14 # # cp1251_ukrainian_ci cp1251 23 # # cp1251_bin cp1251 50 # # @@ -189,6 +191,7 @@ utf16_unicode_520_ci utf16 123 # # utf16_vietnamese_ci utf16 124 # # utf16_croatian_ci utf16 672 # # utf16_myanmar_ci utf16 673 # # +utf16_thai_520_w2 utf16 674 # # utf16le_general_ci utf16le 56 Yes # # utf16le_bin utf16le 62 # # cp1256_general_ci cp1256 57 Yes # # @@ -224,6 +227,7 @@ utf32_unicode_520_ci utf32 182 # # utf32_vietnamese_ci utf32 183 # # utf32_croatian_ci utf32 736 # # utf32_myanmar_ci utf32 737 # # +utf32_thai_520_w2 utf32 738 # # binary binary 63 Yes # # geostd8_general_ci geostd8 92 Yes # # geostd8_bin geostd8 93 # # diff --git a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result index 66b6a63121e..46921fcaa8c 100644 --- a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result +++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result @@ -114,6 +114,7 @@ ucs2_vietnamese_ci ucs2 151 # # ucs2_general_mysql500_ci ucs2 159 # # ucs2_croatian_ci ucs2 640 # # ucs2_myanmar_ci ucs2 641 # # +ucs2_thai_520_w2 ucs2 642 # # cp866_general_ci cp866 36 Yes # # cp866_bin cp866 68 # # keybcs2_general_ci keybcs2 37 Yes # # @@ -156,6 +157,7 @@ utf8mb4_unicode_520_ci utf8mb4 246 # # utf8mb4_vietnamese_ci utf8mb4 247 # # utf8mb4_croatian_ci utf8mb4 608 # # utf8mb4_myanmar_ci utf8mb4 609 # # +utf8mb4_thai_520_w2 utf8mb4 610 # # cp1251_bulgarian_ci cp1251 14 # # cp1251_ukrainian_ci cp1251 23 # # cp1251_bin cp1251 50 # # @@ -189,6 +191,7 @@ utf16_unicode_520_ci utf16 123 # # utf16_vietnamese_ci utf16 124 # # utf16_croatian_ci utf16 672 # # utf16_myanmar_ci utf16 673 # # +utf16_thai_520_w2 utf16 674 # # utf16le_general_ci utf16le 56 Yes # # utf16le_bin utf16le 62 # # cp1256_general_ci cp1256 57 Yes # # @@ -224,6 +227,7 @@ utf32_unicode_520_ci utf32 182 # # utf32_vietnamese_ci utf32 183 # # utf32_croatian_ci utf32 736 # # utf32_myanmar_ci utf32 737 # # +utf32_thai_520_w2 utf32 738 # # binary binary 63 Yes # # geostd8_general_ci geostd8 92 Yes # # geostd8_bin geostd8 93 # # diff --git a/mysql-test/t/ctype_like_range.test b/mysql-test/t/ctype_like_range.test index f251dabe989..e9387e46eb4 100644 --- a/mysql-test/t/ctype_like_range.test +++ b/mysql-test/t/ctype_like_range.test @@ -56,6 +56,9 @@ SELECT * FROM v1; ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_danish_ci; SELECT * FROM v1; +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_thai_520_w2; +SELECT * FROM v1; + ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4; SELECT * FROM v1; @@ -71,6 +74,9 @@ SELECT * FROM v1; ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci; SELECT * FROM v1; +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2; +SELECT * FROM v1; + ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci; SELECT * FROM v1; @@ -86,6 +92,9 @@ SELECT * FROM v1; ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_danish_ci; SELECT * FROM v1; +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2; +SELECT * FROM v1; + ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16; SELECT * FROM v1; @@ -101,6 +110,9 @@ SELECT * FROM v1; ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_danish_ci; SELECT * FROM v1; +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_thai_520_w2; +SELECT * FROM v1; + ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci; SELECT * FROM v1; @@ -116,6 +128,9 @@ SELECT * FROM v1; ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_danish_ci; SELECT * FROM v1; +ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_thai_520_w2; +SELECT * FROM v1; + ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci; SELECT * FROM v1; diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 670c407e611..7406bafc5e6 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -648,6 +648,11 @@ SET NAMES utf8 COLLATE utf8_thai_520_w2; --source include/ctype_uca_w2.inc --source include/ctype_thai.inc +SET NAMES utf8; +SET collation_connection=ucs2_thai_520_w2; +--source include/ctype_uca_w2.inc +--source include/ctype_thai.inc + --echo # --echo # End of MariaDB-10.1 tests --echo # diff --git a/mysql-test/t/ctype_utf16_uca.test b/mysql-test/t/ctype_utf16_uca.test index 63799054ae8..160d5b19d12 100644 --- a/mysql-test/t/ctype_utf16_uca.test +++ b/mysql-test/t/ctype_utf16_uca.test @@ -208,3 +208,16 @@ SET collation_connection=utf16_myanmar_ci; --echo # --echo # End of MariaDB-10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +SET NAMES utf8; +SET collation_connection=utf16_thai_520_w2; +--source include/ctype_uca_w2.inc +--source include/ctype_thai.inc + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_utf32_uca.test b/mysql-test/t/ctype_utf32_uca.test index 6052ea7b334..fb691221db8 100644 --- a/mysql-test/t/ctype_utf32_uca.test +++ b/mysql-test/t/ctype_utf32_uca.test @@ -229,3 +229,16 @@ SET collation_connection=utf32_myanmar_ci; --echo # --echo # End of MariaDB-10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +SET NAMES utf8; +SET collation_connection=utf32_thai_520_w2; +--source include/ctype_uca_w2.inc +--source include/ctype_thai.inc + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_utf8mb4_uca.test b/mysql-test/t/ctype_utf8mb4_uca.test index a5493e78c47..e56c6d7b884 100644 --- a/mysql-test/t/ctype_utf8mb4_uca.test +++ b/mysql-test/t/ctype_utf8mb4_uca.test @@ -70,3 +70,16 @@ SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci; --echo # --echo # End of MariaDB-10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +SET NAMES utf8; +SET collation_connection=utf8mb4_thai_520_w2; +--source include/ctype_uca_w2.inc +--source include/ctype_thai.inc + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysys/charset-def.c b/mysys/charset-def.c index 55463e0a4b6..defb5c0062d 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -49,6 +49,7 @@ extern struct charset_info_st my_charset_ucs2_unicode_520_ci; extern struct charset_info_st my_charset_ucs2_vietnamese_ci; extern struct charset_info_st my_charset_ucs2_croatian_uca_ci; extern struct charset_info_st my_charset_ucs2_myanmar_uca_ci; +extern struct charset_info_st my_charset_ucs2_thai_520_w2; #endif @@ -78,6 +79,7 @@ extern struct charset_info_st my_charset_utf32_unicode_520_ci; extern struct charset_info_st my_charset_utf32_vietnamese_ci; extern struct charset_info_st my_charset_utf32_croatian_uca_ci; extern struct charset_info_st my_charset_utf32_myanmar_uca_ci; +extern struct charset_info_st my_charset_utf32_thai_520_w2; #endif /* HAVE_CHARSET_utf32 */ @@ -107,6 +109,7 @@ extern struct charset_info_st my_charset_utf16_unicode_520_ci; extern struct charset_info_st my_charset_utf16_vietnamese_ci; extern struct charset_info_st my_charset_utf16_croatian_uca_ci; extern struct charset_info_st my_charset_utf16_myanmar_uca_ci; +extern struct charset_info_st my_charset_utf16_thai_520_w2; #endif /* HAVE_CHARSET_utf16 */ @@ -133,10 +136,10 @@ extern struct charset_info_st my_charset_utf8_hungarian_uca_ci; extern struct charset_info_st my_charset_utf8_croatian_mysql561_uca_ci; extern struct charset_info_st my_charset_utf8_sinhala_uca_ci; extern struct charset_info_st my_charset_utf8_unicode_520_ci; -extern struct charset_info_st my_charset_utf8_thai_520_w2; extern struct charset_info_st my_charset_utf8_vietnamese_ci; extern struct charset_info_st my_charset_utf8_croatian_uca_ci; extern struct charset_info_st my_charset_utf8_myanmar_uca_ci; +extern struct charset_info_st my_charset_utf8_thai_520_w2; #ifdef HAVE_UTF8_GENERAL_CS extern struct charset_info_st my_charset_utf8_general_cs; #endif @@ -168,6 +171,7 @@ extern struct charset_info_st my_charset_utf8mb4_unicode_520_ci; extern struct charset_info_st my_charset_utf8mb4_vietnamese_ci; extern struct charset_info_st my_charset_utf8mb4_croatian_uca_ci; extern struct charset_info_st my_charset_utf8mb4_myanmar_uca_ci; +extern struct charset_info_st my_charset_utf8mb4_thai_520_w2; #endif /* HAVE_CHARSET_utf8mb4 */ #endif /* HAVE_UCA_COLLATIONS */ @@ -262,6 +266,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_ucs2_vietnamese_ci); add_compiled_collation(&my_charset_ucs2_croatian_uca_ci); add_compiled_collation(&my_charset_ucs2_myanmar_uca_ci); + add_compiled_collation(&my_charset_ucs2_thai_520_w2); #endif #endif @@ -301,10 +306,10 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf8_croatian_mysql561_uca_ci); add_compiled_collation(&my_charset_utf8_sinhala_uca_ci); add_compiled_collation(&my_charset_utf8_unicode_520_ci); - add_compiled_collation(&my_charset_utf8_thai_520_w2); add_compiled_collation(&my_charset_utf8_vietnamese_ci); add_compiled_collation(&my_charset_utf8_croatian_uca_ci); add_compiled_collation(&my_charset_utf8_myanmar_uca_ci); + add_compiled_collation(&my_charset_utf8_thai_520_w2); #endif #endif /* HAVE_CHARSET_utf8 */ @@ -339,6 +344,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf8mb4_vietnamese_ci); add_compiled_collation(&my_charset_utf8mb4_croatian_uca_ci); add_compiled_collation(&my_charset_utf8mb4_myanmar_uca_ci); + add_compiled_collation(&my_charset_utf8mb4_thai_520_w2); #endif /* HAVE_UCA_COLLATIONS */ #endif /* HAVE_CHARSET_utf8mb4 */ @@ -375,6 +381,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf16_vietnamese_ci); add_compiled_collation(&my_charset_utf16_croatian_uca_ci); add_compiled_collation(&my_charset_utf16_myanmar_uca_ci); + add_compiled_collation(&my_charset_utf16_thai_520_w2); #endif /* HAVE_UCA_COLLATIONS */ #endif /* HAVE_CHARSET_utf16 */ @@ -409,6 +416,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf32_vietnamese_ci); add_compiled_collation(&my_charset_utf32_croatian_uca_ci); add_compiled_collation(&my_charset_utf32_myanmar_uca_ci); + add_compiled_collation(&my_charset_utf32_thai_520_w2); #endif /* HAVE_UCA_COLLATIONS */ #endif /* HAVE_CHARSET_utf32 */ diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index c49dff6f6a9..8a092e8f085 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -34167,6 +34167,23 @@ static size_t my_strnxfrmlen_any_uca_multilevel(CHARSET_INFO *cs, size_t len) return my_strnxfrmlen_any_uca(cs, len) * cs->levels_for_order; } + +MY_COLLATION_HANDLER my_collation_any_uca_handler_multilevel= +{ + my_coll_init_uca_multilevel, + my_strnncoll_any_uca_multilevel, + my_strnncollsp_any_uca_multilevel, + my_strnxfrm_any_uca_multilevel, + my_strnxfrmlen_any_uca_multilevel, + my_like_range_generic, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_any_uca, + my_propagate_complex +}; + + #ifdef HAVE_CHARSET_ucs2 /* UCS2 optimized CHARSET_INFO compatible wrappers. @@ -35000,6 +35017,38 @@ struct charset_info_st my_charset_ucs2_myanmar_uca_ci= }; +struct charset_info_st my_charset_ucs2_thai_520_w2= +{ + MY_PAGE2_COLLATION_ID_UCS2+2,0,0, /* number */ + MY_CS_UCS2_UCA_FLAGS,/* flags */ + "ucs2", /* csname */ + "ucs2_thai_520_w2", /* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + &my_uca_v520_th, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_unicode520,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 2, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_any_uca_handler_multilevel +}; + struct charset_info_st my_charset_ucs2_unicode_520_ci= { 150,0,0, /* number */ @@ -35085,21 +35134,6 @@ MY_COLLATION_HANDLER my_collation_any_uca_handler = my_propagate_complex }; -MY_COLLATION_HANDLER my_collation_any_uca_handler_multilevel= -{ - my_coll_init_uca_multilevel, /* init */ - my_strnncoll_any_uca_multilevel, - my_strnncollsp_any_uca_multilevel, - my_strnxfrm_any_uca_multilevel, - my_strnxfrmlen_any_uca_multilevel, - my_like_range_mb, - my_wildcmp_uca, - NULL, - my_instr_mb, - my_hash_sort_any_uca, - my_propagate_complex -}; - /* We consider bytes with code more than 127 as a letter. This garantees that word boundaries work fine with regular @@ -35941,7 +35975,7 @@ struct charset_info_st my_charset_utf8_thai_520_w2= MY_PAGE2_COLLATION_ID_UTF8+2,0,0, /* number */ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */ MY_UTF8MB3, /* csname */ - MY_UTF8MB3 "_thai_520_w2",/* name */ + MY_UTF8MB3 "_thai_520_w2",/* name */ "", /* comment */ "", /* tailoring */ ctype_utf8, /* ctype */ @@ -36782,6 +36816,37 @@ struct charset_info_st my_charset_utf8mb4_myanmar_uca_ci= &my_collation_any_uca_handler }; +struct charset_info_st my_charset_utf8mb4_thai_520_w2= +{ + MY_PAGE2_COLLATION_ID_UTF8MB4+2,0,0, /* number */ + MY_CS_UTF8MB4_UCA_FLAGS,/* flags */ + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_thai_520_w2", /* name */ + "", /* comment */ + "", /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + &my_uca_v520_th, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_unicode520,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 2, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler_multilevel +}; struct charset_info_st my_charset_utf8mb4_unicode_520_ci= { @@ -37645,6 +37710,39 @@ struct charset_info_st my_charset_utf32_myanmar_uca_ci= }; +struct charset_info_st my_charset_utf32_thai_520_w2= +{ + MY_PAGE2_COLLATION_ID_UTF32+2,0,0, /* number */ + MY_CS_UTF32_UCA_FLAGS,/* state */ + "utf32", /* csname */ + "utf32_thai_520_w2",/* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + &my_uca_v520_th, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_unicode520,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 2, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_any_uca_handler_multilevel +}; + + struct charset_info_st my_charset_utf32_unicode_520_ci= { 182,0,0, /* number */ @@ -38510,6 +38608,39 @@ struct charset_info_st my_charset_utf16_myanmar_uca_ci= }; +struct charset_info_st my_charset_utf16_thai_520_w2= +{ + MY_PAGE2_COLLATION_ID_UTF16+2,0,0, /* number */ + MY_CS_UTF16_UCA_FLAGS,/* state */ + "utf16", /* cs name */ + "utf16_thai_520_w2",/* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + &my_uca_v520_th, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_unicode520,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 2, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_any_uca_handler_multilevel +}; + + struct charset_info_st my_charset_utf16_unicode_520_ci= { 123,0,0, /* number */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index c0865157ad5..e4eb2832dff 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -5447,6 +5447,38 @@ static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), } +/* + TODO-10.2: join this with pad_max_char() in ctype-mb.c +*/ +static void +my_fill_utf8_mb(CHARSET_INFO *cs, char *str, size_t length, int fill) +{ + char *end= str + length; + char buf[10]; + char buflen= cs->cset->native_to_mb(cs, (my_wc_t) fill, (uchar*) buf, + (uchar*) buf + sizeof(buf)); + DBUG_ASSERT(buflen > 0); + for ( ; str + buflen <= end ; ) + { + memcpy(str, buf, buflen); + str+= buflen; + } + + for ( ; str < end; ) + *str++= ' '; +} + + +static void +my_fill_utf8(CHARSET_INFO *cs, char *str, size_t length, int fill) +{ + if (fill < 0x80) + my_fill_8bit(cs, str, length, fill); + else + my_fill_utf8_mb(cs, str, length, fill); +} + + static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler = { NULL, /* init */ @@ -5514,7 +5546,7 @@ MY_CHARSET_HANDLER my_charset_utf8_handler= my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, - my_fill_8bit, + my_fill_utf8, my_strntol_8bit, my_strntoul_8bit, my_strntoll_8bit, @@ -7869,7 +7901,7 @@ MY_CHARSET_HANDLER my_charset_utf8mb4_handler= my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, - my_fill_8bit, + my_fill_utf8, my_strntol_8bit, my_strntoul_8bit, my_strntoll_8bit,