1-- source include/have_ucs2.inc 2-- source include/have_utf16.inc 3 4--disable_warnings 5DROP TABLE IF EXISTS t1; 6--enable_warnings 7 8--echo # 9--echo # Start of 5.5 tests 10--echo # 11 12set names utf8; 13set collation_connection=utf16_unicode_ci; 14select hex('a'), hex('a '); 15-- source include/endspace.inc 16 17# 18# Bug #6787 LIKE not working properly with _ and utf8 data 19# 20select 'c' like '\_' as want0; 21 22# 23# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters 24# 25CREATE TABLE t ( 26 c char(20) NOT NULL 27) ENGINE=MyISAM DEFAULT CHARACTER SET utf16 COLLATE utf16_unicode_ci; 28INSERT INTO t VALUES ('a'),('ab'),('aba'); 29ALTER TABLE t ADD INDEX (c); 30SELECT c FROM t WHERE c LIKE 'a%'; 31DROP TABLE t; 32 33 34create table t1 (c1 char(10) character set utf16 collate utf16_bin); 35 36--source include/ctype_unicode_latin.inc 37 38select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_unicode_ci; 39select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_icelandic_ci; 40select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_latvian_ci; 41select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_romanian_ci; 42select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovenian_ci; 43select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_polish_ci; 44select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_estonian_ci; 45select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish_ci; 46select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_swedish_ci; 47select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_turkish_ci; 48select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_czech_ci; 49select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_danish_ci; 50select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_lithuanian_ci; 51select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovak_ci; 52select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish2_ci; 53select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_roman_ci; 54select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_esperanto_ci; 55select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_hungarian_ci; 56select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_croatian_mysql561_ci; 57select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_croatian_ci; 58select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_german2_ci; 59select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_unicode_520_ci; 60select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_vietnamese_ci; 61 62drop table t1; 63 64# 65# Bug#5324 66# 67SET NAMES utf8; 68 69CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL, INDEX (c)); 70INSERT INTO t1 VALUES (0x039C03C903B403B11F770308); 71#Check one row 72SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_general_ci; 73INSERT INTO t1 VALUES (0x039C03C903B4); 74#Check two rows 75SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 76COLLATE utf16_general_ci ORDER BY c; 77DROP TABLE t1; 78 79CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c)); 80INSERT INTO t1 VALUES (0x039C03C903B403B11F770308); 81#Check one row 82SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci; 83INSERT INTO t1 VALUES (0x039C03C903B4); 84#Check two rows 85SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 86COLLATE utf16_unicode_ci ORDER BY c; 87DROP TABLE t1; 88 89CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c)); 90INSERT INTO t1 VALUES (0x039C03C903B403B11F770308); 91#Check one row row 92SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci; 93INSERT INTO t1 VALUES (0x039C03C903B4); 94#Check two rows 95SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 96COLLATE utf16_unicode_ci ORDER BY c; 97DROP TABLE t1; 98 99 100SET NAMES utf8; 101SET @test_character_set='utf16'; 102SET @test_collation='utf16_swedish_ci'; 103-- source include/ctype_common.inc 104 105 106SET collation_connection='utf16_unicode_ci'; 107-- source include/ctype_filesort.inc 108-- source include/ctype_like_escape.inc 109-- source include/ctype_german.inc 110 111--echo End of 4.1 tests 112 113# 114# Check UPPER/LOWER changing length 115# 116# Result shorter than argument 117CREATE TABLE t1 (id int, a varchar(30) character set utf16); 118INSERT INTO t1 VALUES (1, 0x01310069), (2, 0x01310131); 119INSERT INTO t1 VALUES (3, 0x00690069), (4, 0x01300049); 120INSERT INTO t1 VALUES (5, 0x01300130), (6, 0x00490049); 121SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu 122FROM t1 ORDER BY id; 123ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf16 collate utf16_turkish_ci; 124SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu 125FROM t1 ORDER BY id; 126DROP TABLE t1; 127 128# 129# Bug #27079 Crash while grouping empty ucs2 strings 130# 131CREATE TABLE t1 ( 132 c1 text character set utf16 collate utf16_polish_ci NOT NULL 133) ENGINE=MyISAM; 134insert into t1 values (''),('a'); 135SELECT COUNT(*), c1 FROM t1 GROUP BY c1; 136DROP TABLE IF EXISTS t1; 137 138 139# 140# Test basic regex functionality 141# 142set collation_connection=utf16_unicode_ci; 143--source include/ctype_regex.inc 144 145# 146# Test like_range and contractions 147# 148SET collation_connection=utf16_czech_ci; 149--source include/ctype_czech.inc 150--source include/ctype_like_ignorable.inc 151 152 153--echo # 154--echo # End of 5.5 tests 155--echo # 156 157 158 159--echo # 160--echo # Start of 5.6 tests 161--echo # 162 163--echo # 164--echo # WL#3664 WEIGHT_STRING 165--echo # 166 167set collation_connection=utf16_unicode_ci; 168--source include/weight_string.inc 169--source include/weight_string_euro.inc 170select hex(weight_string(_utf16 0xD800DC00 collate utf16_unicode_ci)); 171select hex(weight_string(_utf16 0xD800DC01 collate utf16_unicode_ci)); 172--source include/weight_string_l1.inc 173 174set @@collation_connection=utf16_czech_ci; 175--source include/weight_string_chde.inc 176 177# 178# WL#4013 Unicode german2 collation 179# 180SET NAMES utf8; 181SET collation_connection=utf16_german2_ci; 182--source include/ctype_german.inc 183 184--echo # 185--echo # WL#2673 Unicode Collation Algorithm new version 186--echo # 187SET NAMES utf8mb4; 188SET collation_connection=utf16_unicode_520_ci; 189--source include/ctype_unicode520.inc 190 191--echo # 192--echo # End of 5.6 tests 193--echo # 194 195 196--echo # 197--echo # Start of MariaDB-10.0 tests 198--echo # 199--echo 200 201--echo # 202--echo # MDEV-4929 Myanmar collation 203--echo # 204SET NAMES utf8; 205SET collation_connection=utf16_myanmar_ci; 206--source include/ctype_myanmar.inc 207 208--echo # 209--echo # End of MariaDB-10.0 tests 210--echo # 211 212--echo # 213--echo # Start of 10.1 tests 214--echo # 215 216SET NAMES utf8; 217SET collation_connection=utf16_thai_520_w2; 218--source include/ctype_uca_w2.inc 219--source include/ctype_thai.inc 220 221--echo # 222--echo # End of 10.1 tests 223--echo # 224 225--echo # 226--echo # Start of 10.2 tests 227--echo # 228 229--echo # 230--echo # MDEV-10877 xxx_unicode_nopad_ci collations 231--echo # 232SET NAMES utf8, character_set_connection=utf16; 233let $coll='utf16_unicode_nopad_ci'; 234let $coll_pad='utf16_unicode_ci'; 235--source include/ctype_pad_all_engines.inc 236 237let $coll='utf16_unicode_520_nopad_ci'; 238let $coll_pad='utf16_unicode_520_ci'; 239--source include/ctype_pad_all_engines.inc 240 241SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci; 242--source include/ctype_like_range_mdev14350.inc 243SET NAMES utf8; 244 245 246--echo # 247--echo # MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed 248--echo # 10.2 tests 249--echo # 250 251SET NAMES utf8, COLLATION_CONNECTION=utf16_hungarian_ci; 252CREATE TABLE t1(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON); # ERROR 1064 (42000): You have an error in your SQL syntax 253SHOW CREATE TABLE t1; 254INSERT INTO t1 (c) VALUES (1); 255SELECT HEX(c) FROM t1; 256DROP TABLE t1; 257 258CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaa') CHARACTER SET 'Binary',d JSON); # ERROR 1033 (HY000): Incorrect information in file: './test/t.frm' 259SHOW CREATE TABLE t1; 260INSERT INTO t1 (c) VALUES (1); 261SELECT HEX(c) FROM t1; 262DROP TABLE t1; 263 264CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON); # Sig 11 265SHOW CREATE TABLE t1; 266INSERT INTO t1 (c) VALUES (1); 267SELECT HEX(c) FROM t1; 268DROP TABLE t1; 269 270 271--echo # 272--echo # End of 10.2 tests 273--echo # 274