1
--source include/have_ujis.inc
4
DROP TABLE IF EXISTS t1;
5
DROP TABLE IF EXISTS t2;
6
DROP TABLE IF EXISTS t3;
7
DROP TABLE IF EXISTS t4;
11
# Test Prepares Statement with Japanese character in ujis encoding
15
SET character_set_database = ujis;
18
CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
19
CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
24
)DEFAULT CHARSET = ujis ENGINE = InnoDB;
25
CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
27
INSERT INTO t1 VALUES ('xxx');
28
INSERT INTO t2 VALUES ('�������');
29
INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
30
INSERT INTO t4 VALUES ('��'),('��'),('���');
32
# Japanese parameter for column name
33
# the parameter for stmt is not interpreted as column name
34
PREPARE stmt1 FROM 'SELECT ? FROM t3';
35
PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
36
PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
37
# Japanese parameter for function argument
38
PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
39
PREPARE stmt5 FROM 'SELECT CHARSET(?)';
40
PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
41
PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
42
PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
43
PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
44
PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
45
PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
46
PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
47
# Japanese parameter for UPDATE
48
PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
49
PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
53
EXECUTE stmt1 USING @arg;
54
EXECUTE stmt2 USING @arg;
55
EXECUTE stmt3 USING @arg;
56
EXECUTE stmt4 USING @arg;
57
EXECUTE stmt5 USING @arg;
58
EXECUTE stmt6 USING @arg;
59
EXECUTE stmt7 USING @arg;
60
EXECUTE stmt8 USING @arg;
61
EXECUTE stmt9 USING @arg;
62
EXECUTE stmt10 USING @arg;
63
EXECUTE stmt11 USING @arg;
64
EXECUTE stmt12 USING @arg;
65
EXECUTE stmt13 USING @arg;
67
EXECUTE stmt14 USING @arg;
72
EXECUTE stmt1 USING @arg;
73
EXECUTE stmt2 USING @arg;
74
EXECUTE stmt3 USING @arg;
75
EXECUTE stmt4 USING @arg;
76
EXECUTE stmt5 USING @arg;
77
EXECUTE stmt6 USING @arg;
78
EXECUTE stmt7 USING @arg;
79
EXECUTE stmt8 USING @arg;
80
EXECUTE stmt9 USING @arg;
81
EXECUTE stmt10 USING @arg;
82
EXECUTE stmt11 USING @arg;
83
EXECUTE stmt12 USING @arg;
84
EXECUTE stmt13 USING @arg;
86
EXECUTE stmt14 USING @arg;
91
EXECUTE stmt1 USING @arg;
92
EXECUTE stmt2 USING @arg;
93
EXECUTE stmt3 USING @arg;
94
EXECUTE stmt4 USING @arg;
95
EXECUTE stmt5 USING @arg;
96
EXECUTE stmt6 USING @arg;
97
EXECUTE stmt7 USING @arg;
98
EXECUTE stmt8 USING @arg;
99
EXECUTE stmt9 USING @arg;
100
EXECUTE stmt10 USING @arg;
101
EXECUTE stmt11 USING @arg;
102
EXECUTE stmt12 USING @arg;
103
EXECUTE stmt13 USING @arg;
105
EXECUTE stmt14 USING @arg;
108
DEALLOCATE PREPARE stmt1;
109
DEALLOCATE PREPARE stmt2;
110
DEALLOCATE PREPARE stmt3;
111
DEALLOCATE PREPARE stmt4;
112
DEALLOCATE PREPARE stmt5;
113
DEALLOCATE PREPARE stmt6;
114
DEALLOCATE PREPARE stmt7;
115
DEALLOCATE PREPARE stmt8;
116
DEALLOCATE PREPARE stmt9;
117
DEALLOCATE PREPARE stmt10;
118
DEALLOCATE PREPARE stmt11;
119
DEALLOCATE PREPARE stmt12;
120
DEALLOCATE PREPARE stmt13;
121
DEALLOCATE PREPARE stmt14;
129
CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
130
CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
135
)DEFAULT CHARSET = ujis ENGINE = MyISAM;
136
CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
138
INSERT INTO t1 VALUES ('xxx');
139
INSERT INTO t2 VALUES ('�������');
140
INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
141
INSERT INTO t4 VALUES ('��'),('��'),('���' );
143
# Japanese parameter for column name
144
PREPARE stmt1 FROM 'SELECT ? FROM t3';
145
PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
146
PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
147
# Japanese parameter for function argument
148
PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
149
PREPARE stmt5 FROM 'SELECT CHARSET(?)';
150
PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
151
PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
152
PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
153
PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
154
PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
155
PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
156
PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
157
# Japanese parameter for UPDATE
158
PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
159
PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
163
EXECUTE stmt1 USING @arg;
164
EXECUTE stmt2 USING @arg;
165
EXECUTE stmt3 USING @arg;
166
EXECUTE stmt4 USING @arg;
167
EXECUTE stmt5 USING @arg;
168
EXECUTE stmt6 USING @arg;
169
EXECUTE stmt7 USING @arg;
170
EXECUTE stmt8 USING @arg;
171
EXECUTE stmt9 USING @arg;
172
EXECUTE stmt10 USING @arg;
173
EXECUTE stmt11 USING @arg;
174
EXECUTE stmt12 USING @arg;
175
EXECUTE stmt13 USING @arg;
177
EXECUTE stmt14 USING @arg;
182
EXECUTE stmt1 USING @arg;
183
EXECUTE stmt2 USING @arg;
184
EXECUTE stmt3 USING @arg;
185
EXECUTE stmt4 USING @arg;
186
EXECUTE stmt5 USING @arg;
187
EXECUTE stmt6 USING @arg;
188
EXECUTE stmt7 USING @arg;
189
EXECUTE stmt8 USING @arg;
190
EXECUTE stmt9 USING @arg;
191
EXECUTE stmt10 USING @arg;
192
EXECUTE stmt11 USING @arg;
193
EXECUTE stmt12 USING @arg;
194
EXECUTE stmt13 USING @arg;
196
EXECUTE stmt14 USING @arg;
201
EXECUTE stmt1 USING @arg;
202
EXECUTE stmt2 USING @arg;
203
EXECUTE stmt3 USING @arg;
204
EXECUTE stmt4 USING @arg;
205
EXECUTE stmt5 USING @arg;
206
EXECUTE stmt6 USING @arg;
207
EXECUTE stmt7 USING @arg;
208
EXECUTE stmt8 USING @arg;
209
EXECUTE stmt9 USING @arg;
210
EXECUTE stmt10 USING @arg;
211
EXECUTE stmt11 USING @arg;
212
EXECUTE stmt12 USING @arg;
213
EXECUTE stmt13 USING @arg;
215
EXECUTE stmt14 USING @arg;
218
DEALLOCATE PREPARE stmt1;
219
DEALLOCATE PREPARE stmt2;
220
DEALLOCATE PREPARE stmt3;
221
DEALLOCATE PREPARE stmt4;
222
DEALLOCATE PREPARE stmt5;
223
DEALLOCATE PREPARE stmt6;
224
DEALLOCATE PREPARE stmt7;
225
DEALLOCATE PREPARE stmt8;
226
DEALLOCATE PREPARE stmt9;
227
DEALLOCATE PREPARE stmt10;
228
DEALLOCATE PREPARE stmt11;
229
DEALLOCATE PREPARE stmt12;
230
DEALLOCATE PREPARE stmt13;
231
DEALLOCATE PREPARE stmt14;
239
CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = HEAP;
240
CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = HEAP;
245
)DEFAULT CHARSET = ujis ENGINE = HEAP;
246
CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE =HEAP;
248
INSERT INTO t1 VALUES ('xxx');
249
INSERT INTO t2 VALUES ('�������');
250
INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
251
INSERT INTO t4 VALUES ('��'),('��'),('���' );
253
# Japanese parameter for column name
254
PREPARE stmt1 FROM 'SELECT ? FROM t3';
255
PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
256
PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
257
# Japanese parameter for function argument
258
PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
259
PREPARE stmt5 FROM 'SELECT CHARSET(?)';
260
PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
261
PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
262
PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
263
PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
264
PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
265
PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
266
PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
267
# Japanese parameter for UPDATE
268
PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
269
PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
273
EXECUTE stmt1 USING @arg;
274
EXECUTE stmt2 USING @arg;
275
EXECUTE stmt3 USING @arg;
276
EXECUTE stmt4 USING @arg;
277
EXECUTE stmt5 USING @arg;
278
EXECUTE stmt6 USING @arg;
279
EXECUTE stmt7 USING @arg;
280
EXECUTE stmt8 USING @arg;
281
EXECUTE stmt9 USING @arg;
282
EXECUTE stmt10 USING @arg;
283
EXECUTE stmt11 USING @arg;
284
EXECUTE stmt12 USING @arg;
285
EXECUTE stmt13 USING @arg;
287
EXECUTE stmt14 USING @arg;
292
EXECUTE stmt1 USING @arg;
293
EXECUTE stmt2 USING @arg;
294
EXECUTE stmt3 USING @arg;
295
EXECUTE stmt4 USING @arg;
296
EXECUTE stmt5 USING @arg;
297
EXECUTE stmt6 USING @arg;
298
EXECUTE stmt7 USING @arg;
299
EXECUTE stmt8 USING @arg;
300
EXECUTE stmt9 USING @arg;
301
EXECUTE stmt10 USING @arg;
302
EXECUTE stmt11 USING @arg;
303
EXECUTE stmt12 USING @arg;
304
EXECUTE stmt13 USING @arg;
306
EXECUTE stmt14 USING @arg;
311
EXECUTE stmt1 USING @arg;
312
EXECUTE stmt2 USING @arg;
313
EXECUTE stmt3 USING @arg;
314
EXECUTE stmt4 USING @arg;
315
EXECUTE stmt5 USING @arg;
316
EXECUTE stmt6 USING @arg;
317
EXECUTE stmt7 USING @arg;
318
EXECUTE stmt8 USING @arg;
319
EXECUTE stmt9 USING @arg;
320
EXECUTE stmt10 USING @arg;
321
EXECUTE stmt11 USING @arg;
322
EXECUTE stmt12 USING @arg;
323
EXECUTE stmt13 USING @arg;
325
EXECUTE stmt14 USING @arg;
328
DEALLOCATE PREPARE stmt1;
329
DEALLOCATE PREPARE stmt2;
330
DEALLOCATE PREPARE stmt3;
331
DEALLOCATE PREPARE stmt4;
332
DEALLOCATE PREPARE stmt5;
333
DEALLOCATE PREPARE stmt6;
334
DEALLOCATE PREPARE stmt7;
335
DEALLOCATE PREPARE stmt8;
336
DEALLOCATE PREPARE stmt9;
337
DEALLOCATE PREPARE stmt10;
338
DEALLOCATE PREPARE stmt11;
339
DEALLOCATE PREPARE stmt12;
340
DEALLOCATE PREPARE stmt13;
341
DEALLOCATE PREPARE stmt14;
349
CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = BDB;
350
CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = BDB;
355
)DEFAULT CHARSET = ujis ENGINE = BDB;
356
CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = BDB;
357
INSERT INTO t1 VALUES ('xxx');
358
INSERT INTO t2 VALUES ('�������');
359
INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
360
INSERT INTO t4 VALUES ('��'),('��'),('���' );
362
# Japanese parameter for column name
363
PREPARE stmt1 FROM 'SELECT ? FROM t3';
364
PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
365
PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
366
# Japanese parameter for function argument
367
PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
368
PREPARE stmt5 FROM 'SELECT CHARSET(?)';
369
PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
370
PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
371
PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
372
PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
373
PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
374
PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
375
PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
376
# Japanese parameter for UPDATE
377
PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
378
PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
382
EXECUTE stmt1 USING @arg;
383
EXECUTE stmt2 USING @arg;
384
EXECUTE stmt3 USING @arg;
385
EXECUTE stmt4 USING @arg;
386
EXECUTE stmt5 USING @arg;
387
EXECUTE stmt6 USING @arg;
388
EXECUTE stmt7 USING @arg;
389
EXECUTE stmt8 USING @arg;
390
EXECUTE stmt9 USING @arg;
391
EXECUTE stmt10 USING @arg;
392
EXECUTE stmt11 USING @arg;
393
EXECUTE stmt12 USING @arg;
394
EXECUTE stmt13 USING @arg;
396
EXECUTE stmt14 USING @arg;
401
EXECUTE stmt1 USING @arg;
402
EXECUTE stmt2 USING @arg;
403
EXECUTE stmt3 USING @arg;
404
EXECUTE stmt4 USING @arg;
405
EXECUTE stmt5 USING @arg;
406
EXECUTE stmt6 USING @arg;
407
EXECUTE stmt7 USING @arg;
408
EXECUTE stmt8 USING @arg;
409
EXECUTE stmt9 USING @arg;
410
EXECUTE stmt10 USING @arg;
411
EXECUTE stmt11 USING @arg;
412
EXECUTE stmt12 USING @arg;
413
EXECUTE stmt13 USING @arg;
415
EXECUTE stmt14 USING @arg;
420
EXECUTE stmt1 USING @arg;
421
EXECUTE stmt2 USING @arg;
422
EXECUTE stmt3 USING @arg;
423
EXECUTE stmt4 USING @arg;
424
EXECUTE stmt5 USING @arg;
425
EXECUTE stmt6 USING @arg;
426
EXECUTE stmt7 USING @arg;
427
EXECUTE stmt8 USING @arg;
428
EXECUTE stmt9 USING @arg;
429
EXECUTE stmt10 USING @arg;
430
EXECUTE stmt11 USING @arg;
431
EXECUTE stmt12 USING @arg;
432
EXECUTE stmt13 USING @arg;
434
EXECUTE stmt14 USING @arg;
437
DEALLOCATE PREPARE stmt1;
438
DEALLOCATE PREPARE stmt2;
439
DEALLOCATE PREPARE stmt3;
440
DEALLOCATE PREPARE stmt4;
441
DEALLOCATE PREPARE stmt5;
442
DEALLOCATE PREPARE stmt6;
443
DEALLOCATE PREPARE stmt7;
444
DEALLOCATE PREPARE stmt8;
445
DEALLOCATE PREPARE stmt9;
446
DEALLOCATE PREPARE stmt10;
447
DEALLOCATE PREPARE stmt11;
448
DEALLOCATE PREPARE stmt12;
449
DEALLOCATE PREPARE stmt13;
450
DEALLOCATE PREPARE stmt14;