~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/t/ctype_utf32_uca.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_ucs2.inc
 
2
-- source include/have_utf32.inc
 
3
 
 
4
--disable_warnings
 
5
DROP TABLE IF EXISTS t1;
 
6
--enable_warnings
 
7
 
 
8
set names utf8;
 
9
set collation_connection=utf32_unicode_ci;
 
10
select hex('a'), hex('a ');
 
11
-- source include/endspace.inc
 
12
 
 
13
#
 
14
# Bug #6787 LIKE not working properly with _ and utf8 data
 
15
#
 
16
select 'c' like '\_' as want0; 
 
17
 
 
18
#
 
19
# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
 
20
#
 
21
CREATE TABLE t (
 
22
  c char(20) NOT NULL
 
23
) ENGINE=MyISAM DEFAULT CHARACTER SET utf32 COLLATE=utf32_unicode_ci;
 
24
INSERT INTO t VALUES ('a'),('ab'),('aba');
 
25
ALTER TABLE t ADD INDEX (c);
 
26
SELECT c FROM t WHERE c LIKE 'a%';
 
27
DROP TABLE t;
 
28
 
 
29
 
 
30
create table t1 (c1 char(10) character set utf32 collate utf32_bin);
 
31
 
 
32
#
 
33
# Basic Latin
 
34
#
 
35
insert into t1 values ('A'),('a');
 
36
insert into t1 values ('B'),('b');
 
37
insert into t1 values ('C'),('c');
 
38
insert into t1 values ('D'),('d');
 
39
insert into t1 values ('E'),('e');
 
40
insert into t1 values ('F'),('f');
 
41
insert into t1 values ('G'),('g');
 
42
insert into t1 values ('H'),('h');
 
43
insert into t1 values ('I'),('i');
 
44
insert into t1 values ('J'),('j');
 
45
insert into t1 values ('K'),('k');
 
46
insert into t1 values ('L'),('l');
 
47
insert into t1 values ('M'),('m');
 
48
insert into t1 values ('N'),('n');
 
49
insert into t1 values ('O'),('o');
 
50
insert into t1 values ('P'),('p');
 
51
insert into t1 values ('Q'),('q');
 
52
insert into t1 values ('R'),('r');
 
53
insert into t1 values ('S'),('s');
 
54
insert into t1 values ('T'),('t');
 
55
insert into t1 values ('U'),('u');
 
56
insert into t1 values ('V'),('v');
 
57
insert into t1 values ('W'),('w');
 
58
insert into t1 values ('X'),('x');
 
59
insert into t1 values ('Y'),('y');
 
60
insert into t1 values ('Z'),('z');
 
61
 
 
62
#
 
63
# Latin1 suppliment
 
64
#
 
65
insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
 
66
insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
 
67
insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
 
68
insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
 
69
insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
 
70
insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
 
71
insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
 
72
insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
 
73
insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
 
74
insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
 
75
insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
 
76
insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
 
77
insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
 
78
insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
 
79
insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
 
80
insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
 
81
 
 
82
insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
 
83
insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
 
84
insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
 
85
insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
 
86
insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
 
87
insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
 
88
insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
 
89
insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
 
90
insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
 
91
insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
 
92
insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
 
93
insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
 
94
insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
 
95
insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
 
96
insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
 
97
insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
 
98
 
 
99
#
 
100
# Latin extended-A, 0100-017F
 
101
#
 
102
insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
 
103
insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
 
104
insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
 
105
insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
 
106
insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
 
107
insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
 
108
insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
 
109
insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
 
110
insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
 
111
insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
 
112
insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
 
113
insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
 
114
insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
 
115
insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
 
116
insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
 
117
insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
 
118
insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
 
119
insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
 
120
insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
 
121
insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
 
122
insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
 
123
insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
 
124
insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
 
125
insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
 
126
insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
 
127
insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
 
128
insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
 
129
insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
 
130
insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
 
131
insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
 
132
insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
 
133
insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
 
134
 
 
135
#
 
136
# Latin extended-B, 0180-024F
 
137
#
 
138
insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
 
139
insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
 
140
insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
 
141
insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
 
142
insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
 
143
insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
 
144
insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
 
145
insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
 
146
insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
 
147
insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
 
148
insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
 
149
insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
 
150
insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
 
151
insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
 
152
insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
 
153
insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
 
154
insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
 
155
insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
 
156
insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
 
157
insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
 
158
insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
 
159
insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
 
160
insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
 
161
insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
 
162
insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
 
163
insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
 
164
insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
 
165
insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
 
166
insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
 
167
insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
 
168
insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
 
169
insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
 
170
 
 
171
 
 
172
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
 
173
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
 
174
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
 
175
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
 
176
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
 
177
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
 
178
insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
 
179
insert into t1 values ('OE'),('Oe'),('oe'),('oE');
 
180
insert into t1 values ('SS'),('Ss'),('ss'),('sS');
 
181
insert into t1 values ('RR'),('Rr'),('rr'),('rR');
 
182
 
 
183
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_ci;
 
184
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_icelandic_ci;
 
185
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_latvian_ci;
 
186
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_romanian_ci;
 
187
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovenian_ci;
 
188
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_polish_ci;
 
189
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_estonian_ci;
 
190
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish_ci;
 
191
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_swedish_ci;
 
192
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_turkish_ci;
 
193
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_czech_ci;
 
194
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_danish_ci;
 
195
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_lithuanian_ci;
 
196
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovak_ci;
 
197
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish2_ci;
 
198
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_roman_ci;
 
199
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_esperanto_ci;
 
200
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_hungarian_ci;
 
201
 
 
202
drop table t1;
 
203
 
 
204
#
 
205
# Bug#5324
 
206
#
 
207
SET NAMES utf8;
 
208
#test1
 
209
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL, INDEX (c));
 
210
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
 
211
#Check one row
 
212
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_general_ci;
 
213
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
 
214
#Check two rows
 
215
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
 
216
COLLATE utf32_general_ci ORDER BY c;
 
217
DROP TABLE t1;
 
218
#test2
 
219
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
 
220
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
 
221
#Check one row
 
222
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_unicode_ci;
 
223
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
 
224
#Check two rows
 
225
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
 
226
COLLATE utf32_unicode_ci ORDER BY c;
 
227
DROP TABLE t1;
 
228
#test 3
 
229
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
 
230
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
 
231
#Check one row row
 
232
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32) COLLATE utf32_unicode_ci;
 
233
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
 
234
#Check two rows
 
235
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32)
 
236
COLLATE utf32_unicode_ci ORDER BY c;
 
237
DROP TABLE t1;
 
238
 
 
239
 
 
240
SET NAMES utf8;
 
241
SET @test_character_set='utf32';
 
242
SET @test_collation='utf32_swedish_ci';
 
243
-- source include/ctype_common.inc
 
244
 
 
245
 
 
246
SET collation_connection='utf32_unicode_ci';
 
247
-- source include/ctype_filesort.inc
 
248
-- source include/ctype_like_escape.inc
 
249
 
 
250
--echo End of 4.1 tests
 
251
 
 
252
#
 
253
# Check UPPER/LOWER changing length
 
254
#
 
255
# Result shorter than argument
 
256
CREATE TABLE t1 (id int, a varchar(30) character set utf32);
 
257
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
 
258
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
 
259
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
 
260
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
 
261
FROM t1 ORDER BY id;
 
262
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf32 collate utf32_turkish_ci;
 
263
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
 
264
FROM t1 ORDER BY id;
 
265
DROP TABLE t1;
 
266
 
 
267
#
 
268
# Bug #27079 Crash while grouping empty ucs2 strings
 
269
#
 
270
CREATE TABLE t1 (
 
271
 c1 text character set utf32 collate utf32_polish_ci NOT NULL
 
272
) ENGINE=MyISAM;
 
273
insert into t1 values (''),('a');
 
274
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
 
275
DROP TABLE IF EXISTS t1;
 
276
 
 
277
--echo End of 5.1 tests
 
278
 
 
279
set collation_connection=utf32_unicode_ci;
 
280
--source include/weight_string.inc
 
281
select hex(weight_string(_utf32 0x10000 collate utf32_unicode_ci));
 
282
select hex(weight_string(_utf32 0x10001 collate utf32_unicode_ci));
 
283
--source include/weight_string_l1.inc
 
284
 
 
285
set @@collation_connection=utf32_czech_ci;
 
286
--source include/weight_string_chde.inc
 
287
 
 
288
#
 
289
# Test basic regex functionality
 
290
#
 
291
set collation_connection=utf32_unicode_ci;
 
292
--source include/ctype_regex.inc
 
293
set names latin1;
 
294
 
 
295
--echo End of 5.2 tests