~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/r/ps_5merge.result

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use test;
 
2
drop table if exists t1, t1_1, t1_2,
 
3
t9, t9_1, t9_2;
 
4
drop table if exists t1, t9 ;
 
5
create table t1
 
6
(
 
7
a int, b varchar(30),
 
8
primary key(a)
 
9
) engine = 'MYISAM'  ;
 
10
create table t9 
 
11
(
 
12
c1  tinyint, c2  smallint, c3  mediumint, c4  int,
 
13
c5  integer, c6  bigint, c7  float, c8  double,
 
14
c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
 
15
c13 date, c14 datetime, c15 timestamp, c16 time,
 
16
c17 year, c18 tinyint, c19 bool, c20 char,
 
17
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
 
18
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
 
19
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
 
20
c32 set('monday', 'tuesday', 'wednesday'),
 
21
primary key(c1)
 
22
) engine = 'MYISAM'  ;
 
23
rename table t1 to t1_1, t9 to t9_1 ;
 
24
drop table if exists t1, t9 ;
 
25
create table t1
 
26
(
 
27
a int, b varchar(30),
 
28
primary key(a)
 
29
) engine = 'MYISAM'  ;
 
30
create table t9 
 
31
(
 
32
c1  tinyint, c2  smallint, c3  mediumint, c4  int,
 
33
c5  integer, c6  bigint, c7  float, c8  double,
 
34
c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
 
35
c13 date, c14 datetime, c15 timestamp, c16 time,
 
36
c17 year, c18 tinyint, c19 bool, c20 char,
 
37
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
 
38
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
 
39
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
 
40
c32 set('monday', 'tuesday', 'wednesday'),
 
41
primary key(c1)
 
42
) engine = 'MYISAM'  ;
 
43
rename table t1 to t1_2, t9 to t9_2 ;
 
44
create table t1
 
45
(
 
46
a int, b varchar(30),
 
47
primary key(a)
 
48
) ENGINE = MERGE UNION=(t1_1,t1_2)
 
49
INSERT_METHOD=FIRST;
 
50
create table t9
 
51
(
 
52
c1  tinyint, c2  smallint, c3  mediumint, c4  int,
 
53
c5  integer, c6  bigint, c7  float, c8  double,
 
54
c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
 
55
c13 date, c14 datetime, c15 timestamp, c16 time,
 
56
c17 year, c18 tinyint, c19 bool, c20 char,
 
57
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
 
58
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
 
59
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
 
60
c32 set('monday', 'tuesday', 'wednesday'),
 
61
primary key(c1)
 
62
)  ENGINE = MERGE UNION=(t9_1,t9_2)
 
63
INSERT_METHOD=FIRST;
 
64
delete from t1 ;
 
65
insert into t1 values (1,'one');
 
66
insert into t1 values (2,'two');
 
67
insert into t1 values (3,'three');
 
68
insert into t1 values (4,'four');
 
69
commit ;
 
70
delete from t9 ;
 
71
insert into t9
 
72
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
73
c10= 1, c11= 1, c12 = 1,
 
74
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
75
c16= '11:11:11', c17= '2004',
 
76
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
77
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
78
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
79
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
80
insert into t9
 
81
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
82
c10= 9, c11= 9, c12 = 9,
 
83
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
84
c16= '11:11:11', c17= '2004',
 
85
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
86
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
87
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
88
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
89
commit ;
 
90
test_sequence
 
91
------ simple select tests ------
 
92
prepare stmt1 from ' select * from t9 order by c1 ' ;
 
93
execute stmt1;
 
94
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
95
def     test    t9      t9      c1      c1      1       4       1       N       49155   0       63
 
96
def     test    t9      t9      c2      c2      2       6       1       Y       32768   0       63
 
97
def     test    t9      t9      c3      c3      9       9       1       Y       32768   0       63
 
98
def     test    t9      t9      c4      c4      3       11      1       Y       32768   0       63
 
99
def     test    t9      t9      c5      c5      3       11      1       Y       32768   0       63
 
100
def     test    t9      t9      c6      c6      8       20      1       Y       32768   0       63
 
101
def     test    t9      t9      c7      c7      4       12      1       Y       32768   31      63
 
102
def     test    t9      t9      c8      c8      5       22      1       Y       32768   31      63
 
103
def     test    t9      t9      c9      c9      5       22      1       Y       32768   31      63
 
104
def     test    t9      t9      c10     c10     5       22      1       Y       32768   31      63
 
105
def     test    t9      t9      c11     c11     246     9       6       Y       0       4       63
 
106
def     test    t9      t9      c12     c12     246     10      6       Y       0       4       63
 
107
def     test    t9      t9      c13     c13     10      10      10      Y       128     0       63
 
108
def     test    t9      t9      c14     c14     12      19      19      Y       128     0       63
 
109
def     test    t9      t9      c15     c15     7       19      19      N       9441    0       63
 
110
def     test    t9      t9      c16     c16     11      8       8       Y       128     0       63
 
111
def     test    t9      t9      c17     c17     13      4       4       Y       32864   0       63
 
112
def     test    t9      t9      c18     c18     1       4       1       Y       32768   0       63
 
113
def     test    t9      t9      c19     c19     1       1       1       Y       32768   0       63
 
114
def     test    t9      t9      c20     c20     254     1       1       Y       0       0       8
 
115
def     test    t9      t9      c21     c21     254     10      10      Y       0       0       8
 
116
def     test    t9      t9      c22     c22     253     30      30      Y       0       0       8
 
117
def     test    t9      t9      c23     c23     252     255     8       Y       144     0       63
 
118
def     test    t9      t9      c24     c24     252     255     8       Y       16      0       8
 
119
def     test    t9      t9      c25     c25     252     65535   4       Y       144     0       63
 
120
def     test    t9      t9      c26     c26     252     65535   4       Y       16      0       8
 
121
def     test    t9      t9      c27     c27     252     16777215        10      Y       144     0       63
 
122
def     test    t9      t9      c28     c28     252     16777215        10      Y       16      0       8
 
123
def     test    t9      t9      c29     c29     252     4294967295      8       Y       144     0       63
 
124
def     test    t9      t9      c30     c30     252     4294967295      8       Y       16      0       8
 
125
def     test    t9      t9      c31     c31     254     5       3       Y       256     0       8
 
126
def     test    t9      t9      c32     c32     254     24      7       Y       2048    0       8
 
127
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c11     c12     c13     c14     c15     c16     c17     c18     c19     c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30     c31     c32
 
128
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
129
9       9       9       9       9       9       9       9       9       9       9.0000  9.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       0       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        two     tuesday
 
130
set @arg00='SELECT' ;
 
131
@arg00 a from t1 where a=1;
 
132
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
 
133
prepare stmt1 from ' ? a from t1 where a=1 ';
 
134
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
 
135
set @arg00=1 ;
 
136
select @arg00, b from t1 where a=1 ;
 
137
@arg00  b
 
138
1       one
 
139
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
140
execute stmt1 using @arg00 ;
 
141
?       b
 
142
1       one
 
143
set @arg00='lion' ;
 
144
select @arg00, b from t1 where a=1 ;
 
145
@arg00  b
 
146
lion    one
 
147
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
148
execute stmt1 using @arg00 ;
 
149
?       b
 
150
lion    one
 
151
set @arg00=NULL ;
 
152
select @arg00, b from t1 where a=1 ;
 
153
@arg00  b
 
154
NULL    one
 
155
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
156
execute stmt1 using @arg00 ;
 
157
?       b
 
158
NULL    one
 
159
set @arg00=1 ;
 
160
select b, a - @arg00 from t1 where a=1 ;
 
161
b       a - @arg00
 
162
one     0
 
163
prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
 
164
execute stmt1 using @arg00 ;
 
165
b       a - ?
 
166
one     0
 
167
set @arg00=null ;
 
168
select @arg00 as my_col ;
 
169
my_col
 
170
NULL
 
171
prepare stmt1 from ' select ? as my_col';
 
172
execute stmt1 using @arg00 ;
 
173
my_col
 
174
NULL
 
175
select @arg00 + 1 as my_col ;
 
176
my_col
 
177
NULL
 
178
prepare stmt1 from ' select ? + 1 as my_col';
 
179
execute stmt1 using @arg00 ;
 
180
my_col
 
181
NULL
 
182
select 1 + @arg00 as my_col ;
 
183
my_col
 
184
NULL
 
185
prepare stmt1 from ' select 1 + ? as my_col';
 
186
execute stmt1 using @arg00 ;
 
187
my_col
 
188
NULL
 
189
set @arg00='MySQL' ;
 
190
select substr(@arg00,1,2) from t1 where a=1 ;
 
191
substr(@arg00,1,2)
 
192
My
 
193
prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
 
194
execute stmt1 using @arg00 ;
 
195
substr(?,1,2)
 
196
My
 
197
set @arg00=3 ;
 
198
select substr('MySQL',@arg00,5) from t1 where a=1 ;
 
199
substr('MySQL',@arg00,5)
 
200
SQL
 
201
prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
 
202
execute stmt1 using @arg00 ;
 
203
substr('MySQL',?,5)
 
204
SQL
 
205
select substr('MySQL',1,@arg00) from t1 where a=1 ;
 
206
substr('MySQL',1,@arg00)
 
207
MyS
 
208
prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
 
209
execute stmt1 using @arg00 ;
 
210
substr('MySQL',1,?)
 
211
MyS
 
212
set @arg00='MySQL' ;
 
213
select a , concat(@arg00,b) from t1 order by a;
 
214
a       concat(@arg00,b)
 
215
1       MySQLone
 
216
2       MySQLtwo
 
217
3       MySQLthree
 
218
4       MySQLfour
 
219
prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
 
220
execute stmt1 using @arg00;
 
221
a       concat(?,b)
 
222
1       MySQLone
 
223
2       MySQLtwo
 
224
3       MySQLthree
 
225
4       MySQLfour
 
226
select a , concat(b,@arg00) from t1 order by a ;
 
227
a       concat(b,@arg00)
 
228
1       oneMySQL
 
229
2       twoMySQL
 
230
3       threeMySQL
 
231
4       fourMySQL
 
232
prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
 
233
execute stmt1 using @arg00;
 
234
a       concat(b,?)
 
235
1       oneMySQL
 
236
2       twoMySQL
 
237
3       threeMySQL
 
238
4       fourMySQL
 
239
set @arg00='MySQL' ;
 
240
select group_concat(@arg00,b order by a) from t1 
 
241
group by 'a' ;
 
242
group_concat(@arg00,b order by a)
 
243
MySQLone,MySQLtwo,MySQLthree,MySQLfour
 
244
prepare stmt1 from ' select group_concat(?,b order by a) from t1
 
245
group by ''a'' ' ;
 
246
execute stmt1 using @arg00;
 
247
group_concat(?,b order by a)
 
248
MySQLone,MySQLtwo,MySQLthree,MySQLfour
 
249
select group_concat(b,@arg00 order by a) from t1 
 
250
group by 'a' ;
 
251
group_concat(b,@arg00 order by a)
 
252
oneMySQL,twoMySQL,threeMySQL,fourMySQL
 
253
prepare stmt1 from ' select group_concat(b,? order by a) from t1
 
254
group by ''a'' ' ;
 
255
execute stmt1 using @arg00;
 
256
group_concat(b,? order by a)
 
257
oneMySQL,twoMySQL,threeMySQL,fourMySQL
 
258
set @arg00='first' ;
 
259
set @arg01='second' ;
 
260
set @arg02=NULL;
 
261
select @arg00, @arg01 from t1 where a=1 ;
 
262
@arg00  @arg01
 
263
first   second
 
264
prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
 
265
execute stmt1 using @arg00, @arg01 ;
 
266
?       ?
 
267
first   second
 
268
execute stmt1 using @arg02, @arg01 ;
 
269
?       ?
 
270
NULL    second
 
271
execute stmt1 using @arg00, @arg02 ;
 
272
?       ?
 
273
first   NULL
 
274
execute stmt1 using @arg02, @arg02 ;
 
275
?       ?
 
276
NULL    NULL
 
277
drop table if exists t5 ;
 
278
create table t5 (id1 int(11) not null default '0',
 
279
value2 varchar(100), value1 varchar(100)) ;
 
280
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
 
281
(1,'ii','ii'),(2,'ii','ii') ;
 
282
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
 
283
set @arg00=1 ;
 
284
set @arg01='hh' ;
 
285
execute stmt1 using @arg00, @arg01 ;
 
286
id1     value1
 
287
1       hh
 
288
1       ii
 
289
2       hh
 
290
drop table t5 ;
 
291
drop table if exists t5 ;
 
292
create table t5(session_id  char(9) not null) ;
 
293
insert into t5 values ('abc') ;
 
294
prepare stmt1 from ' select * from t5
 
295
where ?=''1111'' and session_id = ''abc'' ' ;
 
296
set @arg00='abc' ;
 
297
execute stmt1 using @arg00 ;
 
298
session_id
 
299
set @arg00='1111' ;
 
300
execute stmt1 using @arg00 ;
 
301
session_id
 
302
abc
 
303
set @arg00='abc' ;
 
304
execute stmt1 using @arg00 ;
 
305
session_id
 
306
drop table t5 ;
 
307
set @arg00='FROM' ;
 
308
select a @arg00 t1 where a=1 ;
 
309
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
 
310
prepare stmt1 from ' select a ? t1 where a=1 ' ;
 
311
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
 
312
set @arg00='t1' ;
 
313
select a from @arg00 where a=1 ;
 
314
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
 
315
prepare stmt1 from ' select a from ? where a=1 ' ;
 
316
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
 
317
set @arg00='WHERE' ;
 
318
select a from t1 @arg00 a=1 ;
 
319
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
 
320
prepare stmt1 from ' select a from t1 ? a=1 ' ;
 
321
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
 
322
set @arg00=1 ;
 
323
select a FROM t1 where a=@arg00 ;
 
324
a
 
325
1
 
326
prepare stmt1 from ' select a FROM t1 where a=? ' ;
 
327
execute stmt1 using @arg00 ;
 
328
a
 
329
1
 
330
set @arg00=1000 ;
 
331
execute stmt1 using @arg00 ;
 
332
a
 
333
set @arg00=NULL ;
 
334
select a FROM t1 where a=@arg00 ;
 
335
a
 
336
prepare stmt1 from ' select a FROM t1 where a=? ' ;
 
337
execute stmt1 using @arg00 ;
 
338
a
 
339
set @arg00=4 ;
 
340
select a FROM t1 where a=sqrt(@arg00) ;
 
341
a
 
342
2
 
343
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
 
344
execute stmt1 using @arg00 ;
 
345
a
 
346
2
 
347
set @arg00=NULL ;
 
348
select a FROM t1 where a=sqrt(@arg00) ;
 
349
a
 
350
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
 
351
execute stmt1 using @arg00 ;
 
352
a
 
353
set @arg00=2 ;
 
354
set @arg01=3 ;
 
355
select a FROM t1 where a in (@arg00,@arg01) order by a;
 
356
a
 
357
2
 
358
3
 
359
prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
 
360
execute stmt1 using @arg00, @arg01;
 
361
a
 
362
2
 
363
3
 
364
set @arg00= 'one' ;
 
365
set @arg01= 'two' ;
 
366
set @arg02= 'five' ;
 
367
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
 
368
execute stmt1 using @arg00, @arg01, @arg02 ;
 
369
b
 
370
one
 
371
two
 
372
prepare stmt1 from ' select b FROM t1 where b like ? ';
 
373
set @arg00='two' ;
 
374
execute stmt1 using @arg00 ;
 
375
b
 
376
two
 
377
set @arg00='tw%' ;
 
378
execute stmt1 using @arg00 ;
 
379
b
 
380
two
 
381
set @arg00='%wo' ;
 
382
execute stmt1 using @arg00 ;
 
383
b
 
384
two
 
385
set @arg00=null ;
 
386
insert into t9 set c1= 0, c5 = NULL ;
 
387
select c5 from t9 where c5 > NULL ;
 
388
c5
 
389
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
 
390
execute stmt1 using @arg00 ;
 
391
c5
 
392
select c5 from t9 where c5 < NULL ;
 
393
c5
 
394
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
 
395
execute stmt1 using @arg00 ;
 
396
c5
 
397
select c5 from t9 where c5 = NULL ;
 
398
c5
 
399
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
 
400
execute stmt1 using @arg00 ;
 
401
c5
 
402
select c5 from t9 where c5 <=> NULL ;
 
403
c5
 
404
NULL
 
405
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
 
406
execute stmt1 using @arg00 ;
 
407
c5
 
408
NULL
 
409
delete from t9 where c1= 0 ;
 
410
set @arg00='>' ;
 
411
select a FROM t1 where a @arg00 1 ;
 
412
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
 
413
prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
 
414
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
 
415
set @arg00=1 ;
 
416
select a,b FROM t1 where a is not NULL
 
417
AND b is not NULL group by a - @arg00 ;
 
418
a       b
 
419
1       one
 
420
2       two
 
421
3       three
 
422
4       four
 
423
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
424
AND b is not NULL group by a - ? ' ;
 
425
execute stmt1 using @arg00 ;
 
426
a       b
 
427
1       one
 
428
2       two
 
429
3       three
 
430
4       four
 
431
set @arg00='two' ;
 
432
select a,b FROM t1 where a is not NULL
 
433
AND b is not NULL having b <> @arg00 order by a ;
 
434
a       b
 
435
1       one
 
436
3       three
 
437
4       four
 
438
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
439
AND b is not NULL having b <> ? order by a ' ;
 
440
execute stmt1 using @arg00 ;
 
441
a       b
 
442
1       one
 
443
3       three
 
444
4       four
 
445
set @arg00=1 ;
 
446
select a,b FROM t1 where a is not NULL
 
447
AND b is not NULL order by a - @arg00 ;
 
448
a       b
 
449
1       one
 
450
2       two
 
451
3       three
 
452
4       four
 
453
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
454
AND b is not NULL order by a - ? ' ;
 
455
execute stmt1 using @arg00 ;
 
456
a       b
 
457
1       one
 
458
2       two
 
459
3       three
 
460
4       four
 
461
set @arg00=2 ;
 
462
select a,b from t1 order by 2 ;
 
463
a       b
 
464
4       four
 
465
1       one
 
466
3       three
 
467
2       two
 
468
prepare stmt1 from ' select a,b from t1
 
469
order by ? ';
 
470
execute stmt1 using @arg00;
 
471
a       b
 
472
4       four
 
473
1       one
 
474
3       three
 
475
2       two
 
476
set @arg00=1 ;
 
477
execute stmt1 using @arg00;
 
478
a       b
 
479
1       one
 
480
2       two
 
481
3       three
 
482
4       four
 
483
set @arg00=0 ;
 
484
execute stmt1 using @arg00;
 
485
ERROR 42S22: Unknown column '?' in 'order clause'
 
486
set @arg00=1;
 
487
prepare stmt1 from ' select a,b from t1 order by a
 
488
limit 1 ';
 
489
execute stmt1 ;
 
490
a       b
 
491
1       one
 
492
prepare stmt1 from ' select a,b from t1 order by a limit ? ';
 
493
execute stmt1 using @arg00;
 
494
a       b
 
495
1       one
 
496
set @arg00='b' ;
 
497
set @arg01=0 ;
 
498
set @arg02=2 ;
 
499
set @arg03=2 ;
 
500
select sum(a), @arg00 from t1 where a > @arg01
 
501
and b is not null group by substr(b,@arg02)
 
502
having sum(a) <> @arg03 ;
 
503
sum(a)  @arg00
 
504
3       b
 
505
1       b
 
506
4       b
 
507
prepare stmt1 from ' select sum(a), ? from t1 where a > ?
 
508
and b is not null group by substr(b,?)
 
509
having sum(a) <> ? ';
 
510
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
 
511
sum(a)  ?
 
512
3       b
 
513
1       b
 
514
4       b
 
515
test_sequence
 
516
------ join tests ------
 
517
select first.a as a1, second.a as a2 
 
518
from t1 first, t1 second
 
519
where first.a = second.a order by a1 ;
 
520
a1      a2
 
521
1       1
 
522
2       2
 
523
3       3
 
524
4       4
 
525
prepare stmt1 from ' select first.a as a1, second.a as a2 
 
526
        from t1 first, t1 second
 
527
        where first.a = second.a order by a1 ';
 
528
execute stmt1 ;
 
529
a1      a2
 
530
1       1
 
531
2       2
 
532
3       3
 
533
4       4
 
534
set @arg00='ABC';
 
535
set @arg01='two';
 
536
set @arg02='one';
 
537
select first.a, @arg00, second.a FROM t1 first, t1 second
 
538
where @arg01 = first.b or first.a = second.a or second.b = @arg02
 
539
order by second.a, first.a;
 
540
a       @arg00  a
 
541
1       ABC     1
 
542
2       ABC     1
 
543
3       ABC     1
 
544
4       ABC     1
 
545
2       ABC     2
 
546
2       ABC     3
 
547
3       ABC     3
 
548
2       ABC     4
 
549
4       ABC     4
 
550
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
 
551
                    where ? = first.b or first.a = second.a or second.b = ?
 
552
                    order by second.a, first.a';
 
553
execute stmt1 using @arg00, @arg01, @arg02;
 
554
a       ?       a
 
555
1       ABC     1
 
556
2       ABC     1
 
557
3       ABC     1
 
558
4       ABC     1
 
559
2       ABC     2
 
560
2       ABC     3
 
561
3       ABC     3
 
562
2       ABC     4
 
563
4       ABC     4
 
564
drop table if exists t2 ;
 
565
create table t2 as select * from t1 ;
 
566
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
 
567
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
 
568
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
 
569
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
 
570
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
 
571
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
 
572
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
 
573
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
 
574
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
 
575
the join statement is:
 
576
SELECT * FROM t2 right join t1 using(a) order by t2.a 
 
577
prepare stmt1 from @query9  ;
 
578
execute stmt1 ;
 
579
a       b       b
 
580
1       one     one
 
581
2       two     two
 
582
3       three   three
 
583
4       four    four
 
584
execute stmt1 ;
 
585
a       b       b
 
586
1       one     one
 
587
2       two     two
 
588
3       three   three
 
589
4       four    four
 
590
execute stmt1 ;
 
591
a       b       b
 
592
1       one     one
 
593
2       two     two
 
594
3       three   three
 
595
4       four    four
 
596
the join statement is:
 
597
SELECT * FROM t2 natural right join t1 order by t2.a 
 
598
prepare stmt1 from @query8 ;
 
599
execute stmt1 ;
 
600
a       b
 
601
1       one
 
602
2       two
 
603
3       three
 
604
4       four
 
605
execute stmt1 ;
 
606
a       b
 
607
1       one
 
608
2       two
 
609
3       three
 
610
4       four
 
611
execute stmt1 ;
 
612
a       b
 
613
1       one
 
614
2       two
 
615
3       three
 
616
4       four
 
617
the join statement is:
 
618
SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a 
 
619
prepare stmt1 from @query7 ;
 
620
execute stmt1 ;
 
621
a       b       a       b
 
622
1       one     1       one
 
623
2       two     2       two
 
624
3       three   3       three
 
625
4       four    4       four
 
626
execute stmt1 ;
 
627
a       b       a       b
 
628
1       one     1       one
 
629
2       two     2       two
 
630
3       three   3       three
 
631
4       four    4       four
 
632
execute stmt1 ;
 
633
a       b       a       b
 
634
1       one     1       one
 
635
2       two     2       two
 
636
3       three   3       three
 
637
4       four    4       four
 
638
the join statement is:
 
639
SELECT * FROM t2 left join t1 using(a) order by t2.a 
 
640
prepare stmt1 from @query6 ;
 
641
execute stmt1 ;
 
642
a       b       b
 
643
1       one     one
 
644
2       two     two
 
645
3       three   three
 
646
4       four    four
 
647
execute stmt1 ;
 
648
a       b       b
 
649
1       one     one
 
650
2       two     two
 
651
3       three   three
 
652
4       four    four
 
653
execute stmt1 ;
 
654
a       b       b
 
655
1       one     one
 
656
2       two     two
 
657
3       three   three
 
658
4       four    four
 
659
the join statement is:
 
660
SELECT * FROM t2 natural left join t1 order by t2.a 
 
661
prepare stmt1 from @query5 ;
 
662
execute stmt1 ;
 
663
a       b
 
664
1       one
 
665
2       two
 
666
3       three
 
667
4       four
 
668
execute stmt1 ;
 
669
a       b
 
670
1       one
 
671
2       two
 
672
3       three
 
673
4       four
 
674
execute stmt1 ;
 
675
a       b
 
676
1       one
 
677
2       two
 
678
3       three
 
679
4       four
 
680
the join statement is:
 
681
SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a 
 
682
prepare stmt1 from @query4 ;
 
683
execute stmt1 ;
 
684
a       b       a       b
 
685
1       one     1       one
 
686
2       two     2       two
 
687
3       three   3       three
 
688
4       four    4       four
 
689
execute stmt1 ;
 
690
a       b       a       b
 
691
1       one     1       one
 
692
2       two     2       two
 
693
3       three   3       three
 
694
4       four    4       four
 
695
execute stmt1 ;
 
696
a       b       a       b
 
697
1       one     1       one
 
698
2       two     2       two
 
699
3       three   3       three
 
700
4       four    4       four
 
701
the join statement is:
 
702
SELECT * FROM t2 join t1 using(a) order by t2.a 
 
703
prepare stmt1 from @query3 ;
 
704
execute stmt1 ;
 
705
a       b       b
 
706
1       one     one
 
707
2       two     two
 
708
3       three   three
 
709
4       four    four
 
710
execute stmt1 ;
 
711
a       b       b
 
712
1       one     one
 
713
2       two     two
 
714
3       three   three
 
715
4       four    four
 
716
execute stmt1 ;
 
717
a       b       b
 
718
1       one     one
 
719
2       two     two
 
720
3       three   three
 
721
4       four    four
 
722
the join statement is:
 
723
SELECT * FROM t2 natural join t1 order by t2.a 
 
724
prepare stmt1 from @query2 ;
 
725
execute stmt1 ;
 
726
a       b
 
727
1       one
 
728
2       two
 
729
3       three
 
730
4       four
 
731
execute stmt1 ;
 
732
a       b
 
733
1       one
 
734
2       two
 
735
3       three
 
736
4       four
 
737
execute stmt1 ;
 
738
a       b
 
739
1       one
 
740
2       two
 
741
3       three
 
742
4       four
 
743
the join statement is:
 
744
SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a 
 
745
prepare stmt1 from @query1 ;
 
746
execute stmt1 ;
 
747
a       b       a       b
 
748
1       one     1       one
 
749
2       two     2       two
 
750
3       three   3       three
 
751
4       four    4       four
 
752
execute stmt1 ;
 
753
a       b       a       b
 
754
1       one     1       one
 
755
2       two     2       two
 
756
3       three   3       three
 
757
4       four    4       four
 
758
execute stmt1 ;
 
759
a       b       a       b
 
760
1       one     1       one
 
761
2       two     2       two
 
762
3       three   3       three
 
763
4       four    4       four
 
764
drop table t2 ;
 
765
test_sequence
 
766
------ subquery tests ------
 
767
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
768
   a = (select a from t1 where b = ''two'') ';
 
769
execute stmt1 ;
 
770
a       b
 
771
2       two
 
772
set @arg00='two' ;
 
773
select a, b FROM t1 outer_table where
 
774
a = (select a from t1 where b = 'two' ) and b=@arg00 ;
 
775
a       b
 
776
2       two
 
777
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
778
   a = (select a from t1 where b = ''two'') and b=? ';
 
779
execute stmt1 using @arg00;
 
780
a       b
 
781
2       two
 
782
set @arg00='two' ;
 
783
select a, b FROM t1 outer_table where
 
784
a = (select a from t1 where b = @arg00 ) and b='two' ;
 
785
a       b
 
786
2       two
 
787
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
788
   a = (select a from t1 where b = ? ) and b=''two'' ' ;
 
789
execute stmt1 using @arg00;
 
790
a       b
 
791
2       two
 
792
set @arg00=3 ;
 
793
set @arg01='three' ;
 
794
select a,b FROM t1 where (a,b) in (select 3, 'three');
 
795
a       b
 
796
3       three
 
797
select a FROM t1 where (a,b) in (select @arg00,@arg01);
 
798
a
 
799
3
 
800
prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
 
801
execute stmt1 using @arg00, @arg01;
 
802
a
 
803
3
 
804
set @arg00=1 ;
 
805
set @arg01='two' ;
 
806
set @arg02=2 ;
 
807
set @arg03='two' ;
 
808
select a, @arg00, b FROM t1 outer_table where
 
809
b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
 
810
a       @arg00  b
 
811
2       1       two
 
812
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
 
813
   b=? and a = (select ? from t1 where b = ? ) ' ;
 
814
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
815
a       ?       b
 
816
2       1       two
 
817
prepare stmt1 from 'select c4 FROM t9 where
 
818
    c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
 
819
execute stmt1 using @arg01, @arg02;
 
820
c4
 
821
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
822
   a = (select a from t1 where b = outer_table.b ) order by a ';
 
823
execute stmt1 ;
 
824
a       b
 
825
1       one
 
826
2       two
 
827
3       three
 
828
4       four
 
829
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
830
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
831
execute stmt1 ;
 
832
ccc
 
833
1
 
834
deallocate prepare stmt1 ;
 
835
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
836
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
837
execute stmt1 ;
 
838
ccc
 
839
1
 
840
deallocate prepare stmt1 ;
 
841
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
842
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
843
execute stmt1 ;
 
844
ccc
 
845
1
 
846
deallocate prepare stmt1 ;
 
847
set @arg00='two' ;
 
848
select a, b FROM t1 outer_table where
 
849
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
 
850
a       b
 
851
2       two
 
852
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
853
   a = (select a from t1 where b = outer_table.b) and b=? ';
 
854
execute stmt1 using @arg00;
 
855
a       b
 
856
2       two
 
857
set @arg00=2 ;
 
858
select a, b FROM t1 outer_table where
 
859
a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
 
860
a       b
 
861
2       two
 
862
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
863
   a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
 
864
execute stmt1 using @arg00;
 
865
a       b
 
866
2       two
 
867
set @arg00=2 ;
 
868
select a, b FROM t1 outer_table where
 
869
a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
 
870
a       b
 
871
2       two
 
872
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
873
   a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
 
874
execute stmt1 using @arg00;
 
875
a       b
 
876
2       two
 
877
set @arg00=1 ;
 
878
set @arg01='two' ;
 
879
set @arg02=2 ;
 
880
set @arg03='two' ;
 
881
select a, @arg00, b FROM t1 outer_table where
 
882
b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
 
883
and outer_table.a=a ) ;
 
884
a       @arg00  b
 
885
2       1       two
 
886
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
 
887
   b=? and a = (select ? from t1 where outer_table.b = ? 
 
888
                   and outer_table.a=a ) ' ;
 
889
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
890
a       ?       b
 
891
2       1       two
 
892
set @arg00=1 ;
 
893
set @arg01=0 ;
 
894
select a, @arg00 
 
895
from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
 
896
where a=@arg01;
 
897
a       @arg00
 
898
0       1
 
899
prepare stmt1 from ' select a, ? 
 
900
                    from ( select a - ? as a from t1 where a=? ) as t2
 
901
                    where a=? ';
 
902
execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
 
903
a       ?
 
904
0       1
 
905
drop table if exists t2 ;
 
906
create table t2 as select * from t1;
 
907
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
 
908
execute stmt1 ;
 
909
a in (select a from t2)
 
910
1
 
911
1
 
912
1
 
913
1
 
914
drop table if exists t5, t6, t7 ;
 
915
create table t5 (a int , b int) ;
 
916
create table t6 like t5 ;
 
917
create table t7 like t5 ;
 
918
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
 
919
(2, -1), (3, 10) ;
 
920
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
 
921
insert into t7 values (3, 3), (2, 2), (1, 1) ;
 
922
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
 
923
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
924
                     group by t5.a order by sum limit 1) from t7 ' ;
 
925
execute stmt1 ;
 
926
a       (select count(distinct t5.b) as sum from t5, t6
 
927
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
928
                     group by t5.a order by sum limit 1)
 
929
3       1
 
930
2       2
 
931
1       2
 
932
execute stmt1 ;
 
933
a       (select count(distinct t5.b) as sum from t5, t6
 
934
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
935
                     group by t5.a order by sum limit 1)
 
936
3       1
 
937
2       2
 
938
1       2
 
939
execute stmt1 ;
 
940
a       (select count(distinct t5.b) as sum from t5, t6
 
941
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
942
                     group by t5.a order by sum limit 1)
 
943
3       1
 
944
2       2
 
945
1       2
 
946
drop table t5, t6, t7 ;
 
947
drop table if exists t2 ;
 
948
create table t2 as select * from t9;
 
949
set @stmt= ' SELECT
 
950
   (SELECT SUM(c1 + c12 + 0.0) FROM t2 
 
951
    where (t9.c2 - 0e-3) = t2.c2
 
952
    GROUP BY t9.c15 LIMIT 1) as scalar_s,
 
953
   exists (select 1.0e+0 from t2 
 
954
           where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
 
955
   c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
 
956
   (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
 
957
FROM t9,
 
958
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
 
959
prepare stmt1 from @stmt ;
 
960
execute stmt1 ;
 
961
execute stmt1 ;
 
962
set @stmt= concat('explain ',@stmt);
 
963
prepare stmt1 from @stmt ;
 
964
execute stmt1 ;
 
965
execute stmt1 ;
 
966
set @stmt= ' SELECT
 
967
   (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
 
968
    GROUP BY t9.c15 LIMIT 1) as scalar_s,
 
969
   exists (select ? from t2 
 
970
           where t2.c3*?=t9.c4) as exists_s,
 
971
   c5*? in (select c6+? from t2) as in_s,
 
972
   (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
 
973
FROM t9,
 
974
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
 
975
set @arg00= 0.0 ;
 
976
set @arg01= 0e-3 ;
 
977
set @arg02= 1.0e+0 ;
 
978
set @arg03= 9.0000000000 ;
 
979
set @arg04= 4 ;
 
980
set @arg05= 0.3e+1 ;
 
981
set @arg06= 4 ;
 
982
set @arg07= 4 ;
 
983
set @arg08= 4.0 ;
 
984
set @arg09= 40e-1 ;
 
985
prepare stmt1 from @stmt ;
 
986
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
987
@arg07, @arg08, @arg09 ;
 
988
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
989
@arg07, @arg08, @arg09 ;
 
990
set @stmt= concat('explain ',@stmt);
 
991
prepare stmt1 from @stmt ;
 
992
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
993
@arg07, @arg08, @arg09 ;
 
994
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
995
@arg07, @arg08, @arg09 ;
 
996
drop table t2 ;
 
997
select 1 < (select a from t1) ;
 
998
ERROR 21000: Subquery returns more than 1 row
 
999
prepare stmt1 from ' select 1 < (select a from t1) ' ;
 
1000
execute stmt1 ;
 
1001
ERROR 21000: Subquery returns more than 1 row
 
1002
select 1 as my_col ;
 
1003
my_col
 
1004
1
 
1005
test_sequence
 
1006
------ union tests ------
 
1007
prepare stmt1 from ' select a FROM t1 where a=1
 
1008
                     union distinct
 
1009
                     select a FROM t1 where a=1 ';
 
1010
execute stmt1 ;
 
1011
a
 
1012
1
 
1013
execute stmt1 ;
 
1014
a
 
1015
1
 
1016
prepare stmt1 from ' select a FROM t1 where a=1
 
1017
                     union all
 
1018
                     select a FROM t1 where a=1 ';
 
1019
execute stmt1 ;
 
1020
a
 
1021
1
 
1022
1
 
1023
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
 
1024
ERROR 21000: The used SELECT statements have a different number of columns
 
1025
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
 
1026
ERROR 21000: The used SELECT statements have a different number of columns
 
1027
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
 
1028
ERROR 21000: The used SELECT statements have a different number of columns
 
1029
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
 
1030
ERROR 21000: The used SELECT statements have a different number of columns
 
1031
set @arg00=1 ;
 
1032
select @arg00 FROM t1 where a=1
 
1033
union distinct
 
1034
select 1 FROM t1 where a=1;
 
1035
@arg00
 
1036
1
 
1037
prepare stmt1 from ' select ? FROM t1 where a=1
 
1038
                     union distinct
 
1039
                     select 1 FROM t1 where a=1 ' ;
 
1040
execute stmt1 using @arg00;
 
1041
?
 
1042
1
 
1043
set @arg00=1 ;
 
1044
select 1 FROM t1 where a=1
 
1045
union distinct
 
1046
select @arg00 FROM t1 where a=1;
 
1047
1
 
1048
1
 
1049
prepare stmt1 from ' select 1 FROM t1 where a=1
 
1050
                     union distinct
 
1051
                     select ? FROM t1 where a=1 ' ;
 
1052
execute stmt1 using @arg00;
 
1053
1
 
1054
1
 
1055
set @arg00='a' ;
 
1056
select @arg00 FROM t1 where a=1
 
1057
union distinct
 
1058
select @arg00 FROM t1 where a=1;
 
1059
@arg00
 
1060
a
 
1061
prepare stmt1 from ' select ? FROM t1 where a=1
 
1062
                     union distinct
 
1063
                     select ? FROM t1 where a=1 ';
 
1064
execute stmt1 using @arg00, @arg00;
 
1065
?
 
1066
a
 
1067
prepare stmt1 from ' select ? 
 
1068
                     union distinct
 
1069
                     select ? ';
 
1070
execute stmt1 using @arg00, @arg00;
 
1071
?
 
1072
a
 
1073
set @arg00='a' ;
 
1074
set @arg01=1 ;
 
1075
set @arg02='a' ;
 
1076
set @arg03=2 ;
 
1077
select @arg00 FROM t1 where a=@arg01
 
1078
union distinct
 
1079
select @arg02 FROM t1 where a=@arg03;
 
1080
@arg00
 
1081
a
 
1082
prepare stmt1 from ' select ? FROM t1 where a=?
 
1083
                     union distinct
 
1084
                     select ? FROM t1 where a=? ' ;
 
1085
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
 
1086
?
 
1087
a
 
1088
set @arg00=1 ;
 
1089
prepare stmt1 from ' select sum(a) + 200, ? from t1
 
1090
union distinct
 
1091
select sum(a) + 200, 1 from t1
 
1092
group by b ' ;
 
1093
execute stmt1 using @arg00;
 
1094
sum(a) + 200    ?
 
1095
210     1
 
1096
204     1
 
1097
201     1
 
1098
203     1
 
1099
202     1
 
1100
set @Oporto='Oporto' ;
 
1101
set @Lisboa='Lisboa' ;
 
1102
set @0=0 ;
 
1103
set @1=1 ;
 
1104
set @2=2 ;
 
1105
set @3=3 ;
 
1106
set @4=4 ;
 
1107
select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
 
1108
@Oporto @Lisboa @0      @1      @2      @3      @4
 
1109
Oporto  Lisboa  0       1       2       3       4
 
1110
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
1111
group by b
 
1112
union distinct
 
1113
select sum(a) + 200, @Lisboa from t1
 
1114
group by b ;
 
1115
the_sum the_town
 
1116
204     Oporto
 
1117
201     Oporto
 
1118
203     Oporto
 
1119
202     Oporto
 
1120
204     Lisboa
 
1121
201     Lisboa
 
1122
203     Lisboa
 
1123
202     Lisboa
 
1124
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
1125
                     group by b
 
1126
                     union distinct
 
1127
                     select sum(a) + 200, ? from t1
 
1128
                     group by b ' ;
 
1129
execute stmt1 using @Oporto, @Lisboa;
 
1130
the_sum the_town
 
1131
204     Oporto
 
1132
201     Oporto
 
1133
203     Oporto
 
1134
202     Oporto
 
1135
204     Lisboa
 
1136
201     Lisboa
 
1137
203     Lisboa
 
1138
202     Lisboa
 
1139
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
1140
where a > @1
 
1141
group by b
 
1142
union distinct
 
1143
select sum(a) + 200, @Lisboa from t1
 
1144
where a > @2
 
1145
group by b ;
 
1146
the_sum the_town
 
1147
204     Oporto
 
1148
203     Oporto
 
1149
202     Oporto
 
1150
204     Lisboa
 
1151
203     Lisboa
 
1152
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
1153
                     where a > ?
 
1154
                     group by b
 
1155
                     union distinct
 
1156
                     select sum(a) + 200, ? from t1
 
1157
                     where a > ?
 
1158
                     group by b ' ;
 
1159
execute stmt1 using @Oporto, @1, @Lisboa, @2;
 
1160
the_sum the_town
 
1161
204     Oporto
 
1162
203     Oporto
 
1163
202     Oporto
 
1164
204     Lisboa
 
1165
203     Lisboa
 
1166
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
1167
where a > @1
 
1168
group by b
 
1169
having avg(a) > @2
 
1170
union distinct
 
1171
select sum(a) + 200, @Lisboa from t1
 
1172
where a > @2
 
1173
group by b 
 
1174
having avg(a) > @3;
 
1175
the_sum the_town
 
1176
204     Oporto
 
1177
203     Oporto
 
1178
204     Lisboa
 
1179
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
1180
                     where a > ?
 
1181
                     group by b
 
1182
                     having avg(a) > ?
 
1183
                     union distinct
 
1184
                     select sum(a) + 200, ? from t1
 
1185
                     where a > ?
 
1186
                     group by b
 
1187
                     having avg(a) > ? ';
 
1188
execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
 
1189
the_sum the_town
 
1190
204     Oporto
 
1191
203     Oporto
 
1192
204     Lisboa
 
1193
test_sequence
 
1194
------ explain select tests ------
 
1195
prepare stmt1 from ' explain select * from t9 ' ;
 
1196
execute stmt1;
 
1197
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1198
def                                     id      8       3       1       N       32929   0       63
 
1199
def                                     select_type     253     19      6       N       1       31      8
 
1200
def                                     table   253     64      2       Y       0       31      8
 
1201
def                                     type    253     10      3       Y       0       31      8
 
1202
def                                     possible_keys   253     4096    0       Y       0       31      8
 
1203
def                                     key     253     64      0       Y       0       31      8
 
1204
def                                     key_len 253     4096    0       Y       0       31      8
 
1205
def                                     ref     253     1024    0       Y       0       31      8
 
1206
def                                     rows    8       10      1       Y       32928   0       63
 
1207
def                                     Extra   253     255     0       N       1       31      8
 
1208
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
1209
1       SIMPLE  t9      ALL     NULL    NULL    NULL    NULL    2       
 
1210
test_sequence
 
1211
------ delete tests ------
 
1212
delete from t1 ;
 
1213
insert into t1 values (1,'one');
 
1214
insert into t1 values (2,'two');
 
1215
insert into t1 values (3,'three');
 
1216
insert into t1 values (4,'four');
 
1217
commit ;
 
1218
delete from t9 ;
 
1219
insert into t9
 
1220
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
1221
c10= 1, c11= 1, c12 = 1,
 
1222
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1223
c16= '11:11:11', c17= '2004',
 
1224
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
1225
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1226
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1227
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
1228
insert into t9
 
1229
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
1230
c10= 9, c11= 9, c12 = 9,
 
1231
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1232
c16= '11:11:11', c17= '2004',
 
1233
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
1234
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1235
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1236
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
1237
commit ;
 
1238
prepare stmt1 from 'delete from t1 where a=2' ;
 
1239
execute stmt1;
 
1240
select a,b from t1 where a=2;
 
1241
a       b
 
1242
execute stmt1;
 
1243
insert into t1 values(0,NULL);
 
1244
set @arg00=NULL;
 
1245
prepare stmt1 from 'delete from t1 where b=?' ;
 
1246
execute stmt1 using @arg00;
 
1247
select a,b from t1 where b is NULL ;
 
1248
a       b
 
1249
0       NULL
 
1250
set @arg00='one';
 
1251
execute stmt1 using @arg00;
 
1252
select a,b from t1 where b=@arg00;
 
1253
a       b
 
1254
prepare stmt1 from 'truncate table t1' ;
 
1255
test_sequence
 
1256
------ update tests ------
 
1257
delete from t1 ;
 
1258
insert into t1 values (1,'one');
 
1259
insert into t1 values (2,'two');
 
1260
insert into t1 values (3,'three');
 
1261
insert into t1 values (4,'four');
 
1262
commit ;
 
1263
delete from t9 ;
 
1264
insert into t9
 
1265
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
1266
c10= 1, c11= 1, c12 = 1,
 
1267
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1268
c16= '11:11:11', c17= '2004',
 
1269
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
1270
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1271
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1272
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
1273
insert into t9
 
1274
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
1275
c10= 9, c11= 9, c12 = 9,
 
1276
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1277
c16= '11:11:11', c17= '2004',
 
1278
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
1279
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1280
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1281
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
1282
commit ;
 
1283
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
 
1284
execute stmt1;
 
1285
select a,b from t1 where a=2;
 
1286
a       b
 
1287
2       a=two
 
1288
execute stmt1;
 
1289
select a,b from t1 where a=2;
 
1290
a       b
 
1291
2       a=two
 
1292
set @arg00=NULL;
 
1293
prepare stmt1 from 'update t1 set b=? where a=2' ;
 
1294
execute stmt1 using @arg00;
 
1295
select a,b from t1 where a=2;
 
1296
a       b
 
1297
2       NULL
 
1298
set @arg00='two';
 
1299
execute stmt1 using @arg00;
 
1300
select a,b from t1 where a=2;
 
1301
a       b
 
1302
2       two
 
1303
set @arg00=2;
 
1304
prepare stmt1 from 'update t1 set b=NULL where a=?' ;
 
1305
execute stmt1 using @arg00;
 
1306
select a,b from t1 where a=@arg00;
 
1307
a       b
 
1308
2       NULL
 
1309
update t1 set b='two' where a=@arg00;
 
1310
set @arg00=2000;
 
1311
execute stmt1 using @arg00;
 
1312
select a,b from t1 where a=@arg00;
 
1313
a       b
 
1314
set @arg00=2;
 
1315
set @arg01=22;
 
1316
prepare stmt1 from 'update t1 set a=? where a=?' ;
 
1317
execute stmt1 using @arg00, @arg00;
 
1318
select a,b from t1 where a=@arg00;
 
1319
a       b
 
1320
2       two
 
1321
execute stmt1 using @arg01, @arg00;
 
1322
select a,b from t1 where a=@arg01;
 
1323
a       b
 
1324
22      two
 
1325
execute stmt1 using @arg00, @arg01;
 
1326
select a,b from t1 where a=@arg00;
 
1327
a       b
 
1328
2       two
 
1329
set @arg00=NULL;
 
1330
set @arg01=2;
 
1331
execute stmt1 using @arg00, @arg01;
 
1332
Warnings:
 
1333
Warning 1048    Column 'a' cannot be null
 
1334
select a,b from t1 order by a;
 
1335
a       b
 
1336
0       two
 
1337
1       one
 
1338
3       three
 
1339
4       four
 
1340
set @arg00=0;
 
1341
execute stmt1 using @arg01, @arg00;
 
1342
select a,b from t1 order by a;
 
1343
a       b
 
1344
1       one
 
1345
2       two
 
1346
3       three
 
1347
4       four
 
1348
set @arg00=23;
 
1349
set @arg01='two';
 
1350
set @arg02=2;
 
1351
set @arg03='two';
 
1352
set @arg04=2;
 
1353
drop table if exists t2;
 
1354
create table t2 as select a,b from t1 ;
 
1355
prepare stmt1 from 'update t1 set a=? where b=?
 
1356
                    and a in (select ? from t2
 
1357
                              where b = ? or a = ?)';
 
1358
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
 
1359
affected rows: 1
 
1360
info: Rows matched: 1  Changed: 1  Warnings: 0
 
1361
select a,b from t1 where a = @arg00 ;
 
1362
a       b
 
1363
23      two
 
1364
prepare stmt1 from 'update t1 set a=? where b=?
 
1365
                    and a not in (select ? from t2
 
1366
                              where b = ? or a = ?)';
 
1367
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
 
1368
affected rows: 1
 
1369
info: Rows matched: 1  Changed: 1  Warnings: 0
 
1370
select a,b from t1 order by a ;
 
1371
a       b
 
1372
1       one
 
1373
2       two
 
1374
3       three
 
1375
4       four
 
1376
drop table t2 ;
 
1377
create table t2
 
1378
(
 
1379
a int, b varchar(30),
 
1380
primary key(a)
 
1381
) engine = 'MYISAM'  ;
 
1382
insert into t2(a,b) select a, b from t1 ;
 
1383
prepare stmt1 from 'update t1 set a=? where b=?
 
1384
                    and a in (select ? from t2
 
1385
                              where b = ? or a = ?)';
 
1386
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
 
1387
affected rows: 1
 
1388
info: Rows matched: 1  Changed: 1  Warnings: 0
 
1389
select a,b from t1 where a = @arg00 ;
 
1390
a       b
 
1391
23      two
 
1392
prepare stmt1 from 'update t1 set a=? where b=?
 
1393
                    and a not in (select ? from t2
 
1394
                              where b = ? or a = ?)';
 
1395
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
 
1396
affected rows: 1
 
1397
info: Rows matched: 1  Changed: 1  Warnings: 0
 
1398
select a,b from t1 order by a ;
 
1399
a       b
 
1400
1       one
 
1401
2       two
 
1402
3       three
 
1403
4       four
 
1404
drop table t2 ;
 
1405
set @arg00=1;
 
1406
prepare stmt1 from 'update t1 set b=''bla''
 
1407
where a=2
 
1408
limit 1';
 
1409
execute stmt1 ;
 
1410
select a,b from t1 where b = 'bla' ;
 
1411
a       b
 
1412
2       bla
 
1413
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
 
1414
execute stmt1 using @arg00;
 
1415
test_sequence
 
1416
------ insert tests ------
 
1417
delete from t1 ;
 
1418
insert into t1 values (1,'one');
 
1419
insert into t1 values (2,'two');
 
1420
insert into t1 values (3,'three');
 
1421
insert into t1 values (4,'four');
 
1422
commit ;
 
1423
delete from t9 ;
 
1424
insert into t9
 
1425
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
1426
c10= 1, c11= 1, c12 = 1,
 
1427
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1428
c16= '11:11:11', c17= '2004',
 
1429
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
1430
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1431
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1432
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
1433
insert into t9
 
1434
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
1435
c10= 9, c11= 9, c12 = 9,
 
1436
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1437
c16= '11:11:11', c17= '2004',
 
1438
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
1439
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1440
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1441
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
1442
commit ;
 
1443
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
 
1444
execute stmt1;
 
1445
select a,b from t1 where a = 5;
 
1446
a       b
 
1447
5       five
 
1448
set @arg00='six' ;
 
1449
prepare stmt1 from 'insert into t1 values(6, ? )';
 
1450
execute stmt1 using @arg00;
 
1451
select a,b from t1 where b = @arg00;
 
1452
a       b
 
1453
6       six
 
1454
execute stmt1 using @arg00;
 
1455
ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
 
1456
set @arg00=NULL ;
 
1457
prepare stmt1 from 'insert into t1 values(0, ? )';
 
1458
execute stmt1 using @arg00;
 
1459
select a,b from t1 where b is NULL;
 
1460
a       b
 
1461
0       NULL
 
1462
set @arg00=8 ;
 
1463
set @arg01='eight' ;
 
1464
prepare stmt1 from 'insert into t1 values(?, ? )';
 
1465
execute stmt1 using @arg00, @arg01 ;
 
1466
select a,b from t1 where b = @arg01;
 
1467
a       b
 
1468
8       eight
 
1469
set @NULL= null ;
 
1470
set @arg00= 'abc' ;
 
1471
execute stmt1 using @NULL, @NULL ;
 
1472
ERROR 23000: Column 'a' cannot be null
 
1473
execute stmt1 using @NULL, @NULL ;
 
1474
ERROR 23000: Column 'a' cannot be null
 
1475
execute stmt1 using @NULL, @arg00 ;
 
1476
ERROR 23000: Column 'a' cannot be null
 
1477
execute stmt1 using @NULL, @arg00 ;
 
1478
ERROR 23000: Column 'a' cannot be null
 
1479
set @arg01= 10000 + 2 ;
 
1480
execute stmt1 using @arg01, @arg00 ;
 
1481
set @arg01= 10000 + 1 ;
 
1482
execute stmt1 using @arg01, @arg00 ;
 
1483
select * from t1 where a > 10000 order by a ;
 
1484
a       b
 
1485
10001   abc
 
1486
10002   abc
 
1487
delete from t1 where a > 10000 ;
 
1488
set @arg01= 10000 + 2 ;
 
1489
execute stmt1 using @arg01, @NULL ;
 
1490
set @arg01= 10000 + 1 ;
 
1491
execute stmt1 using @arg01, @NULL ;
 
1492
select * from t1 where a > 10000 order by a ;
 
1493
a       b
 
1494
10001   NULL
 
1495
10002   NULL
 
1496
delete from t1 where a > 10000 ;
 
1497
set @arg01= 10000 + 10 ;
 
1498
execute stmt1 using @arg01, @arg01 ;
 
1499
set @arg01= 10000 + 9 ;
 
1500
execute stmt1 using @arg01, @arg01 ;
 
1501
set @arg01= 10000 + 8 ;
 
1502
execute stmt1 using @arg01, @arg01 ;
 
1503
set @arg01= 10000 + 7 ;
 
1504
execute stmt1 using @arg01, @arg01 ;
 
1505
set @arg01= 10000 + 6 ;
 
1506
execute stmt1 using @arg01, @arg01 ;
 
1507
set @arg01= 10000 + 5 ;
 
1508
execute stmt1 using @arg01, @arg01 ;
 
1509
set @arg01= 10000 + 4 ;
 
1510
execute stmt1 using @arg01, @arg01 ;
 
1511
set @arg01= 10000 + 3 ;
 
1512
execute stmt1 using @arg01, @arg01 ;
 
1513
set @arg01= 10000 + 2 ;
 
1514
execute stmt1 using @arg01, @arg01 ;
 
1515
set @arg01= 10000 + 1 ;
 
1516
execute stmt1 using @arg01, @arg01 ;
 
1517
select * from t1 where a > 10000 order by a ;
 
1518
a       b
 
1519
10001   10001
 
1520
10002   10002
 
1521
10003   10003
 
1522
10004   10004
 
1523
10005   10005
 
1524
10006   10006
 
1525
10007   10007
 
1526
10008   10008
 
1527
10009   10009
 
1528
10010   10010
 
1529
delete from t1 where a > 10000 ;
 
1530
set @arg00=81 ;
 
1531
set @arg01='8-1' ;
 
1532
set @arg02=82 ;
 
1533
set @arg03='8-2' ;
 
1534
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
 
1535
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
1536
select a,b from t1 where a in (@arg00,@arg02) ;
 
1537
a       b
 
1538
81      8-1
 
1539
82      8-2
 
1540
set @arg00=9 ;
 
1541
set @arg01='nine' ;
 
1542
prepare stmt1 from 'insert into t1 set a=?, b=? ';
 
1543
execute stmt1 using @arg00, @arg01 ;
 
1544
select a,b from t1 where a = @arg00 ;
 
1545
a       b
 
1546
9       nine
 
1547
set @arg00=6 ;
 
1548
set @arg01=1 ;
 
1549
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
 
1550
                    on duplicate key update a=a + ?, b=concat(b,''modified'') ';
 
1551
execute stmt1 using @arg00, @arg01;
 
1552
select * from t1 order by a;
 
1553
a       b
 
1554
0       NULL
 
1555
1       one
 
1556
2       two
 
1557
3       three
 
1558
4       four
 
1559
5       five
 
1560
7       sixmodified
 
1561
8       eight
 
1562
9       nine
 
1563
81      8-1
 
1564
82      8-2
 
1565
set @arg00=81 ;
 
1566
set @arg01=1 ;
 
1567
execute stmt1 using @arg00, @arg01;
 
1568
ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
 
1569
drop table if exists t2 ;
 
1570
create table t2 (id int auto_increment primary key) 
 
1571
ENGINE= 'MYISAM'  ;
 
1572
prepare stmt1 from ' select last_insert_id() ' ;
 
1573
insert into t2 values (NULL) ;
 
1574
execute stmt1 ;
 
1575
last_insert_id()
 
1576
1
 
1577
insert into t2 values (NULL) ;
 
1578
execute stmt1 ;
 
1579
last_insert_id()
 
1580
2
 
1581
drop table t2 ;
 
1582
set @1000=1000 ;
 
1583
set @x1000_2="x1000_2" ;
 
1584
set @x1000_3="x1000_3" ;
 
1585
set @x1000="x1000" ;
 
1586
set @1100=1100 ;
 
1587
set @x1100="x1100" ;
 
1588
set @100=100 ;
 
1589
set @updated="updated" ;
 
1590
insert into t1 values(1000,'x1000_1') ;
 
1591
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
 
1592
on duplicate key update a = a + @100, b = concat(b,@updated) ;
 
1593
select a,b from t1 where a >= 1000 order by a ;
 
1594
a       b
 
1595
1000    x1000_3
 
1596
1100    x1000_1updated
 
1597
delete from t1 where a >= 1000 ;
 
1598
insert into t1 values(1000,'x1000_1') ;
 
1599
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
 
1600
               on duplicate key update a = a + ?, b = concat(b,?) ';
 
1601
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
 
1602
select a,b from t1 where a >= 1000 order by a ;
 
1603
a       b
 
1604
1000    x1000_3
 
1605
1100    x1000_1updated
 
1606
delete from t1 where a >= 1000 ;
 
1607
insert into t1 values(1000,'x1000_1') ;
 
1608
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
 
1609
select a,b from t1 where a >= 1000 order by a ;
 
1610
a       b
 
1611
1200    x1000_1updatedupdated
 
1612
delete from t1 where a >= 1000 ;
 
1613
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
 
1614
execute stmt1;
 
1615
execute stmt1;
 
1616
execute stmt1;
 
1617
test_sequence
 
1618
------ multi table tests ------
 
1619
delete from t1 ;
 
1620
delete from t9 ;
 
1621
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
 
1622
insert into t9 (c1,c21)
 
1623
values (1, 'one'), (2, 'two'), (3, 'three') ;
 
1624
prepare stmt_delete from " delete t1, t9 
 
1625
  from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
 
1626
prepare stmt_update from " update t1, t9 
 
1627
  set t1.b='updated', t9.c21='updated'
 
1628
  where t1.a=t9.c1 and t1.a=? ";
 
1629
prepare stmt_select1 from " select a, b from t1 order by a" ;
 
1630
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
 
1631
set @arg00= 1 ;
 
1632
execute stmt_update using @arg00 ;
 
1633
execute stmt_delete ;
 
1634
execute stmt_select1 ;
 
1635
a       b
 
1636
2       two
 
1637
3       three
 
1638
execute stmt_select2 ;
 
1639
c1      c21
 
1640
2       two
 
1641
3       three
 
1642
set @arg00= @arg00 + 1 ;
 
1643
execute stmt_update using @arg00 ;
 
1644
execute stmt_delete ;
 
1645
execute stmt_select1 ;
 
1646
a       b
 
1647
3       three
 
1648
execute stmt_select2 ;
 
1649
c1      c21
 
1650
3       three
 
1651
set @arg00= @arg00 + 1 ;
 
1652
execute stmt_update using @arg00 ;
 
1653
execute stmt_delete ;
 
1654
execute stmt_select1 ;
 
1655
a       b
 
1656
execute stmt_select2 ;
 
1657
c1      c21
 
1658
set @arg00= @arg00 + 1 ;
 
1659
drop table if exists t5 ;
 
1660
set @arg01= 8;
 
1661
set @arg02= 8.0;
 
1662
set @arg03= 80.00000000000e-1;
 
1663
set @arg04= 'abc' ;
 
1664
set @arg05= CAST('abc' as binary) ;
 
1665
set @arg06= '1991-08-05' ;
 
1666
set @arg07= CAST('1991-08-05' as date);
 
1667
set @arg08= '1991-08-05 01:01:01' ;
 
1668
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
 
1669
set @arg10= unix_timestamp('1991-01-01 01:01:01');
 
1670
set @arg11= YEAR('1991-01-01 01:01:01');
 
1671
set @arg12= 8 ;
 
1672
set @arg12= NULL ;
 
1673
set @arg13= 8.0 ;
 
1674
set @arg13= NULL ;
 
1675
set @arg14= 'abc';
 
1676
set @arg14= NULL ;
 
1677
set @arg15= CAST('abc' as binary) ;
 
1678
set @arg15= NULL ;
 
1679
create table t5 as select
 
1680
8                           as const01, @arg01 as param01,
 
1681
8.0                         as const02, @arg02 as param02,
 
1682
80.00000000000e-1           as const03, @arg03 as param03,
 
1683
'abc'                       as const04, @arg04 as param04,
 
1684
CAST('abc' as binary)       as const05, @arg05 as param05,
 
1685
'1991-08-05'                as const06, @arg06 as param06,
 
1686
CAST('1991-08-05' as date)  as const07, @arg07 as param07,
 
1687
'1991-08-05 01:01:01'       as const08, @arg08 as param08,
 
1688
CAST('1991-08-05 01:01:01'  as datetime) as const09, @arg09 as param09,
 
1689
unix_timestamp('1991-01-01 01:01:01')    as const10, @arg10 as param10,
 
1690
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, 
 
1691
NULL                        as const12, @arg12 as param12,
 
1692
@arg13 as param13,
 
1693
@arg14 as param14,
 
1694
@arg15 as param15;
 
1695
show create table t5 ;
 
1696
Table   Create Table
 
1697
t5      CREATE TABLE `t5` (
 
1698
  `const01` int(1) NOT NULL DEFAULT '0',
 
1699
  `param01` bigint(20) DEFAULT NULL,
 
1700
  `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
 
1701
  `param02` decimal(65,30) DEFAULT NULL,
 
1702
  `const03` double NOT NULL DEFAULT '0',
 
1703
  `param03` double DEFAULT NULL,
 
1704
  `const04` varchar(3) NOT NULL DEFAULT '',
 
1705
  `param04` longtext,
 
1706
  `const05` varbinary(3) NOT NULL DEFAULT '',
 
1707
  `param05` longblob,
 
1708
  `const06` varchar(10) NOT NULL DEFAULT '',
 
1709
  `param06` longtext,
 
1710
  `const07` date DEFAULT NULL,
 
1711
  `param07` longblob,
 
1712
  `const08` varchar(19) NOT NULL DEFAULT '',
 
1713
  `param08` longtext,
 
1714
  `const09` datetime DEFAULT NULL,
 
1715
  `param09` longblob,
 
1716
  `const10` int(10) NOT NULL DEFAULT '0',
 
1717
  `param10` bigint(20) DEFAULT NULL,
 
1718
  `const11` int(4) DEFAULT NULL,
 
1719
  `param11` bigint(20) DEFAULT NULL,
 
1720
  `const12` binary(0) DEFAULT NULL,
 
1721
  `param12` bigint(20) DEFAULT NULL,
 
1722
  `param13` decimal(65,30) DEFAULT NULL,
 
1723
  `param14` longtext,
 
1724
  `param15` longblob
 
1725
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
1726
select * from t5 ;
 
1727
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1728
def     test    t5      t5      const01 const01 3       1       1       N       32769   0       63
 
1729
def     test    t5      t5      param01 param01 8       20      1       Y       32768   0       63
 
1730
def     test    t5      t5      const02 const02 246     4       3       N       1       1       63
 
1731
def     test    t5      t5      param02 param02 246     67      32      Y       0       30      63
 
1732
def     test    t5      t5      const03 const03 5       17      1       N       32769   31      63
 
1733
def     test    t5      t5      param03 param03 5       23      1       Y       32768   31      63
 
1734
def     test    t5      t5      const04 const04 253     3       3       N       1       0       8
 
1735
def     test    t5      t5      param04 param04 252     4294967295      3       Y       16      0       8
 
1736
def     test    t5      t5      const05 const05 253     3       3       N       129     0       63
 
1737
def     test    t5      t5      param05 param05 252     4294967295      3       Y       144     0       63
 
1738
def     test    t5      t5      const06 const06 253     10      10      N       1       0       8
 
1739
def     test    t5      t5      param06 param06 252     4294967295      10      Y       16      0       8
 
1740
def     test    t5      t5      const07 const07 10      10      10      Y       128     0       63
 
1741
def     test    t5      t5      param07 param07 252     4294967295      10      Y       144     0       63
 
1742
def     test    t5      t5      const08 const08 253     19      19      N       1       0       8
 
1743
def     test    t5      t5      param08 param08 252     4294967295      19      Y       16      0       8
 
1744
def     test    t5      t5      const09 const09 12      19      19      Y       128     0       63
 
1745
def     test    t5      t5      param09 param09 252     4294967295      19      Y       144     0       63
 
1746
def     test    t5      t5      const10 const10 3       10      9       N       32769   0       63
 
1747
def     test    t5      t5      param10 param10 8       20      9       Y       32768   0       63
 
1748
def     test    t5      t5      const11 const11 3       4       4       Y       32768   0       63
 
1749
def     test    t5      t5      param11 param11 8       20      4       Y       32768   0       63
 
1750
def     test    t5      t5      const12 const12 254     0       0       Y       128     0       63
 
1751
def     test    t5      t5      param12 param12 8       20      0       Y       32768   0       63
 
1752
def     test    t5      t5      param13 param13 246     67      0       Y       0       30      63
 
1753
def     test    t5      t5      param14 param14 252     4294967295      0       Y       16      0       8
 
1754
def     test    t5      t5      param15 param15 252     4294967295      0       Y       144     0       63
 
1755
const01 8
 
1756
param01 8
 
1757
const02 8.0
 
1758
param02 8.000000000000000000000000000000
 
1759
const03 8
 
1760
param03 8
 
1761
const04 abc
 
1762
param04 abc
 
1763
const05 abc
 
1764
param05 abc
 
1765
const06 1991-08-05
 
1766
param06 1991-08-05
 
1767
const07 1991-08-05
 
1768
param07 1991-08-05
 
1769
const08 1991-08-05 01:01:01
 
1770
param08 1991-08-05 01:01:01
 
1771
const09 1991-08-05 01:01:01
 
1772
param09 1991-08-05 01:01:01
 
1773
const10 662680861
 
1774
param10 662680861
 
1775
const11 1991
 
1776
param11 1991
 
1777
const12 NULL
 
1778
param12 NULL
 
1779
param13 NULL
 
1780
param14 NULL
 
1781
param15 NULL
 
1782
drop table t5 ;
 
1783
test_sequence
 
1784
------ data type conversion tests ------
 
1785
delete from t1 ;
 
1786
insert into t1 values (1,'one');
 
1787
insert into t1 values (2,'two');
 
1788
insert into t1 values (3,'three');
 
1789
insert into t1 values (4,'four');
 
1790
commit ;
 
1791
delete from t9 ;
 
1792
insert into t9
 
1793
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
1794
c10= 1, c11= 1, c12 = 1,
 
1795
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1796
c16= '11:11:11', c17= '2004',
 
1797
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
1798
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1799
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1800
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
1801
insert into t9
 
1802
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
1803
c10= 9, c11= 9, c12 = 9,
 
1804
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
1805
c16= '11:11:11', c17= '2004',
 
1806
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
1807
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
1808
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
1809
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
1810
commit ;
 
1811
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
 
1812
select * from t9 order by c1 ;
 
1813
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c11     c12     c13     c14     c15     c16     c17     c18     c19     c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30     c31     c32
 
1814
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
1815
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
1816
9       9       9       9       9       9       9       9       9       9       9.0000  9.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       0       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        two     tuesday
 
1817
test_sequence
 
1818
------ select @parameter:= column ------
 
1819
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
 
1820
       @arg05, @arg06, @arg07, @arg08,
 
1821
       @arg09, @arg10, @arg11, @arg12,
 
1822
       @arg13, @arg14, @arg15, @arg16,
 
1823
       @arg17, @arg18, @arg19, @arg20,
 
1824
       @arg21, @arg22, @arg23, @arg24,
 
1825
       @arg25, @arg26, @arg27, @arg28,
 
1826
       @arg29, @arg30, @arg31, @arg32" ;
 
1827
select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
1828
@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
1829
@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
1830
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
1831
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
1832
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
1833
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
1834
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
1835
from t9 where c1= 1 ;
 
1836
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
1837
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
1838
execute full_info ;
 
1839
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1840
def                                     @arg01  8       20      1       Y       32896   0       63
 
1841
def                                     @arg02  8       20      1       Y       32896   0       63
 
1842
def                                     @arg03  8       20      1       Y       32896   0       63
 
1843
def                                     @arg04  8       20      1       Y       32896   0       63
 
1844
def                                     @arg05  8       20      1       Y       32896   0       63
 
1845
def                                     @arg06  8       20      1       Y       32896   0       63
 
1846
def                                     @arg07  5       23      1       Y       32896   31      63
 
1847
def                                     @arg08  5       23      1       Y       32896   31      63
 
1848
def                                     @arg09  5       23      1       Y       32896   31      63
 
1849
def                                     @arg10  5       23      1       Y       32896   31      63
 
1850
def                                     @arg11  246     83      6       Y       128     30      63
 
1851
def                                     @arg12  246     83      6       Y       128     30      63
 
1852
def                                     @arg13  251     16777216        10      Y       128     31      63
 
1853
def                                     @arg14  251     16777216        19      Y       128     31      63
 
1854
def                                     @arg15  251     16777216        19      Y       128     31      63
 
1855
def                                     @arg16  251     16777216        8       Y       128     31      63
 
1856
def                                     @arg17  8       20      4       Y       32928   0       63
 
1857
def                                     @arg18  8       20      1       Y       32896   0       63
 
1858
def                                     @arg19  8       20      1       Y       32896   0       63
 
1859
def                                     @arg20  251     16777216        1       Y       0       31      8
 
1860
def                                     @arg21  251     16777216        10      Y       0       31      8
 
1861
def                                     @arg22  251     16777216        30      Y       0       31      8
 
1862
def                                     @arg23  251     16777216        8       Y       128     31      63
 
1863
def                                     @arg24  251     16777216        8       Y       0       31      8
 
1864
def                                     @arg25  251     16777216        4       Y       128     31      63
 
1865
def                                     @arg26  251     16777216        4       Y       0       31      8
 
1866
def                                     @arg27  251     16777216        10      Y       128     31      63
 
1867
def                                     @arg28  251     16777216        10      Y       0       31      8
 
1868
def                                     @arg29  251     16777216        8       Y       128     31      63
 
1869
def                                     @arg30  251     16777216        8       Y       0       31      8
 
1870
def                                     @arg31  251     16777216        3       Y       0       31      8
 
1871
def                                     @arg32  251     16777216        6       Y       0       31      8
 
1872
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
1873
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
1874
select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
1875
@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
1876
@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
1877
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
1878
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
1879
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
1880
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
1881
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
1882
from t9 where c1= 0 ;
 
1883
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
1884
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
1885
execute full_info ;
 
1886
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1887
def                                     @arg01  8       20      1       Y       32896   0       63
 
1888
def                                     @arg02  8       20      0       Y       32896   0       63
 
1889
def                                     @arg03  8       20      0       Y       32896   0       63
 
1890
def                                     @arg04  8       20      0       Y       32896   0       63
 
1891
def                                     @arg05  8       20      0       Y       32896   0       63
 
1892
def                                     @arg06  8       20      0       Y       32896   0       63
 
1893
def                                     @arg07  5       23      0       Y       32896   31      63
 
1894
def                                     @arg08  5       23      0       Y       32896   31      63
 
1895
def                                     @arg09  5       23      0       Y       32896   31      63
 
1896
def                                     @arg10  5       23      0       Y       32896   31      63
 
1897
def                                     @arg11  246     83      0       Y       128     30      63
 
1898
def                                     @arg12  246     83      0       Y       128     30      63
 
1899
def                                     @arg13  251     16777216        0       Y       128     31      63
 
1900
def                                     @arg14  251     16777216        0       Y       128     31      63
 
1901
def                                     @arg15  251     16777216        19      Y       128     31      63
 
1902
def                                     @arg16  251     16777216        0       Y       128     31      63
 
1903
def                                     @arg17  8       20      0       Y       32928   0       63
 
1904
def                                     @arg18  8       20      0       Y       32896   0       63
 
1905
def                                     @arg19  8       20      0       Y       32896   0       63
 
1906
def                                     @arg20  251     16777216        0       Y       0       31      8
 
1907
def                                     @arg21  251     16777216        0       Y       0       31      8
 
1908
def                                     @arg22  251     16777216        0       Y       0       31      8
 
1909
def                                     @arg23  251     16777216        0       Y       128     31      63
 
1910
def                                     @arg24  251     16777216        0       Y       0       31      8
 
1911
def                                     @arg25  251     16777216        0       Y       128     31      63
 
1912
def                                     @arg26  251     16777216        0       Y       0       31      8
 
1913
def                                     @arg27  251     16777216        0       Y       128     31      63
 
1914
def                                     @arg28  251     16777216        0       Y       0       31      8
 
1915
def                                     @arg29  251     16777216        0       Y       128     31      63
 
1916
def                                     @arg30  251     16777216        0       Y       0       31      8
 
1917
def                                     @arg31  251     16777216        0       Y       0       31      8
 
1918
def                                     @arg32  251     16777216        0       Y       0       31      8
 
1919
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
1920
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
1921
prepare stmt1 from "select 
 
1922
       @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
1923
       @arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
1924
       @arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
1925
       @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
1926
       @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
1927
       @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
1928
       @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
1929
       @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
1930
from t9 where c1= ?" ;
 
1931
set @my_key= 1 ;
 
1932
execute stmt1 using @my_key ;
 
1933
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
1934
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
1935
execute full_info ;
 
1936
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1937
def                                     @arg01  8       20      1       Y       32896   0       63
 
1938
def                                     @arg02  8       20      1       Y       32896   0       63
 
1939
def                                     @arg03  8       20      1       Y       32896   0       63
 
1940
def                                     @arg04  8       20      1       Y       32896   0       63
 
1941
def                                     @arg05  8       20      1       Y       32896   0       63
 
1942
def                                     @arg06  8       20      1       Y       32896   0       63
 
1943
def                                     @arg07  5       23      1       Y       32896   31      63
 
1944
def                                     @arg08  5       23      1       Y       32896   31      63
 
1945
def                                     @arg09  5       23      1       Y       32896   31      63
 
1946
def                                     @arg10  5       23      1       Y       32896   31      63
 
1947
def                                     @arg11  246     83      6       Y       128     30      63
 
1948
def                                     @arg12  246     83      6       Y       128     30      63
 
1949
def                                     @arg13  251     16777216        10      Y       128     31      63
 
1950
def                                     @arg14  251     16777216        19      Y       128     31      63
 
1951
def                                     @arg15  251     16777216        19      Y       128     31      63
 
1952
def                                     @arg16  251     16777216        8       Y       128     31      63
 
1953
def                                     @arg17  8       20      4       Y       32928   0       63
 
1954
def                                     @arg18  8       20      1       Y       32896   0       63
 
1955
def                                     @arg19  8       20      1       Y       32896   0       63
 
1956
def                                     @arg20  251     16777216        1       Y       0       31      8
 
1957
def                                     @arg21  251     16777216        10      Y       0       31      8
 
1958
def                                     @arg22  251     16777216        30      Y       0       31      8
 
1959
def                                     @arg23  251     16777216        8       Y       128     31      63
 
1960
def                                     @arg24  251     16777216        8       Y       0       31      8
 
1961
def                                     @arg25  251     16777216        4       Y       128     31      63
 
1962
def                                     @arg26  251     16777216        4       Y       0       31      8
 
1963
def                                     @arg27  251     16777216        10      Y       128     31      63
 
1964
def                                     @arg28  251     16777216        10      Y       0       31      8
 
1965
def                                     @arg29  251     16777216        8       Y       128     31      63
 
1966
def                                     @arg30  251     16777216        8       Y       0       31      8
 
1967
def                                     @arg31  251     16777216        3       Y       0       31      8
 
1968
def                                     @arg32  251     16777216        6       Y       0       31      8
 
1969
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
1970
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
1971
set @my_key= 0 ;
 
1972
execute stmt1 using @my_key ;
 
1973
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
1974
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
1975
execute full_info ;
 
1976
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
1977
def                                     @arg01  8       20      1       Y       32896   0       63
 
1978
def                                     @arg02  8       20      0       Y       32896   0       63
 
1979
def                                     @arg03  8       20      0       Y       32896   0       63
 
1980
def                                     @arg04  8       20      0       Y       32896   0       63
 
1981
def                                     @arg05  8       20      0       Y       32896   0       63
 
1982
def                                     @arg06  8       20      0       Y       32896   0       63
 
1983
def                                     @arg07  5       23      0       Y       32896   31      63
 
1984
def                                     @arg08  5       23      0       Y       32896   31      63
 
1985
def                                     @arg09  5       23      0       Y       32896   31      63
 
1986
def                                     @arg10  5       23      0       Y       32896   31      63
 
1987
def                                     @arg11  246     83      0       Y       128     30      63
 
1988
def                                     @arg12  246     83      0       Y       128     30      63
 
1989
def                                     @arg13  251     16777216        0       Y       128     31      63
 
1990
def                                     @arg14  251     16777216        0       Y       128     31      63
 
1991
def                                     @arg15  251     16777216        19      Y       128     31      63
 
1992
def                                     @arg16  251     16777216        0       Y       128     31      63
 
1993
def                                     @arg17  8       20      0       Y       32928   0       63
 
1994
def                                     @arg18  8       20      0       Y       32896   0       63
 
1995
def                                     @arg19  8       20      0       Y       32896   0       63
 
1996
def                                     @arg20  251     16777216        0       Y       0       31      8
 
1997
def                                     @arg21  251     16777216        0       Y       0       31      8
 
1998
def                                     @arg22  251     16777216        0       Y       0       31      8
 
1999
def                                     @arg23  251     16777216        0       Y       128     31      63
 
2000
def                                     @arg24  251     16777216        0       Y       0       31      8
 
2001
def                                     @arg25  251     16777216        0       Y       128     31      63
 
2002
def                                     @arg26  251     16777216        0       Y       0       31      8
 
2003
def                                     @arg27  251     16777216        0       Y       128     31      63
 
2004
def                                     @arg28  251     16777216        0       Y       0       31      8
 
2005
def                                     @arg29  251     16777216        0       Y       128     31      63
 
2006
def                                     @arg30  251     16777216        0       Y       0       31      8
 
2007
def                                     @arg31  251     16777216        0       Y       0       31      8
 
2008
def                                     @arg32  251     16777216        0       Y       0       31      8
 
2009
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
2010
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2011
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
 
2012
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
 
2013
test_sequence
 
2014
------ select column, .. into @parm,.. ------
 
2015
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
2016
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
2017
c25, c26, c27, c28, c29, c30, c31, c32
 
2018
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
2019
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
2020
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
2021
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
2022
from t9 where c1= 1 ;
 
2023
execute full_info ;
 
2024
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
2025
def                                     @arg01  8       20      1       Y       32896   0       63
 
2026
def                                     @arg02  8       20      1       Y       32896   0       63
 
2027
def                                     @arg03  8       20      1       Y       32896   0       63
 
2028
def                                     @arg04  8       20      1       Y       32896   0       63
 
2029
def                                     @arg05  8       20      1       Y       32896   0       63
 
2030
def                                     @arg06  8       20      1       Y       32896   0       63
 
2031
def                                     @arg07  5       23      1       Y       32896   31      63
 
2032
def                                     @arg08  5       23      1       Y       32896   31      63
 
2033
def                                     @arg09  5       23      1       Y       32896   31      63
 
2034
def                                     @arg10  5       23      1       Y       32896   31      63
 
2035
def                                     @arg11  246     83      6       Y       128     30      63
 
2036
def                                     @arg12  246     83      6       Y       128     30      63
 
2037
def                                     @arg13  251     16777216        10      Y       128     31      63
 
2038
def                                     @arg14  251     16777216        19      Y       128     31      63
 
2039
def                                     @arg15  251     16777216        19      Y       128     31      63
 
2040
def                                     @arg16  251     16777216        8       Y       128     31      63
 
2041
def                                     @arg17  8       20      4       Y       32928   0       63
 
2042
def                                     @arg18  8       20      1       Y       32896   0       63
 
2043
def                                     @arg19  8       20      1       Y       32896   0       63
 
2044
def                                     @arg20  251     16777216        1       Y       0       31      8
 
2045
def                                     @arg21  251     16777216        10      Y       0       31      8
 
2046
def                                     @arg22  251     16777216        30      Y       0       31      8
 
2047
def                                     @arg23  251     16777216        8       Y       128     31      63
 
2048
def                                     @arg24  251     16777216        8       Y       0       31      8
 
2049
def                                     @arg25  251     16777216        4       Y       128     31      63
 
2050
def                                     @arg26  251     16777216        4       Y       0       31      8
 
2051
def                                     @arg27  251     16777216        10      Y       128     31      63
 
2052
def                                     @arg28  251     16777216        10      Y       0       31      8
 
2053
def                                     @arg29  251     16777216        8       Y       128     31      63
 
2054
def                                     @arg30  251     16777216        8       Y       0       31      8
 
2055
def                                     @arg31  251     16777216        3       Y       0       31      8
 
2056
def                                     @arg32  251     16777216        6       Y       0       31      8
 
2057
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
2058
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
2059
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
2060
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
2061
c25, c26, c27, c28, c29, c30, c31, c32
 
2062
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
2063
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
2064
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
2065
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
2066
from t9 where c1= 0 ;
 
2067
execute full_info ;
 
2068
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
2069
def                                     @arg01  8       20      1       Y       32896   0       63
 
2070
def                                     @arg02  8       20      0       Y       32896   0       63
 
2071
def                                     @arg03  8       20      0       Y       32896   0       63
 
2072
def                                     @arg04  8       20      0       Y       32896   0       63
 
2073
def                                     @arg05  8       20      0       Y       32896   0       63
 
2074
def                                     @arg06  8       20      0       Y       32896   0       63
 
2075
def                                     @arg07  5       23      0       Y       32896   31      63
 
2076
def                                     @arg08  5       23      0       Y       32896   31      63
 
2077
def                                     @arg09  5       23      0       Y       32896   31      63
 
2078
def                                     @arg10  5       23      0       Y       32896   31      63
 
2079
def                                     @arg11  246     83      0       Y       128     30      63
 
2080
def                                     @arg12  246     83      0       Y       128     30      63
 
2081
def                                     @arg13  251     16777216        0       Y       128     31      63
 
2082
def                                     @arg14  251     16777216        0       Y       128     31      63
 
2083
def                                     @arg15  251     16777216        19      Y       128     31      63
 
2084
def                                     @arg16  251     16777216        0       Y       128     31      63
 
2085
def                                     @arg17  8       20      0       Y       32928   0       63
 
2086
def                                     @arg18  8       20      0       Y       32896   0       63
 
2087
def                                     @arg19  8       20      0       Y       32896   0       63
 
2088
def                                     @arg20  251     16777216        0       Y       0       31      8
 
2089
def                                     @arg21  251     16777216        0       Y       0       31      8
 
2090
def                                     @arg22  251     16777216        0       Y       0       31      8
 
2091
def                                     @arg23  251     16777216        0       Y       128     31      63
 
2092
def                                     @arg24  251     16777216        0       Y       0       31      8
 
2093
def                                     @arg25  251     16777216        0       Y       128     31      63
 
2094
def                                     @arg26  251     16777216        0       Y       0       31      8
 
2095
def                                     @arg27  251     16777216        0       Y       128     31      63
 
2096
def                                     @arg28  251     16777216        0       Y       0       31      8
 
2097
def                                     @arg29  251     16777216        0       Y       128     31      63
 
2098
def                                     @arg30  251     16777216        0       Y       0       31      8
 
2099
def                                     @arg31  251     16777216        0       Y       0       31      8
 
2100
def                                     @arg32  251     16777216        0       Y       0       31      8
 
2101
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
2102
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2103
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
2104
       c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
2105
       c25, c26, c27, c28, c29, c30, c31, c32
 
2106
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
2107
     @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
2108
     @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
2109
     @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
2110
from t9 where c1= ?" ;
 
2111
set @my_key= 1 ;
 
2112
execute stmt1 using @my_key ;
 
2113
execute full_info ;
 
2114
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
2115
def                                     @arg01  8       20      1       Y       32896   0       63
 
2116
def                                     @arg02  8       20      1       Y       32896   0       63
 
2117
def                                     @arg03  8       20      1       Y       32896   0       63
 
2118
def                                     @arg04  8       20      1       Y       32896   0       63
 
2119
def                                     @arg05  8       20      1       Y       32896   0       63
 
2120
def                                     @arg06  8       20      1       Y       32896   0       63
 
2121
def                                     @arg07  5       23      1       Y       32896   31      63
 
2122
def                                     @arg08  5       23      1       Y       32896   31      63
 
2123
def                                     @arg09  5       23      1       Y       32896   31      63
 
2124
def                                     @arg10  5       23      1       Y       32896   31      63
 
2125
def                                     @arg11  246     83      6       Y       128     30      63
 
2126
def                                     @arg12  246     83      6       Y       128     30      63
 
2127
def                                     @arg13  251     16777216        10      Y       128     31      63
 
2128
def                                     @arg14  251     16777216        19      Y       128     31      63
 
2129
def                                     @arg15  251     16777216        19      Y       128     31      63
 
2130
def                                     @arg16  251     16777216        8       Y       128     31      63
 
2131
def                                     @arg17  8       20      4       Y       32928   0       63
 
2132
def                                     @arg18  8       20      1       Y       32896   0       63
 
2133
def                                     @arg19  8       20      1       Y       32896   0       63
 
2134
def                                     @arg20  251     16777216        1       Y       0       31      8
 
2135
def                                     @arg21  251     16777216        10      Y       0       31      8
 
2136
def                                     @arg22  251     16777216        30      Y       0       31      8
 
2137
def                                     @arg23  251     16777216        8       Y       128     31      63
 
2138
def                                     @arg24  251     16777216        8       Y       0       31      8
 
2139
def                                     @arg25  251     16777216        4       Y       128     31      63
 
2140
def                                     @arg26  251     16777216        4       Y       0       31      8
 
2141
def                                     @arg27  251     16777216        10      Y       128     31      63
 
2142
def                                     @arg28  251     16777216        10      Y       0       31      8
 
2143
def                                     @arg29  251     16777216        8       Y       128     31      63
 
2144
def                                     @arg30  251     16777216        8       Y       0       31      8
 
2145
def                                     @arg31  251     16777216        3       Y       0       31      8
 
2146
def                                     @arg32  251     16777216        6       Y       0       31      8
 
2147
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
2148
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
2149
set @my_key= 0 ;
 
2150
execute stmt1 using @my_key ;
 
2151
execute full_info ;
 
2152
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
2153
def                                     @arg01  8       20      1       Y       32896   0       63
 
2154
def                                     @arg02  8       20      0       Y       32896   0       63
 
2155
def                                     @arg03  8       20      0       Y       32896   0       63
 
2156
def                                     @arg04  8       20      0       Y       32896   0       63
 
2157
def                                     @arg05  8       20      0       Y       32896   0       63
 
2158
def                                     @arg06  8       20      0       Y       32896   0       63
 
2159
def                                     @arg07  5       23      0       Y       32896   31      63
 
2160
def                                     @arg08  5       23      0       Y       32896   31      63
 
2161
def                                     @arg09  5       23      0       Y       32896   31      63
 
2162
def                                     @arg10  5       23      0       Y       32896   31      63
 
2163
def                                     @arg11  246     83      0       Y       128     30      63
 
2164
def                                     @arg12  246     83      0       Y       128     30      63
 
2165
def                                     @arg13  251     16777216        0       Y       128     31      63
 
2166
def                                     @arg14  251     16777216        0       Y       128     31      63
 
2167
def                                     @arg15  251     16777216        19      Y       128     31      63
 
2168
def                                     @arg16  251     16777216        0       Y       128     31      63
 
2169
def                                     @arg17  8       20      0       Y       32928   0       63
 
2170
def                                     @arg18  8       20      0       Y       32896   0       63
 
2171
def                                     @arg19  8       20      0       Y       32896   0       63
 
2172
def                                     @arg20  251     16777216        0       Y       0       31      8
 
2173
def                                     @arg21  251     16777216        0       Y       0       31      8
 
2174
def                                     @arg22  251     16777216        0       Y       0       31      8
 
2175
def                                     @arg23  251     16777216        0       Y       128     31      63
 
2176
def                                     @arg24  251     16777216        0       Y       0       31      8
 
2177
def                                     @arg25  251     16777216        0       Y       128     31      63
 
2178
def                                     @arg26  251     16777216        0       Y       0       31      8
 
2179
def                                     @arg27  251     16777216        0       Y       128     31      63
 
2180
def                                     @arg28  251     16777216        0       Y       0       31      8
 
2181
def                                     @arg29  251     16777216        0       Y       128     31      63
 
2182
def                                     @arg30  251     16777216        0       Y       0       31      8
 
2183
def                                     @arg31  251     16777216        0       Y       0       31      8
 
2184
def                                     @arg32  251     16777216        0       Y       0       31      8
 
2185
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
2186
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2187
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
 
2188
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
 
2189
test_sequence
 
2190
-- insert into numeric columns --
 
2191
insert into t9 
 
2192
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2193
values
 
2194
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
 
2195
set @arg00= 21 ;
 
2196
insert into t9 
 
2197
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2198
values
 
2199
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2200
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2201
prepare stmt1 from "insert into t9 
 
2202
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2203
values
 
2204
  ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
 
2205
execute stmt1 ;
 
2206
set @arg00= 23;
 
2207
prepare stmt2 from "insert into t9 
 
2208
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2209
values 
 
2210
  (  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2211
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2212
@arg00, @arg00, @arg00, @arg00 ;
 
2213
insert into t9 
 
2214
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2215
values
 
2216
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
 
2217
30.0, 30.0, 30.0 ) ;
 
2218
set @arg00= 31.0 ;
 
2219
insert into t9 
 
2220
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2221
values
 
2222
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2223
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2224
prepare stmt1 from "insert into t9 
 
2225
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2226
values
 
2227
  ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
 
2228
    32.0, 32.0, 32.0 )" ;
 
2229
execute stmt1 ;
 
2230
set @arg00= 33.0;
 
2231
prepare stmt2 from "insert into t9 
 
2232
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2233
values 
 
2234
  (  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
 
2235
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2236
@arg00, @arg00, @arg00, @arg00 ;
 
2237
insert into t9 
 
2238
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2239
values
 
2240
( '40', '40', '40', '40', '40', '40', '40', '40',
 
2241
'40', '40', '40' ) ;
 
2242
set @arg00= '41' ;
 
2243
insert into t9 
 
2244
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2245
values
 
2246
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2247
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2248
prepare stmt1 from "insert into t9 
 
2249
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2250
values
 
2251
  ( '42', '42', '42', '42', '42', '42', '42', '42',
 
2252
    '42', '42', '42' )" ;
 
2253
execute stmt1 ;
 
2254
set @arg00= '43';
 
2255
prepare stmt2 from "insert into t9 
 
2256
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2257
values 
 
2258
  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2259
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2260
@arg00, @arg00, @arg00, @arg00 ;
 
2261
insert into t9 
 
2262
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2263
values
 
2264
( CAST('50' as binary), CAST('50' as binary), 
 
2265
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 
 
2266
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
 
2267
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
 
2268
set @arg00= CAST('51' as binary) ;
 
2269
insert into t9 
 
2270
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2271
values
 
2272
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2273
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2274
prepare stmt1 from "insert into t9 
 
2275
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2276
values
 
2277
  ( CAST('52' as binary), CAST('52' as binary),
 
2278
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 
 
2279
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
 
2280
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
 
2281
execute stmt1 ;
 
2282
set @arg00= CAST('53' as binary) ;
 
2283
prepare stmt2 from "insert into t9 
 
2284
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2285
values 
 
2286
  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2287
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2288
@arg00, @arg00, @arg00, @arg00 ;
 
2289
set @arg00= 2 ;
 
2290
set @arg00= NULL ;
 
2291
insert into t9
 
2292
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2293
values
 
2294
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
2295
NULL, NULL, NULL ) ;
 
2296
insert into t9
 
2297
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2298
values
 
2299
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2300
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2301
prepare stmt1 from "insert into t9
 
2302
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2303
values
 
2304
  ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
2305
    NULL, NULL, NULL )" ;
 
2306
execute stmt1 ;
 
2307
prepare stmt2 from "insert into t9
 
2308
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2309
values
 
2310
  ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2311
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2312
@arg00, @arg00, @arg00, @arg00 ;
 
2313
set @arg00= 8.0 ;
 
2314
set @arg00= NULL ;
 
2315
insert into t9
 
2316
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2317
values
 
2318
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2319
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2320
prepare stmt2 from "insert into t9
 
2321
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2322
values
 
2323
  ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2324
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2325
@arg00, @arg00, @arg00, @arg00 ;
 
2326
set @arg00= 'abc' ;
 
2327
set @arg00= NULL ;
 
2328
insert into t9
 
2329
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2330
values
 
2331
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2332
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
2333
prepare stmt2 from "insert into t9
 
2334
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2335
values
 
2336
  ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
2337
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2338
@arg00, @arg00, @arg00, @arg00 ;
 
2339
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
 
2340
from t9 where c1 >= 20
 
2341
order by c1 ;
 
2342
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c12
 
2343
20      20      20      20      20      20      20      20      20      20      20.0000
 
2344
21      21      21      21      21      21      21      21      21      21      21.0000
 
2345
22      22      22      22      22      22      22      22      22      22      22.0000
 
2346
23      23      23      23      23      23      23      23      23      23      23.0000
 
2347
30      30      30      30      30      30      30      30      30      30      30.0000
 
2348
31      31      31      31      31      31      31      31      31      31      31.0000
 
2349
32      32      32      32      32      32      32      32      32      32      32.0000
 
2350
33      33      33      33      33      33      33      33      33      33      33.0000
 
2351
40      40      40      40      40      40      40      40      40      40      40.0000
 
2352
41      41      41      41      41      41      41      41      41      41      41.0000
 
2353
42      42      42      42      42      42      42      42      42      42      42.0000
 
2354
43      43      43      43      43      43      43      43      43      43      43.0000
 
2355
50      50      50      50      50      50      50      50      50      50      50.0000
 
2356
51      51      51      51      51      51      51      51      51      51      51.0000
 
2357
52      52      52      52      52      52      52      52      52      52      52.0000
 
2358
53      53      53      53      53      53      53      53      53      53      53.0000
 
2359
60      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2360
61      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2361
62      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2362
63      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2363
71      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2364
73      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2365
81      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2366
83      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2367
test_sequence
 
2368
-- select .. where numeric column = .. --
 
2369
set @arg00= 20;
 
2370
select 'true' as found from t9 
 
2371
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
 
2372
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
 
2373
found
 
2374
true
 
2375
select 'true' as found from t9 
 
2376
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
2377
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
2378
and c12= @arg00;
 
2379
found
 
2380
true
 
2381
prepare stmt1 from "select 'true' as found from t9 
 
2382
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
 
2383
  and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
 
2384
execute stmt1 ;
 
2385
found
 
2386
true
 
2387
prepare stmt1 from "select 'true' as found from t9 
 
2388
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
2389
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
2390
  and c12= ? ";
 
2391
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2392
@arg00, @arg00, @arg00, @arg00 ;
 
2393
found
 
2394
true
 
2395
set @arg00= 20.0;
 
2396
select 'true' as found from t9 
 
2397
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
 
2398
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
 
2399
found
 
2400
true
 
2401
select 'true' as found from t9 
 
2402
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
2403
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
2404
and c12= @arg00;
 
2405
found
 
2406
true
 
2407
prepare stmt1 from "select 'true' as found from t9 
 
2408
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
 
2409
  and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
 
2410
execute stmt1 ;
 
2411
found
 
2412
true
 
2413
prepare stmt1 from "select 'true' as found from t9 
 
2414
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
2415
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
2416
  and c12= ? ";
 
2417
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2418
@arg00, @arg00, @arg00, @arg00 ;
 
2419
found
 
2420
true
 
2421
select 'true' as found from t9 
 
2422
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
 
2423
  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
 
2424
found
 
2425
true
 
2426
prepare stmt1 from "select 'true' as found from t9
 
2427
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
 
2428
  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
 
2429
execute stmt1 ;
 
2430
found
 
2431
true
 
2432
set @arg00= '20';
 
2433
select 'true' as found from t9 
 
2434
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
2435
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
2436
and c12= @arg00;
 
2437
found
 
2438
true
 
2439
prepare stmt1 from "select 'true' as found from t9 
 
2440
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
2441
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
2442
  and c12= ? ";
 
2443
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2444
@arg00, @arg00, @arg00, @arg00 ;
 
2445
found
 
2446
true
 
2447
select 'true' as found from t9 
 
2448
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 
 
2449
c3= CAST('20' as binary) and c4= CAST('20' as binary) and 
 
2450
c5= CAST('20' as binary) and c6= CAST('20' as binary) and 
 
2451
c7= CAST('20' as binary) and c8= CAST('20' as binary) and 
 
2452
c9= CAST('20' as binary) and c10= CAST('20' as binary) and 
 
2453
c12= CAST('20' as binary);
 
2454
found
 
2455
true
 
2456
prepare stmt1 from "select 'true' as found from t9
 
2457
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 
 
2458
      c3= CAST('20' as binary) and c4= CAST('20' as binary) and 
 
2459
      c5= CAST('20' as binary) and c6= CAST('20' as binary) and 
 
2460
      c7= CAST('20' as binary) and c8= CAST('20' as binary) and 
 
2461
      c9= CAST('20' as binary) and c10= CAST('20' as binary) and 
 
2462
      c12= CAST('20' as binary) ";
 
2463
execute stmt1 ;
 
2464
found
 
2465
true
 
2466
set @arg00= CAST('20' as binary) ;
 
2467
select 'true' as found from t9 
 
2468
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
2469
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
2470
and c12= @arg00;
 
2471
found
 
2472
true
 
2473
prepare stmt1 from "select 'true' as found from t9 
 
2474
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
2475
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
2476
  and c12= ? ";
 
2477
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2478
@arg00, @arg00, @arg00, @arg00 ;
 
2479
found
 
2480
true
 
2481
delete from t9 ;
 
2482
test_sequence
 
2483
-- some numeric overflow experiments --
 
2484
prepare my_insert from "insert into t9 
 
2485
   ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
2486
values 
 
2487
   ( 'O',  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
 
2488
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
 
2489
from t9 where c21 = 'O' ";
 
2490
prepare my_delete from "delete from t9 where c21 = 'O' ";
 
2491
set @arg00= 9223372036854775807 ;
 
2492
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2493
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2494
Warnings:
 
2495
Warning 1264    Out of range value for column 'c1' at row 1
 
2496
Warning 1264    Out of range value for column 'c2' at row 1
 
2497
Warning 1264    Out of range value for column 'c3' at row 1
 
2498
Warning 1264    Out of range value for column 'c4' at row 1
 
2499
Warning 1264    Out of range value for column 'c5' at row 1
 
2500
Warning 1264    Out of range value for column 'c12' at row 1
 
2501
execute my_select ;
 
2502
c1      127
 
2503
c2      32767
 
2504
c3      8388607
 
2505
c4      2147483647
 
2506
c5      2147483647
 
2507
c6      9223372036854775807
 
2508
c7      9.22337e+18
 
2509
c8      9.22337203685478e+18
 
2510
c9      9.22337203685478e+18
 
2511
c10     9.22337203685478e+18
 
2512
c12     9999.9999
 
2513
execute my_delete ;
 
2514
set @arg00= '9223372036854775807' ;
 
2515
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2516
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2517
Warnings:
 
2518
Warning 1264    Out of range value for column 'c1' at row 1
 
2519
Warning 1264    Out of range value for column 'c2' at row 1
 
2520
Warning 1264    Out of range value for column 'c3' at row 1
 
2521
Warning 1264    Out of range value for column 'c4' at row 1
 
2522
Warning 1264    Out of range value for column 'c5' at row 1
 
2523
Warning 1264    Out of range value for column 'c12' at row 1
 
2524
execute my_select ;
 
2525
c1      127
 
2526
c2      32767
 
2527
c3      8388607
 
2528
c4      2147483647
 
2529
c5      2147483647
 
2530
c6      9223372036854775807
 
2531
c7      9.22337e+18
 
2532
c8      9.22337203685478e+18
 
2533
c9      9.22337203685478e+18
 
2534
c10     9.22337203685478e+18
 
2535
c12     9999.9999
 
2536
execute my_delete ;
 
2537
set @arg00= -9223372036854775808 ;
 
2538
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2539
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2540
Warnings:
 
2541
Warning 1264    Out of range value for column 'c1' at row 1
 
2542
Warning 1264    Out of range value for column 'c2' at row 1
 
2543
Warning 1264    Out of range value for column 'c3' at row 1
 
2544
Warning 1264    Out of range value for column 'c4' at row 1
 
2545
Warning 1264    Out of range value for column 'c5' at row 1
 
2546
Warning 1264    Out of range value for column 'c12' at row 1
 
2547
execute my_select ;
 
2548
c1      -128
 
2549
c2      -32768
 
2550
c3      -8388608
 
2551
c4      -2147483648
 
2552
c5      -2147483648
 
2553
c6      -9223372036854775808
 
2554
c7      -9.22337e+18
 
2555
c8      -9.22337203685478e+18
 
2556
c9      -9.22337203685478e+18
 
2557
c10     -9.22337203685478e+18
 
2558
c12     -9999.9999
 
2559
execute my_delete ;
 
2560
set @arg00= '-9223372036854775808' ;
 
2561
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2562
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2563
Warnings:
 
2564
Warning 1264    Out of range value for column 'c1' at row 1
 
2565
Warning 1264    Out of range value for column 'c2' at row 1
 
2566
Warning 1264    Out of range value for column 'c3' at row 1
 
2567
Warning 1264    Out of range value for column 'c4' at row 1
 
2568
Warning 1264    Out of range value for column 'c5' at row 1
 
2569
Warning 1264    Out of range value for column 'c12' at row 1
 
2570
execute my_select ;
 
2571
c1      -128
 
2572
c2      -32768
 
2573
c3      -8388608
 
2574
c4      -2147483648
 
2575
c5      -2147483648
 
2576
c6      -9223372036854775808
 
2577
c7      -9.22337e+18
 
2578
c8      -9.22337203685478e+18
 
2579
c9      -9.22337203685478e+18
 
2580
c10     -9.22337203685478e+18
 
2581
c12     -9999.9999
 
2582
execute my_delete ;
 
2583
set @arg00= 1.11111111111111111111e+50 ;
 
2584
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2585
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2586
Warnings:
 
2587
Warning 1264    Out of range value for column 'c1' at row 1
 
2588
Warning 1264    Out of range value for column 'c2' at row 1
 
2589
Warning 1264    Out of range value for column 'c3' at row 1
 
2590
Warning 1264    Out of range value for column 'c4' at row 1
 
2591
Warning 1264    Out of range value for column 'c5' at row 1
 
2592
Warning 1264    Out of range value for column 'c6' at row 1
 
2593
Warning 1264    Out of range value for column 'c7' at row 1
 
2594
Warning 1264    Out of range value for column 'c12' at row 1
 
2595
execute my_select ;
 
2596
c1      127
 
2597
c2      32767
 
2598
c3      8388607
 
2599
c4      2147483647
 
2600
c5      2147483647
 
2601
c6      9223372036854775807
 
2602
c7      3.40282e+38
 
2603
c8      1.11111111111111e+50
 
2604
c9      1.11111111111111e+50
 
2605
c10     1.11111111111111e+50
 
2606
c12     9999.9999
 
2607
execute my_delete ;
 
2608
set @arg00= '1.11111111111111111111e+50' ;
 
2609
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2610
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2611
Warnings:
 
2612
Warning 1264    Out of range value for column 'c1' at row 1
 
2613
Warning 1264    Out of range value for column 'c2' at row 1
 
2614
Warning 1264    Out of range value for column 'c3' at row 1
 
2615
Warning 1264    Out of range value for column 'c4' at row 1
 
2616
Warning 1264    Out of range value for column 'c5' at row 1
 
2617
Warning 1264    Out of range value for column 'c6' at row 1
 
2618
Warning 1264    Out of range value for column 'c7' at row 1
 
2619
Warning 1264    Out of range value for column 'c12' at row 1
 
2620
execute my_select ;
 
2621
c1      127
 
2622
c2      32767
 
2623
c3      8388607
 
2624
c4      2147483647
 
2625
c5      2147483647
 
2626
c6      9223372036854775807
 
2627
c7      3.40282e+38
 
2628
c8      1.11111111111111e+50
 
2629
c9      1.11111111111111e+50
 
2630
c10     1.11111111111111e+50
 
2631
c12     9999.9999
 
2632
execute my_delete ;
 
2633
set @arg00= -1.11111111111111111111e+50 ;
 
2634
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2635
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2636
Warnings:
 
2637
Warning 1264    Out of range value for column 'c1' at row 1
 
2638
Warning 1264    Out of range value for column 'c2' at row 1
 
2639
Warning 1264    Out of range value for column 'c3' at row 1
 
2640
Warning 1264    Out of range value for column 'c4' at row 1
 
2641
Warning 1264    Out of range value for column 'c5' at row 1
 
2642
Warning 1264    Out of range value for column 'c6' at row 1
 
2643
Warning 1264    Out of range value for column 'c7' at row 1
 
2644
Warning 1264    Out of range value for column 'c12' at row 1
 
2645
execute my_select ;
 
2646
c1      -128
 
2647
c2      -32768
 
2648
c3      -8388608
 
2649
c4      -2147483648
 
2650
c5      -2147483648
 
2651
c6      -9223372036854775808
 
2652
c7      -3.40282e+38
 
2653
c8      -1.11111111111111e+50
 
2654
c9      -1.11111111111111e+50
 
2655
c10     -1.11111111111111e+50
 
2656
c12     -9999.9999
 
2657
execute my_delete ;
 
2658
set @arg00= '-1.11111111111111111111e+50' ;
 
2659
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
2660
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2661
Warnings:
 
2662
Warning 1264    Out of range value for column 'c1' at row 1
 
2663
Warning 1264    Out of range value for column 'c2' at row 1
 
2664
Warning 1264    Out of range value for column 'c3' at row 1
 
2665
Warning 1264    Out of range value for column 'c4' at row 1
 
2666
Warning 1264    Out of range value for column 'c5' at row 1
 
2667
Warning 1264    Out of range value for column 'c6' at row 1
 
2668
Warning 1264    Out of range value for column 'c7' at row 1
 
2669
Warning 1264    Out of range value for column 'c12' at row 1
 
2670
execute my_select ;
 
2671
c1      -128
 
2672
c2      -32768
 
2673
c3      -8388608
 
2674
c4      -2147483648
 
2675
c5      -2147483648
 
2676
c6      -9223372036854775808
 
2677
c7      -3.40282e+38
 
2678
c8      -1.11111111111111e+50
 
2679
c9      -1.11111111111111e+50
 
2680
c10     -1.11111111111111e+50
 
2681
c12     -9999.9999
 
2682
execute my_delete ;
 
2683
test_sequence
 
2684
-- insert into string columns --
 
2685
Warnings:
 
2686
Warning 1265    Data truncated for column 'c20' at row 1
 
2687
Warnings:
 
2688
Warning 1265    Data truncated for column 'c20' at row 1
 
2689
Warnings:
 
2690
Warning 1265    Data truncated for column 'c20' at row 1
 
2691
Warnings:
 
2692
Warning 1265    Data truncated for column 'c20' at row 1
 
2693
Warnings:
 
2694
Warning 1265    Data truncated for column 'c20' at row 1
 
2695
Warnings:
 
2696
Warning 1265    Data truncated for column 'c20' at row 1
 
2697
Warnings:
 
2698
Warning 1265    Data truncated for column 'c20' at row 1
 
2699
Warnings:
 
2700
Warning 1265    Data truncated for column 'c20' at row 1
 
2701
Warnings:
 
2702
Warning 1265    Data truncated for column 'c20' at row 1
 
2703
Warnings:
 
2704
Warning 1265    Data truncated for column 'c20' at row 1
 
2705
Warnings:
 
2706
Warning 1265    Data truncated for column 'c20' at row 1
 
2707
Warnings:
 
2708
Warning 1265    Data truncated for column 'c20' at row 1
 
2709
Warnings:
 
2710
Warning 1265    Data truncated for column 'c20' at row 1
 
2711
Warnings:
 
2712
Warning 1265    Data truncated for column 'c20' at row 1
 
2713
Warnings:
 
2714
Warning 1265    Data truncated for column 'c20' at row 1
 
2715
Warnings:
 
2716
Warning 1265    Data truncated for column 'c20' at row 1
 
2717
Warnings:
 
2718
Warning 1265    Data truncated for column 'c20' at row 1
 
2719
Warnings:
 
2720
Warning 1265    Data truncated for column 'c20' at row 1
 
2721
Warnings:
 
2722
Warning 1265    Data truncated for column 'c20' at row 1
 
2723
Warnings:
 
2724
Warning 1265    Data truncated for column 'c20' at row 1
 
2725
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
 
2726
from t9 where c1 >= 20
 
2727
order by c1 ;
 
2728
c1      c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30
 
2729
20      2       20      20      20      20      20      20      20      20      20      20
 
2730
21      2       21      21      21      21      21      21      21      21      21      21
 
2731
22      2       22      22      22      22      22      22      22      22      22      22
 
2732
23      2       23      23      23      23      23      23      23      23      23      23
 
2733
30      3       30      30      30      30      30      30      30      30      30      30
 
2734
31      3       31      31      31      31      31      31      31      31      31      31
 
2735
32      3       32      32      32      32      32      32      32      32      32      32
 
2736
33      3       33      33      33      33      33      33      33      33      33      33
 
2737
40      4       40      40      40      40      40      40      40      40      40      40
 
2738
41      4       41      41      41      41      41      41      41      41      41      41
 
2739
42      4       42      42      42      42      42      42      42      42      42      42
 
2740
43      4       43      43      43      43      43      43      43      43      43      43
 
2741
50      5       50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0
 
2742
51      5       51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0
 
2743
52      5       52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0
 
2744
53      5       53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0
 
2745
54      5       54      54      54.00   54.00   54.00   54.00   54.00   54.00   54.00   54.00
 
2746
55      5       55      55      55      55      55      55      55      55      55      55
 
2747
56      6       56      56      56.00   56.00   56.00   56.00   56.00   56.00   56.00   56.00
 
2748
57      6       57      57      57.00   57.00   57.00   57.00   57.00   57.00   57.00   57.00
 
2749
60      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2750
61      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2751
62      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2752
63      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2753
71      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2754
73      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2755
81      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2756
83      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
2757
test_sequence
 
2758
-- select .. where string column = .. --
 
2759
set @arg00= '20';
 
2760
select 'true' as found from t9 
 
2761
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
 
2762
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
 
2763
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
 
2764
found
 
2765
true
 
2766
select 'true' as found from t9 
 
2767
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
2768
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
2769
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
2770
found
 
2771
true
 
2772
prepare stmt1 from "select 'true' as found from t9 
 
2773
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
 
2774
  c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
 
2775
  c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
 
2776
execute stmt1 ;
 
2777
found
 
2778
true
 
2779
prepare stmt1 from "select 'true' as found from t9 
 
2780
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
2781
  c21= ? and c22= ? and c23= ? and c25= ? and
 
2782
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
2783
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2784
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2785
found
 
2786
true
 
2787
set @arg00= CAST('20' as binary);
 
2788
select 'true' as found from t9 
 
2789
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
 
2790
= CAST('20' as binary) and c21= CAST('20' as binary)
 
2791
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
 
2792
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
 
2793
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
 
2794
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
 
2795
c30= CAST('20' as binary) ;
 
2796
found
 
2797
true
 
2798
select 'true' as found from t9 
 
2799
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
 
2800
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
2801
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
 
2802
c30= @arg00;
 
2803
found
 
2804
true
 
2805
prepare stmt1 from "select 'true' as found from t9 
 
2806
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
 
2807
                 = CAST('20' as binary) and c21= CAST('20' as binary)
 
2808
  and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
 
2809
  c24= CAST('20' as binary) and c25= CAST('20' as binary) and
 
2810
  c26= CAST('20' as binary) and c27= CAST('20' as binary) and
 
2811
  c28= CAST('20' as binary) and c29= CAST('20' as binary) and
 
2812
  c30= CAST('20' as binary)" ;
 
2813
execute stmt1 ;
 
2814
found
 
2815
true
 
2816
prepare stmt1 from "select 'true' as found from t9 
 
2817
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
 
2818
  c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
 
2819
  c29= ? and c30= ?";
 
2820
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2821
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2822
found
 
2823
true
 
2824
set @arg00= 20;
 
2825
select 'true' as found from t9 
 
2826
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
 
2827
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
 
2828
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
 
2829
found
 
2830
true
 
2831
select 'true' as found from t9 
 
2832
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
2833
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
2834
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
2835
found
 
2836
true
 
2837
prepare stmt1 from "select 'true' as found from t9 
 
2838
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
 
2839
  c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
 
2840
  c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
 
2841
execute stmt1 ;
 
2842
found
 
2843
true
 
2844
prepare stmt1 from "select 'true' as found from t9 
 
2845
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
2846
  c21= ? and c22= ? and c23= ? and c25= ? and
 
2847
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
2848
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2849
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2850
found
 
2851
true
 
2852
set @arg00= 20.0;
 
2853
select 'true' as found from t9 
 
2854
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
 
2855
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
 
2856
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
 
2857
found
 
2858
true
 
2859
select 'true' as found from t9 
 
2860
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
2861
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
2862
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
2863
found
 
2864
true
 
2865
prepare stmt1 from "select 'true' as found from t9 
 
2866
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
 
2867
  c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
 
2868
  c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
 
2869
execute stmt1 ;
 
2870
found
 
2871
true
 
2872
prepare stmt1 from "select 'true' as found from t9 
 
2873
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
2874
  c21= ? and c22= ? and c23= ? and c25= ? and
 
2875
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
2876
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
2877
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2878
found
 
2879
true
 
2880
delete from t9 ;
 
2881
test_sequence
 
2882
-- insert into date/time columns --
 
2883
Warnings:
 
2884
Note    1265    Data truncated for column 'c13' at row 1
 
2885
Warning 1265    Data truncated for column 'c17' at row 1
 
2886
Warnings:
 
2887
Note    1265    Data truncated for column 'c13' at row 1
 
2888
Warning 1265    Data truncated for column 'c17' at row 1
 
2889
Warnings:
 
2890
Note    1265    Data truncated for column 'c13' at row 1
 
2891
Warning 1265    Data truncated for column 'c17' at row 1
 
2892
Warnings:
 
2893
Note    1265    Data truncated for column 'c13' at row 1
 
2894
Warning 1265    Data truncated for column 'c17' at row 1
 
2895
Warnings:
 
2896
Note    1265    Data truncated for column 'c13' at row 1
 
2897
Warning 1265    Data truncated for column 'c17' at row 1
 
2898
Warnings:
 
2899
Note    1265    Data truncated for column 'c13' at row 1
 
2900
Warning 1265    Data truncated for column 'c17' at row 1
 
2901
Warnings:
 
2902
Note    1265    Data truncated for column 'c13' at row 1
 
2903
Warning 1265    Data truncated for column 'c17' at row 1
 
2904
Warnings:
 
2905
Note    1265    Data truncated for column 'c13' at row 1
 
2906
Warning 1265    Data truncated for column 'c17' at row 1
 
2907
Warnings:
 
2908
Warning 1264    Out of range value for column 'c13' at row 1
 
2909
Warning 1264    Out of range value for column 'c14' at row 1
 
2910
Warning 1265    Data truncated for column 'c15' at row 1
 
2911
Warning 1264    Out of range value for column 'c16' at row 1
 
2912
Warning 1264    Out of range value for column 'c17' at row 1
 
2913
Warnings:
 
2914
Warning 1264    Out of range value for column 'c13' at row 1
 
2915
Warning 1264    Out of range value for column 'c14' at row 1
 
2916
Warning 1265    Data truncated for column 'c15' at row 1
 
2917
Warning 1264    Out of range value for column 'c16' at row 1
 
2918
Warning 1264    Out of range value for column 'c17' at row 1
 
2919
Warnings:
 
2920
Warning 1264    Out of range value for column 'c13' at row 1
 
2921
Warning 1264    Out of range value for column 'c14' at row 1
 
2922
Warning 1265    Data truncated for column 'c15' at row 1
 
2923
Warning 1264    Out of range value for column 'c16' at row 1
 
2924
Warning 1264    Out of range value for column 'c17' at row 1
 
2925
Warnings:
 
2926
Warning 1264    Out of range value for column 'c13' at row 1
 
2927
Warning 1264    Out of range value for column 'c14' at row 1
 
2928
Warning 1265    Data truncated for column 'c15' at row 1
 
2929
Warning 1264    Out of range value for column 'c16' at row 1
 
2930
Warning 1264    Out of range value for column 'c17' at row 1
 
2931
Warnings:
 
2932
Warning 1265    Data truncated for column 'c15' at row 1
 
2933
Warning 1264    Out of range value for column 'c16' at row 1
 
2934
Warning 1264    Out of range value for column 'c17' at row 1
 
2935
Warnings:
 
2936
Warning 1265    Data truncated for column 'c15' at row 1
 
2937
Warning 1264    Out of range value for column 'c16' at row 1
 
2938
Warning 1264    Out of range value for column 'c17' at row 1
 
2939
Warnings:
 
2940
Warning 1265    Data truncated for column 'c15' at row 1
 
2941
Warning 1264    Out of range value for column 'c16' at row 1
 
2942
Warning 1264    Out of range value for column 'c17' at row 1
 
2943
Warnings:
 
2944
Warning 1265    Data truncated for column 'c15' at row 1
 
2945
Warning 1264    Out of range value for column 'c16' at row 1
 
2946
Warning 1264    Out of range value for column 'c17' at row 1
 
2947
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
 
2948
c1      c13     c14     c15     c16     c17
 
2949
20      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2950
21      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2951
22      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2952
23      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2953
30      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2954
31      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2955
32      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2956
33      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
2957
40      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2958
41      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2959
42      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2960
43      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2961
50      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2962
51      2010-00-00      2010-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2963
52      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2964
53      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
2965
60      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2966
61      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2967
62      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2968
63      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2969
71      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2970
73      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2971
81      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2972
83      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
2973
test_sequence
 
2974
-- select .. where date/time column = .. --
 
2975
set @arg00= '1991-01-01 01:01:01' ;
 
2976
select 'true' as found from t9 
 
2977
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
 
2978
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
 
2979
c17= '1991-01-01 01:01:01' ;
 
2980
found
 
2981
true
 
2982
select 'true' as found from t9 
 
2983
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
 
2984
and c17= @arg00 ;
 
2985
found
 
2986
true
 
2987
prepare stmt1 from "select 'true' as found from t9 
 
2988
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
 
2989
  c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
 
2990
  c17= '1991-01-01 01:01:01'" ;
 
2991
execute stmt1 ;
 
2992
found
 
2993
true
 
2994
prepare stmt1 from "select 'true' as found from t9 
 
2995
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
 
2996
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
 
2997
found
 
2998
true
 
2999
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
 
3000
select 'true' as found from t9 
 
3001
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
 
3002
c14= CAST('1991-01-01 01:01:01' as datetime) and
 
3003
c15= CAST('1991-01-01 01:01:01' as datetime) and
 
3004
c16= CAST('1991-01-01 01:01:01' as datetime) and
 
3005
c17= CAST('1991-01-01 01:01:01' as datetime) ;
 
3006
found
 
3007
true
 
3008
select 'true' as found from t9 
 
3009
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
 
3010
and c17= @arg00 ;
 
3011
found
 
3012
true
 
3013
prepare stmt1 from "select 'true' as found from t9 
 
3014
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
 
3015
  c14= CAST('1991-01-01 01:01:01' as datetime) and
 
3016
  c15= CAST('1991-01-01 01:01:01' as datetime) and
 
3017
  c16= CAST('1991-01-01 01:01:01' as datetime) and
 
3018
  c17= CAST('1991-01-01 01:01:01' as datetime)" ;
 
3019
execute stmt1 ;
 
3020
found
 
3021
true
 
3022
prepare stmt1 from "select 'true' as found from t9 
 
3023
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
 
3024
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
 
3025
found
 
3026
true
 
3027
set @arg00= 1991 ;
 
3028
select 'true' as found from t9 
 
3029
where c1= 20 and c17= 1991 ;
 
3030
found
 
3031
true
 
3032
select 'true' as found from t9 
 
3033
where c1= 20 and c17= @arg00 ;
 
3034
found
 
3035
true
 
3036
prepare stmt1 from "select 'true' as found from t9 
 
3037
where c1= 20 and c17= 1991" ;
 
3038
execute stmt1 ;
 
3039
found
 
3040
true
 
3041
prepare stmt1 from "select 'true' as found from t9
 
3042
where c1= 20 and c17= ?" ;
 
3043
execute stmt1 using @arg00 ;
 
3044
found
 
3045
true
 
3046
set @arg00= 1.991e+3 ;
 
3047
select 'true' as found from t9 
 
3048
where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
 
3049
found
 
3050
true
 
3051
select 'true' as found from t9 
 
3052
where c1= 20 and abs(c17 - @arg00) < 0.01 ;
 
3053
found
 
3054
true
 
3055
prepare stmt1 from "select 'true' as found from t9 
 
3056
where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
 
3057
execute stmt1 ;
 
3058
found
 
3059
true
 
3060
prepare stmt1 from "select 'true' as found from t9
 
3061
where c1= 20 and abs(c17 - ?) < 0.01" ;
 
3062
execute stmt1 using @arg00 ;
 
3063
found
 
3064
true
 
3065
drop table t1, t9 ;
 
3066
create table t1
 
3067
(
 
3068
a int, b varchar(30),
 
3069
primary key(a)
 
3070
) ENGINE = MERGE UNION=(t1_1,t1_2)
 
3071
INSERT_METHOD=LAST;
 
3072
create table t9
 
3073
(
 
3074
c1  tinyint, c2  smallint, c3  mediumint, c4  int,
 
3075
c5  integer, c6  bigint, c7  float, c8  double,
 
3076
c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
 
3077
c13 date, c14 datetime, c15 timestamp, c16 time,
 
3078
c17 year, c18 tinyint, c19 bool, c20 char,
 
3079
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
 
3080
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
 
3081
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
 
3082
c32 set('monday', 'tuesday', 'wednesday'),
 
3083
primary key(c1)
 
3084
)  ENGINE = MERGE UNION=(t9_1,t9_2)
 
3085
INSERT_METHOD=LAST;
 
3086
delete from t1 ;
 
3087
insert into t1 values (1,'one');
 
3088
insert into t1 values (2,'two');
 
3089
insert into t1 values (3,'three');
 
3090
insert into t1 values (4,'four');
 
3091
commit ;
 
3092
delete from t9 ;
 
3093
insert into t9
 
3094
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
3095
c10= 1, c11= 1, c12 = 1,
 
3096
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
3097
c16= '11:11:11', c17= '2004',
 
3098
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
3099
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
3100
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
3101
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
3102
insert into t9
 
3103
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
3104
c10= 9, c11= 9, c12 = 9,
 
3105
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
3106
c16= '11:11:11', c17= '2004',
 
3107
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
3108
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
3109
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
3110
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
3111
commit ;
 
3112
test_sequence
 
3113
------ simple select tests ------
 
3114
prepare stmt1 from ' select * from t9 order by c1 ' ;
 
3115
execute stmt1;
 
3116
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
3117
def     test    t9      t9      c1      c1      1       4       1       N       49155   0       63
 
3118
def     test    t9      t9      c2      c2      2       6       1       Y       32768   0       63
 
3119
def     test    t9      t9      c3      c3      9       9       1       Y       32768   0       63
 
3120
def     test    t9      t9      c4      c4      3       11      1       Y       32768   0       63
 
3121
def     test    t9      t9      c5      c5      3       11      1       Y       32768   0       63
 
3122
def     test    t9      t9      c6      c6      8       20      1       Y       32768   0       63
 
3123
def     test    t9      t9      c7      c7      4       12      1       Y       32768   31      63
 
3124
def     test    t9      t9      c8      c8      5       22      1       Y       32768   31      63
 
3125
def     test    t9      t9      c9      c9      5       22      1       Y       32768   31      63
 
3126
def     test    t9      t9      c10     c10     5       22      1       Y       32768   31      63
 
3127
def     test    t9      t9      c11     c11     246     9       6       Y       0       4       63
 
3128
def     test    t9      t9      c12     c12     246     10      6       Y       0       4       63
 
3129
def     test    t9      t9      c13     c13     10      10      10      Y       128     0       63
 
3130
def     test    t9      t9      c14     c14     12      19      19      Y       128     0       63
 
3131
def     test    t9      t9      c15     c15     7       19      19      N       9441    0       63
 
3132
def     test    t9      t9      c16     c16     11      8       8       Y       128     0       63
 
3133
def     test    t9      t9      c17     c17     13      4       4       Y       32864   0       63
 
3134
def     test    t9      t9      c18     c18     1       4       1       Y       32768   0       63
 
3135
def     test    t9      t9      c19     c19     1       1       1       Y       32768   0       63
 
3136
def     test    t9      t9      c20     c20     254     1       1       Y       0       0       8
 
3137
def     test    t9      t9      c21     c21     254     10      10      Y       0       0       8
 
3138
def     test    t9      t9      c22     c22     253     30      30      Y       0       0       8
 
3139
def     test    t9      t9      c23     c23     252     255     8       Y       144     0       63
 
3140
def     test    t9      t9      c24     c24     252     255     8       Y       16      0       8
 
3141
def     test    t9      t9      c25     c25     252     65535   4       Y       144     0       63
 
3142
def     test    t9      t9      c26     c26     252     65535   4       Y       16      0       8
 
3143
def     test    t9      t9      c27     c27     252     16777215        10      Y       144     0       63
 
3144
def     test    t9      t9      c28     c28     252     16777215        10      Y       16      0       8
 
3145
def     test    t9      t9      c29     c29     252     4294967295      8       Y       144     0       63
 
3146
def     test    t9      t9      c30     c30     252     4294967295      8       Y       16      0       8
 
3147
def     test    t9      t9      c31     c31     254     5       3       Y       256     0       8
 
3148
def     test    t9      t9      c32     c32     254     24      7       Y       2048    0       8
 
3149
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c11     c12     c13     c14     c15     c16     c17     c18     c19     c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30     c31     c32
 
3150
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
3151
9       9       9       9       9       9       9       9       9       9       9.0000  9.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       0       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        two     tuesday
 
3152
set @arg00='SELECT' ;
 
3153
@arg00 a from t1 where a=1;
 
3154
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
 
3155
prepare stmt1 from ' ? a from t1 where a=1 ';
 
3156
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
 
3157
set @arg00=1 ;
 
3158
select @arg00, b from t1 where a=1 ;
 
3159
@arg00  b
 
3160
1       one
 
3161
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
3162
execute stmt1 using @arg00 ;
 
3163
?       b
 
3164
1       one
 
3165
set @arg00='lion' ;
 
3166
select @arg00, b from t1 where a=1 ;
 
3167
@arg00  b
 
3168
lion    one
 
3169
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
3170
execute stmt1 using @arg00 ;
 
3171
?       b
 
3172
lion    one
 
3173
set @arg00=NULL ;
 
3174
select @arg00, b from t1 where a=1 ;
 
3175
@arg00  b
 
3176
NULL    one
 
3177
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
 
3178
execute stmt1 using @arg00 ;
 
3179
?       b
 
3180
NULL    one
 
3181
set @arg00=1 ;
 
3182
select b, a - @arg00 from t1 where a=1 ;
 
3183
b       a - @arg00
 
3184
one     0
 
3185
prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
 
3186
execute stmt1 using @arg00 ;
 
3187
b       a - ?
 
3188
one     0
 
3189
set @arg00=null ;
 
3190
select @arg00 as my_col ;
 
3191
my_col
 
3192
NULL
 
3193
prepare stmt1 from ' select ? as my_col';
 
3194
execute stmt1 using @arg00 ;
 
3195
my_col
 
3196
NULL
 
3197
select @arg00 + 1 as my_col ;
 
3198
my_col
 
3199
NULL
 
3200
prepare stmt1 from ' select ? + 1 as my_col';
 
3201
execute stmt1 using @arg00 ;
 
3202
my_col
 
3203
NULL
 
3204
select 1 + @arg00 as my_col ;
 
3205
my_col
 
3206
NULL
 
3207
prepare stmt1 from ' select 1 + ? as my_col';
 
3208
execute stmt1 using @arg00 ;
 
3209
my_col
 
3210
NULL
 
3211
set @arg00='MySQL' ;
 
3212
select substr(@arg00,1,2) from t1 where a=1 ;
 
3213
substr(@arg00,1,2)
 
3214
My
 
3215
prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
 
3216
execute stmt1 using @arg00 ;
 
3217
substr(?,1,2)
 
3218
My
 
3219
set @arg00=3 ;
 
3220
select substr('MySQL',@arg00,5) from t1 where a=1 ;
 
3221
substr('MySQL',@arg00,5)
 
3222
SQL
 
3223
prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
 
3224
execute stmt1 using @arg00 ;
 
3225
substr('MySQL',?,5)
 
3226
SQL
 
3227
select substr('MySQL',1,@arg00) from t1 where a=1 ;
 
3228
substr('MySQL',1,@arg00)
 
3229
MyS
 
3230
prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
 
3231
execute stmt1 using @arg00 ;
 
3232
substr('MySQL',1,?)
 
3233
MyS
 
3234
set @arg00='MySQL' ;
 
3235
select a , concat(@arg00,b) from t1 order by a;
 
3236
a       concat(@arg00,b)
 
3237
1       MySQLone
 
3238
2       MySQLtwo
 
3239
3       MySQLthree
 
3240
4       MySQLfour
 
3241
prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
 
3242
execute stmt1 using @arg00;
 
3243
a       concat(?,b)
 
3244
1       MySQLone
 
3245
2       MySQLtwo
 
3246
3       MySQLthree
 
3247
4       MySQLfour
 
3248
select a , concat(b,@arg00) from t1 order by a ;
 
3249
a       concat(b,@arg00)
 
3250
1       oneMySQL
 
3251
2       twoMySQL
 
3252
3       threeMySQL
 
3253
4       fourMySQL
 
3254
prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
 
3255
execute stmt1 using @arg00;
 
3256
a       concat(b,?)
 
3257
1       oneMySQL
 
3258
2       twoMySQL
 
3259
3       threeMySQL
 
3260
4       fourMySQL
 
3261
set @arg00='MySQL' ;
 
3262
select group_concat(@arg00,b order by a) from t1 
 
3263
group by 'a' ;
 
3264
group_concat(@arg00,b order by a)
 
3265
MySQLone,MySQLtwo,MySQLthree,MySQLfour
 
3266
prepare stmt1 from ' select group_concat(?,b order by a) from t1
 
3267
group by ''a'' ' ;
 
3268
execute stmt1 using @arg00;
 
3269
group_concat(?,b order by a)
 
3270
MySQLone,MySQLtwo,MySQLthree,MySQLfour
 
3271
select group_concat(b,@arg00 order by a) from t1 
 
3272
group by 'a' ;
 
3273
group_concat(b,@arg00 order by a)
 
3274
oneMySQL,twoMySQL,threeMySQL,fourMySQL
 
3275
prepare stmt1 from ' select group_concat(b,? order by a) from t1
 
3276
group by ''a'' ' ;
 
3277
execute stmt1 using @arg00;
 
3278
group_concat(b,? order by a)
 
3279
oneMySQL,twoMySQL,threeMySQL,fourMySQL
 
3280
set @arg00='first' ;
 
3281
set @arg01='second' ;
 
3282
set @arg02=NULL;
 
3283
select @arg00, @arg01 from t1 where a=1 ;
 
3284
@arg00  @arg01
 
3285
first   second
 
3286
prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
 
3287
execute stmt1 using @arg00, @arg01 ;
 
3288
?       ?
 
3289
first   second
 
3290
execute stmt1 using @arg02, @arg01 ;
 
3291
?       ?
 
3292
NULL    second
 
3293
execute stmt1 using @arg00, @arg02 ;
 
3294
?       ?
 
3295
first   NULL
 
3296
execute stmt1 using @arg02, @arg02 ;
 
3297
?       ?
 
3298
NULL    NULL
 
3299
drop table if exists t5 ;
 
3300
create table t5 (id1 int(11) not null default '0',
 
3301
value2 varchar(100), value1 varchar(100)) ;
 
3302
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
 
3303
(1,'ii','ii'),(2,'ii','ii') ;
 
3304
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
 
3305
set @arg00=1 ;
 
3306
set @arg01='hh' ;
 
3307
execute stmt1 using @arg00, @arg01 ;
 
3308
id1     value1
 
3309
1       hh
 
3310
1       ii
 
3311
2       hh
 
3312
drop table t5 ;
 
3313
drop table if exists t5 ;
 
3314
create table t5(session_id  char(9) not null) ;
 
3315
insert into t5 values ('abc') ;
 
3316
prepare stmt1 from ' select * from t5
 
3317
where ?=''1111'' and session_id = ''abc'' ' ;
 
3318
set @arg00='abc' ;
 
3319
execute stmt1 using @arg00 ;
 
3320
session_id
 
3321
set @arg00='1111' ;
 
3322
execute stmt1 using @arg00 ;
 
3323
session_id
 
3324
abc
 
3325
set @arg00='abc' ;
 
3326
execute stmt1 using @arg00 ;
 
3327
session_id
 
3328
drop table t5 ;
 
3329
set @arg00='FROM' ;
 
3330
select a @arg00 t1 where a=1 ;
 
3331
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
 
3332
prepare stmt1 from ' select a ? t1 where a=1 ' ;
 
3333
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
 
3334
set @arg00='t1' ;
 
3335
select a from @arg00 where a=1 ;
 
3336
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
 
3337
prepare stmt1 from ' select a from ? where a=1 ' ;
 
3338
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
 
3339
set @arg00='WHERE' ;
 
3340
select a from t1 @arg00 a=1 ;
 
3341
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
 
3342
prepare stmt1 from ' select a from t1 ? a=1 ' ;
 
3343
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
 
3344
set @arg00=1 ;
 
3345
select a FROM t1 where a=@arg00 ;
 
3346
a
 
3347
1
 
3348
prepare stmt1 from ' select a FROM t1 where a=? ' ;
 
3349
execute stmt1 using @arg00 ;
 
3350
a
 
3351
1
 
3352
set @arg00=1000 ;
 
3353
execute stmt1 using @arg00 ;
 
3354
a
 
3355
set @arg00=NULL ;
 
3356
select a FROM t1 where a=@arg00 ;
 
3357
a
 
3358
prepare stmt1 from ' select a FROM t1 where a=? ' ;
 
3359
execute stmt1 using @arg00 ;
 
3360
a
 
3361
set @arg00=4 ;
 
3362
select a FROM t1 where a=sqrt(@arg00) ;
 
3363
a
 
3364
2
 
3365
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
 
3366
execute stmt1 using @arg00 ;
 
3367
a
 
3368
2
 
3369
set @arg00=NULL ;
 
3370
select a FROM t1 where a=sqrt(@arg00) ;
 
3371
a
 
3372
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
 
3373
execute stmt1 using @arg00 ;
 
3374
a
 
3375
set @arg00=2 ;
 
3376
set @arg01=3 ;
 
3377
select a FROM t1 where a in (@arg00,@arg01) order by a;
 
3378
a
 
3379
2
 
3380
3
 
3381
prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
 
3382
execute stmt1 using @arg00, @arg01;
 
3383
a
 
3384
2
 
3385
3
 
3386
set @arg00= 'one' ;
 
3387
set @arg01= 'two' ;
 
3388
set @arg02= 'five' ;
 
3389
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
 
3390
execute stmt1 using @arg00, @arg01, @arg02 ;
 
3391
b
 
3392
one
 
3393
two
 
3394
prepare stmt1 from ' select b FROM t1 where b like ? ';
 
3395
set @arg00='two' ;
 
3396
execute stmt1 using @arg00 ;
 
3397
b
 
3398
two
 
3399
set @arg00='tw%' ;
 
3400
execute stmt1 using @arg00 ;
 
3401
b
 
3402
two
 
3403
set @arg00='%wo' ;
 
3404
execute stmt1 using @arg00 ;
 
3405
b
 
3406
two
 
3407
set @arg00=null ;
 
3408
insert into t9 set c1= 0, c5 = NULL ;
 
3409
select c5 from t9 where c5 > NULL ;
 
3410
c5
 
3411
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
 
3412
execute stmt1 using @arg00 ;
 
3413
c5
 
3414
select c5 from t9 where c5 < NULL ;
 
3415
c5
 
3416
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
 
3417
execute stmt1 using @arg00 ;
 
3418
c5
 
3419
select c5 from t9 where c5 = NULL ;
 
3420
c5
 
3421
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
 
3422
execute stmt1 using @arg00 ;
 
3423
c5
 
3424
select c5 from t9 where c5 <=> NULL ;
 
3425
c5
 
3426
NULL
 
3427
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
 
3428
execute stmt1 using @arg00 ;
 
3429
c5
 
3430
NULL
 
3431
delete from t9 where c1= 0 ;
 
3432
set @arg00='>' ;
 
3433
select a FROM t1 where a @arg00 1 ;
 
3434
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
 
3435
prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
 
3436
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
 
3437
set @arg00=1 ;
 
3438
select a,b FROM t1 where a is not NULL
 
3439
AND b is not NULL group by a - @arg00 ;
 
3440
a       b
 
3441
1       one
 
3442
2       two
 
3443
3       three
 
3444
4       four
 
3445
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
3446
AND b is not NULL group by a - ? ' ;
 
3447
execute stmt1 using @arg00 ;
 
3448
a       b
 
3449
1       one
 
3450
2       two
 
3451
3       three
 
3452
4       four
 
3453
set @arg00='two' ;
 
3454
select a,b FROM t1 where a is not NULL
 
3455
AND b is not NULL having b <> @arg00 order by a ;
 
3456
a       b
 
3457
1       one
 
3458
3       three
 
3459
4       four
 
3460
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
3461
AND b is not NULL having b <> ? order by a ' ;
 
3462
execute stmt1 using @arg00 ;
 
3463
a       b
 
3464
1       one
 
3465
3       three
 
3466
4       four
 
3467
set @arg00=1 ;
 
3468
select a,b FROM t1 where a is not NULL
 
3469
AND b is not NULL order by a - @arg00 ;
 
3470
a       b
 
3471
1       one
 
3472
2       two
 
3473
3       three
 
3474
4       four
 
3475
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
 
3476
AND b is not NULL order by a - ? ' ;
 
3477
execute stmt1 using @arg00 ;
 
3478
a       b
 
3479
1       one
 
3480
2       two
 
3481
3       three
 
3482
4       four
 
3483
set @arg00=2 ;
 
3484
select a,b from t1 order by 2 ;
 
3485
a       b
 
3486
4       four
 
3487
1       one
 
3488
3       three
 
3489
2       two
 
3490
prepare stmt1 from ' select a,b from t1
 
3491
order by ? ';
 
3492
execute stmt1 using @arg00;
 
3493
a       b
 
3494
4       four
 
3495
1       one
 
3496
3       three
 
3497
2       two
 
3498
set @arg00=1 ;
 
3499
execute stmt1 using @arg00;
 
3500
a       b
 
3501
1       one
 
3502
2       two
 
3503
3       three
 
3504
4       four
 
3505
set @arg00=0 ;
 
3506
execute stmt1 using @arg00;
 
3507
ERROR 42S22: Unknown column '?' in 'order clause'
 
3508
set @arg00=1;
 
3509
prepare stmt1 from ' select a,b from t1 order by a
 
3510
limit 1 ';
 
3511
execute stmt1 ;
 
3512
a       b
 
3513
1       one
 
3514
prepare stmt1 from ' select a,b from t1 order by a limit ? ';
 
3515
execute stmt1 using @arg00;
 
3516
a       b
 
3517
1       one
 
3518
set @arg00='b' ;
 
3519
set @arg01=0 ;
 
3520
set @arg02=2 ;
 
3521
set @arg03=2 ;
 
3522
select sum(a), @arg00 from t1 where a > @arg01
 
3523
and b is not null group by substr(b,@arg02)
 
3524
having sum(a) <> @arg03 ;
 
3525
sum(a)  @arg00
 
3526
3       b
 
3527
1       b
 
3528
4       b
 
3529
prepare stmt1 from ' select sum(a), ? from t1 where a > ?
 
3530
and b is not null group by substr(b,?)
 
3531
having sum(a) <> ? ';
 
3532
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
 
3533
sum(a)  ?
 
3534
3       b
 
3535
1       b
 
3536
4       b
 
3537
test_sequence
 
3538
------ join tests ------
 
3539
select first.a as a1, second.a as a2 
 
3540
from t1 first, t1 second
 
3541
where first.a = second.a order by a1 ;
 
3542
a1      a2
 
3543
1       1
 
3544
2       2
 
3545
3       3
 
3546
4       4
 
3547
prepare stmt1 from ' select first.a as a1, second.a as a2 
 
3548
        from t1 first, t1 second
 
3549
        where first.a = second.a order by a1 ';
 
3550
execute stmt1 ;
 
3551
a1      a2
 
3552
1       1
 
3553
2       2
 
3554
3       3
 
3555
4       4
 
3556
set @arg00='ABC';
 
3557
set @arg01='two';
 
3558
set @arg02='one';
 
3559
select first.a, @arg00, second.a FROM t1 first, t1 second
 
3560
where @arg01 = first.b or first.a = second.a or second.b = @arg02
 
3561
order by second.a, first.a;
 
3562
a       @arg00  a
 
3563
1       ABC     1
 
3564
2       ABC     1
 
3565
3       ABC     1
 
3566
4       ABC     1
 
3567
2       ABC     2
 
3568
2       ABC     3
 
3569
3       ABC     3
 
3570
2       ABC     4
 
3571
4       ABC     4
 
3572
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
 
3573
                    where ? = first.b or first.a = second.a or second.b = ?
 
3574
                    order by second.a, first.a';
 
3575
execute stmt1 using @arg00, @arg01, @arg02;
 
3576
a       ?       a
 
3577
1       ABC     1
 
3578
2       ABC     1
 
3579
3       ABC     1
 
3580
4       ABC     1
 
3581
2       ABC     2
 
3582
2       ABC     3
 
3583
3       ABC     3
 
3584
2       ABC     4
 
3585
4       ABC     4
 
3586
drop table if exists t2 ;
 
3587
create table t2 as select * from t1 ;
 
3588
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
 
3589
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
 
3590
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
 
3591
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
 
3592
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
 
3593
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
 
3594
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
 
3595
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
 
3596
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
 
3597
the join statement is:
 
3598
SELECT * FROM t2 right join t1 using(a) order by t2.a 
 
3599
prepare stmt1 from @query9  ;
 
3600
execute stmt1 ;
 
3601
a       b       b
 
3602
1       one     one
 
3603
2       two     two
 
3604
3       three   three
 
3605
4       four    four
 
3606
execute stmt1 ;
 
3607
a       b       b
 
3608
1       one     one
 
3609
2       two     two
 
3610
3       three   three
 
3611
4       four    four
 
3612
execute stmt1 ;
 
3613
a       b       b
 
3614
1       one     one
 
3615
2       two     two
 
3616
3       three   three
 
3617
4       four    four
 
3618
the join statement is:
 
3619
SELECT * FROM t2 natural right join t1 order by t2.a 
 
3620
prepare stmt1 from @query8 ;
 
3621
execute stmt1 ;
 
3622
a       b
 
3623
1       one
 
3624
2       two
 
3625
3       three
 
3626
4       four
 
3627
execute stmt1 ;
 
3628
a       b
 
3629
1       one
 
3630
2       two
 
3631
3       three
 
3632
4       four
 
3633
execute stmt1 ;
 
3634
a       b
 
3635
1       one
 
3636
2       two
 
3637
3       three
 
3638
4       four
 
3639
the join statement is:
 
3640
SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a 
 
3641
prepare stmt1 from @query7 ;
 
3642
execute stmt1 ;
 
3643
a       b       a       b
 
3644
1       one     1       one
 
3645
2       two     2       two
 
3646
3       three   3       three
 
3647
4       four    4       four
 
3648
execute stmt1 ;
 
3649
a       b       a       b
 
3650
1       one     1       one
 
3651
2       two     2       two
 
3652
3       three   3       three
 
3653
4       four    4       four
 
3654
execute stmt1 ;
 
3655
a       b       a       b
 
3656
1       one     1       one
 
3657
2       two     2       two
 
3658
3       three   3       three
 
3659
4       four    4       four
 
3660
the join statement is:
 
3661
SELECT * FROM t2 left join t1 using(a) order by t2.a 
 
3662
prepare stmt1 from @query6 ;
 
3663
execute stmt1 ;
 
3664
a       b       b
 
3665
1       one     one
 
3666
2       two     two
 
3667
3       three   three
 
3668
4       four    four
 
3669
execute stmt1 ;
 
3670
a       b       b
 
3671
1       one     one
 
3672
2       two     two
 
3673
3       three   three
 
3674
4       four    four
 
3675
execute stmt1 ;
 
3676
a       b       b
 
3677
1       one     one
 
3678
2       two     two
 
3679
3       three   three
 
3680
4       four    four
 
3681
the join statement is:
 
3682
SELECT * FROM t2 natural left join t1 order by t2.a 
 
3683
prepare stmt1 from @query5 ;
 
3684
execute stmt1 ;
 
3685
a       b
 
3686
1       one
 
3687
2       two
 
3688
3       three
 
3689
4       four
 
3690
execute stmt1 ;
 
3691
a       b
 
3692
1       one
 
3693
2       two
 
3694
3       three
 
3695
4       four
 
3696
execute stmt1 ;
 
3697
a       b
 
3698
1       one
 
3699
2       two
 
3700
3       three
 
3701
4       four
 
3702
the join statement is:
 
3703
SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a 
 
3704
prepare stmt1 from @query4 ;
 
3705
execute stmt1 ;
 
3706
a       b       a       b
 
3707
1       one     1       one
 
3708
2       two     2       two
 
3709
3       three   3       three
 
3710
4       four    4       four
 
3711
execute stmt1 ;
 
3712
a       b       a       b
 
3713
1       one     1       one
 
3714
2       two     2       two
 
3715
3       three   3       three
 
3716
4       four    4       four
 
3717
execute stmt1 ;
 
3718
a       b       a       b
 
3719
1       one     1       one
 
3720
2       two     2       two
 
3721
3       three   3       three
 
3722
4       four    4       four
 
3723
the join statement is:
 
3724
SELECT * FROM t2 join t1 using(a) order by t2.a 
 
3725
prepare stmt1 from @query3 ;
 
3726
execute stmt1 ;
 
3727
a       b       b
 
3728
1       one     one
 
3729
2       two     two
 
3730
3       three   three
 
3731
4       four    four
 
3732
execute stmt1 ;
 
3733
a       b       b
 
3734
1       one     one
 
3735
2       two     two
 
3736
3       three   three
 
3737
4       four    four
 
3738
execute stmt1 ;
 
3739
a       b       b
 
3740
1       one     one
 
3741
2       two     two
 
3742
3       three   three
 
3743
4       four    four
 
3744
the join statement is:
 
3745
SELECT * FROM t2 natural join t1 order by t2.a 
 
3746
prepare stmt1 from @query2 ;
 
3747
execute stmt1 ;
 
3748
a       b
 
3749
1       one
 
3750
2       two
 
3751
3       three
 
3752
4       four
 
3753
execute stmt1 ;
 
3754
a       b
 
3755
1       one
 
3756
2       two
 
3757
3       three
 
3758
4       four
 
3759
execute stmt1 ;
 
3760
a       b
 
3761
1       one
 
3762
2       two
 
3763
3       three
 
3764
4       four
 
3765
the join statement is:
 
3766
SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a 
 
3767
prepare stmt1 from @query1 ;
 
3768
execute stmt1 ;
 
3769
a       b       a       b
 
3770
1       one     1       one
 
3771
2       two     2       two
 
3772
3       three   3       three
 
3773
4       four    4       four
 
3774
execute stmt1 ;
 
3775
a       b       a       b
 
3776
1       one     1       one
 
3777
2       two     2       two
 
3778
3       three   3       three
 
3779
4       four    4       four
 
3780
execute stmt1 ;
 
3781
a       b       a       b
 
3782
1       one     1       one
 
3783
2       two     2       two
 
3784
3       three   3       three
 
3785
4       four    4       four
 
3786
drop table t2 ;
 
3787
test_sequence
 
3788
------ subquery tests ------
 
3789
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3790
   a = (select a from t1 where b = ''two'') ';
 
3791
execute stmt1 ;
 
3792
a       b
 
3793
2       two
 
3794
set @arg00='two' ;
 
3795
select a, b FROM t1 outer_table where
 
3796
a = (select a from t1 where b = 'two' ) and b=@arg00 ;
 
3797
a       b
 
3798
2       two
 
3799
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3800
   a = (select a from t1 where b = ''two'') and b=? ';
 
3801
execute stmt1 using @arg00;
 
3802
a       b
 
3803
2       two
 
3804
set @arg00='two' ;
 
3805
select a, b FROM t1 outer_table where
 
3806
a = (select a from t1 where b = @arg00 ) and b='two' ;
 
3807
a       b
 
3808
2       two
 
3809
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3810
   a = (select a from t1 where b = ? ) and b=''two'' ' ;
 
3811
execute stmt1 using @arg00;
 
3812
a       b
 
3813
2       two
 
3814
set @arg00=3 ;
 
3815
set @arg01='three' ;
 
3816
select a,b FROM t1 where (a,b) in (select 3, 'three');
 
3817
a       b
 
3818
3       three
 
3819
select a FROM t1 where (a,b) in (select @arg00,@arg01);
 
3820
a
 
3821
3
 
3822
prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
 
3823
execute stmt1 using @arg00, @arg01;
 
3824
a
 
3825
3
 
3826
set @arg00=1 ;
 
3827
set @arg01='two' ;
 
3828
set @arg02=2 ;
 
3829
set @arg03='two' ;
 
3830
select a, @arg00, b FROM t1 outer_table where
 
3831
b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
 
3832
a       @arg00  b
 
3833
2       1       two
 
3834
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
 
3835
   b=? and a = (select ? from t1 where b = ? ) ' ;
 
3836
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
3837
a       ?       b
 
3838
2       1       two
 
3839
prepare stmt1 from 'select c4 FROM t9 where
 
3840
    c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
 
3841
execute stmt1 using @arg01, @arg02;
 
3842
c4
 
3843
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3844
   a = (select a from t1 where b = outer_table.b ) order by a ';
 
3845
execute stmt1 ;
 
3846
a       b
 
3847
1       one
 
3848
2       two
 
3849
3       three
 
3850
4       four
 
3851
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
3852
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
3853
execute stmt1 ;
 
3854
ccc
 
3855
1
 
3856
deallocate prepare stmt1 ;
 
3857
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
3858
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
3859
execute stmt1 ;
 
3860
ccc
 
3861
1
 
3862
deallocate prepare stmt1 ;
 
3863
prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
 
3864
                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
 
3865
execute stmt1 ;
 
3866
ccc
 
3867
1
 
3868
deallocate prepare stmt1 ;
 
3869
set @arg00='two' ;
 
3870
select a, b FROM t1 outer_table where
 
3871
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
 
3872
a       b
 
3873
2       two
 
3874
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3875
   a = (select a from t1 where b = outer_table.b) and b=? ';
 
3876
execute stmt1 using @arg00;
 
3877
a       b
 
3878
2       two
 
3879
set @arg00=2 ;
 
3880
select a, b FROM t1 outer_table where
 
3881
a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
 
3882
a       b
 
3883
2       two
 
3884
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3885
   a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
 
3886
execute stmt1 using @arg00;
 
3887
a       b
 
3888
2       two
 
3889
set @arg00=2 ;
 
3890
select a, b FROM t1 outer_table where
 
3891
a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
 
3892
a       b
 
3893
2       two
 
3894
prepare stmt1 from ' select a, b FROM t1 outer_table where
 
3895
   a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
 
3896
execute stmt1 using @arg00;
 
3897
a       b
 
3898
2       two
 
3899
set @arg00=1 ;
 
3900
set @arg01='two' ;
 
3901
set @arg02=2 ;
 
3902
set @arg03='two' ;
 
3903
select a, @arg00, b FROM t1 outer_table where
 
3904
b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
 
3905
and outer_table.a=a ) ;
 
3906
a       @arg00  b
 
3907
2       1       two
 
3908
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
 
3909
   b=? and a = (select ? from t1 where outer_table.b = ? 
 
3910
                   and outer_table.a=a ) ' ;
 
3911
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
3912
a       ?       b
 
3913
2       1       two
 
3914
set @arg00=1 ;
 
3915
set @arg01=0 ;
 
3916
select a, @arg00 
 
3917
from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
 
3918
where a=@arg01;
 
3919
a       @arg00
 
3920
0       1
 
3921
prepare stmt1 from ' select a, ? 
 
3922
                    from ( select a - ? as a from t1 where a=? ) as t2
 
3923
                    where a=? ';
 
3924
execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
 
3925
a       ?
 
3926
0       1
 
3927
drop table if exists t2 ;
 
3928
create table t2 as select * from t1;
 
3929
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
 
3930
execute stmt1 ;
 
3931
a in (select a from t2)
 
3932
1
 
3933
1
 
3934
1
 
3935
1
 
3936
drop table if exists t5, t6, t7 ;
 
3937
create table t5 (a int , b int) ;
 
3938
create table t6 like t5 ;
 
3939
create table t7 like t5 ;
 
3940
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
 
3941
(2, -1), (3, 10) ;
 
3942
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
 
3943
insert into t7 values (3, 3), (2, 2), (1, 1) ;
 
3944
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
 
3945
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
3946
                     group by t5.a order by sum limit 1) from t7 ' ;
 
3947
execute stmt1 ;
 
3948
a       (select count(distinct t5.b) as sum from t5, t6
 
3949
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
3950
                     group by t5.a order by sum limit 1)
 
3951
3       1
 
3952
2       2
 
3953
1       2
 
3954
execute stmt1 ;
 
3955
a       (select count(distinct t5.b) as sum from t5, t6
 
3956
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
3957
                     group by t5.a order by sum limit 1)
 
3958
3       1
 
3959
2       2
 
3960
1       2
 
3961
execute stmt1 ;
 
3962
a       (select count(distinct t5.b) as sum from t5, t6
 
3963
                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
 
3964
                     group by t5.a order by sum limit 1)
 
3965
3       1
 
3966
2       2
 
3967
1       2
 
3968
drop table t5, t6, t7 ;
 
3969
drop table if exists t2 ;
 
3970
create table t2 as select * from t9;
 
3971
set @stmt= ' SELECT
 
3972
   (SELECT SUM(c1 + c12 + 0.0) FROM t2 
 
3973
    where (t9.c2 - 0e-3) = t2.c2
 
3974
    GROUP BY t9.c15 LIMIT 1) as scalar_s,
 
3975
   exists (select 1.0e+0 from t2 
 
3976
           where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
 
3977
   c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
 
3978
   (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
 
3979
FROM t9,
 
3980
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
 
3981
prepare stmt1 from @stmt ;
 
3982
execute stmt1 ;
 
3983
execute stmt1 ;
 
3984
set @stmt= concat('explain ',@stmt);
 
3985
prepare stmt1 from @stmt ;
 
3986
execute stmt1 ;
 
3987
execute stmt1 ;
 
3988
set @stmt= ' SELECT
 
3989
   (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
 
3990
    GROUP BY t9.c15 LIMIT 1) as scalar_s,
 
3991
   exists (select ? from t2 
 
3992
           where t2.c3*?=t9.c4) as exists_s,
 
3993
   c5*? in (select c6+? from t2) as in_s,
 
3994
   (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
 
3995
FROM t9,
 
3996
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
 
3997
set @arg00= 0.0 ;
 
3998
set @arg01= 0e-3 ;
 
3999
set @arg02= 1.0e+0 ;
 
4000
set @arg03= 9.0000000000 ;
 
4001
set @arg04= 4 ;
 
4002
set @arg05= 0.3e+1 ;
 
4003
set @arg06= 4 ;
 
4004
set @arg07= 4 ;
 
4005
set @arg08= 4.0 ;
 
4006
set @arg09= 40e-1 ;
 
4007
prepare stmt1 from @stmt ;
 
4008
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
4009
@arg07, @arg08, @arg09 ;
 
4010
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
4011
@arg07, @arg08, @arg09 ;
 
4012
set @stmt= concat('explain ',@stmt);
 
4013
prepare stmt1 from @stmt ;
 
4014
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
4015
@arg07, @arg08, @arg09 ;
 
4016
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
 
4017
@arg07, @arg08, @arg09 ;
 
4018
drop table t2 ;
 
4019
select 1 < (select a from t1) ;
 
4020
ERROR 21000: Subquery returns more than 1 row
 
4021
prepare stmt1 from ' select 1 < (select a from t1) ' ;
 
4022
execute stmt1 ;
 
4023
ERROR 21000: Subquery returns more than 1 row
 
4024
select 1 as my_col ;
 
4025
my_col
 
4026
1
 
4027
test_sequence
 
4028
------ union tests ------
 
4029
prepare stmt1 from ' select a FROM t1 where a=1
 
4030
                     union distinct
 
4031
                     select a FROM t1 where a=1 ';
 
4032
execute stmt1 ;
 
4033
a
 
4034
1
 
4035
execute stmt1 ;
 
4036
a
 
4037
1
 
4038
prepare stmt1 from ' select a FROM t1 where a=1
 
4039
                     union all
 
4040
                     select a FROM t1 where a=1 ';
 
4041
execute stmt1 ;
 
4042
a
 
4043
1
 
4044
1
 
4045
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
 
4046
ERROR 21000: The used SELECT statements have a different number of columns
 
4047
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
 
4048
ERROR 21000: The used SELECT statements have a different number of columns
 
4049
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
 
4050
ERROR 21000: The used SELECT statements have a different number of columns
 
4051
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
 
4052
ERROR 21000: The used SELECT statements have a different number of columns
 
4053
set @arg00=1 ;
 
4054
select @arg00 FROM t1 where a=1
 
4055
union distinct
 
4056
select 1 FROM t1 where a=1;
 
4057
@arg00
 
4058
1
 
4059
prepare stmt1 from ' select ? FROM t1 where a=1
 
4060
                     union distinct
 
4061
                     select 1 FROM t1 where a=1 ' ;
 
4062
execute stmt1 using @arg00;
 
4063
?
 
4064
1
 
4065
set @arg00=1 ;
 
4066
select 1 FROM t1 where a=1
 
4067
union distinct
 
4068
select @arg00 FROM t1 where a=1;
 
4069
1
 
4070
1
 
4071
prepare stmt1 from ' select 1 FROM t1 where a=1
 
4072
                     union distinct
 
4073
                     select ? FROM t1 where a=1 ' ;
 
4074
execute stmt1 using @arg00;
 
4075
1
 
4076
1
 
4077
set @arg00='a' ;
 
4078
select @arg00 FROM t1 where a=1
 
4079
union distinct
 
4080
select @arg00 FROM t1 where a=1;
 
4081
@arg00
 
4082
a
 
4083
prepare stmt1 from ' select ? FROM t1 where a=1
 
4084
                     union distinct
 
4085
                     select ? FROM t1 where a=1 ';
 
4086
execute stmt1 using @arg00, @arg00;
 
4087
?
 
4088
a
 
4089
prepare stmt1 from ' select ? 
 
4090
                     union distinct
 
4091
                     select ? ';
 
4092
execute stmt1 using @arg00, @arg00;
 
4093
?
 
4094
a
 
4095
set @arg00='a' ;
 
4096
set @arg01=1 ;
 
4097
set @arg02='a' ;
 
4098
set @arg03=2 ;
 
4099
select @arg00 FROM t1 where a=@arg01
 
4100
union distinct
 
4101
select @arg02 FROM t1 where a=@arg03;
 
4102
@arg00
 
4103
a
 
4104
prepare stmt1 from ' select ? FROM t1 where a=?
 
4105
                     union distinct
 
4106
                     select ? FROM t1 where a=? ' ;
 
4107
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
 
4108
?
 
4109
a
 
4110
set @arg00=1 ;
 
4111
prepare stmt1 from ' select sum(a) + 200, ? from t1
 
4112
union distinct
 
4113
select sum(a) + 200, 1 from t1
 
4114
group by b ' ;
 
4115
execute stmt1 using @arg00;
 
4116
sum(a) + 200    ?
 
4117
210     1
 
4118
204     1
 
4119
201     1
 
4120
203     1
 
4121
202     1
 
4122
set @Oporto='Oporto' ;
 
4123
set @Lisboa='Lisboa' ;
 
4124
set @0=0 ;
 
4125
set @1=1 ;
 
4126
set @2=2 ;
 
4127
set @3=3 ;
 
4128
set @4=4 ;
 
4129
select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
 
4130
@Oporto @Lisboa @0      @1      @2      @3      @4
 
4131
Oporto  Lisboa  0       1       2       3       4
 
4132
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
4133
group by b
 
4134
union distinct
 
4135
select sum(a) + 200, @Lisboa from t1
 
4136
group by b ;
 
4137
the_sum the_town
 
4138
204     Oporto
 
4139
201     Oporto
 
4140
203     Oporto
 
4141
202     Oporto
 
4142
204     Lisboa
 
4143
201     Lisboa
 
4144
203     Lisboa
 
4145
202     Lisboa
 
4146
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
4147
                     group by b
 
4148
                     union distinct
 
4149
                     select sum(a) + 200, ? from t1
 
4150
                     group by b ' ;
 
4151
execute stmt1 using @Oporto, @Lisboa;
 
4152
the_sum the_town
 
4153
204     Oporto
 
4154
201     Oporto
 
4155
203     Oporto
 
4156
202     Oporto
 
4157
204     Lisboa
 
4158
201     Lisboa
 
4159
203     Lisboa
 
4160
202     Lisboa
 
4161
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
4162
where a > @1
 
4163
group by b
 
4164
union distinct
 
4165
select sum(a) + 200, @Lisboa from t1
 
4166
where a > @2
 
4167
group by b ;
 
4168
the_sum the_town
 
4169
204     Oporto
 
4170
203     Oporto
 
4171
202     Oporto
 
4172
204     Lisboa
 
4173
203     Lisboa
 
4174
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
4175
                     where a > ?
 
4176
                     group by b
 
4177
                     union distinct
 
4178
                     select sum(a) + 200, ? from t1
 
4179
                     where a > ?
 
4180
                     group by b ' ;
 
4181
execute stmt1 using @Oporto, @1, @Lisboa, @2;
 
4182
the_sum the_town
 
4183
204     Oporto
 
4184
203     Oporto
 
4185
202     Oporto
 
4186
204     Lisboa
 
4187
203     Lisboa
 
4188
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
 
4189
where a > @1
 
4190
group by b
 
4191
having avg(a) > @2
 
4192
union distinct
 
4193
select sum(a) + 200, @Lisboa from t1
 
4194
where a > @2
 
4195
group by b 
 
4196
having avg(a) > @3;
 
4197
the_sum the_town
 
4198
204     Oporto
 
4199
203     Oporto
 
4200
204     Lisboa
 
4201
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
 
4202
                     where a > ?
 
4203
                     group by b
 
4204
                     having avg(a) > ?
 
4205
                     union distinct
 
4206
                     select sum(a) + 200, ? from t1
 
4207
                     where a > ?
 
4208
                     group by b
 
4209
                     having avg(a) > ? ';
 
4210
execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
 
4211
the_sum the_town
 
4212
204     Oporto
 
4213
203     Oporto
 
4214
204     Lisboa
 
4215
test_sequence
 
4216
------ explain select tests ------
 
4217
prepare stmt1 from ' explain select * from t9 ' ;
 
4218
execute stmt1;
 
4219
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4220
def                                     id      8       3       1       N       32929   0       63
 
4221
def                                     select_type     253     19      6       N       1       31      8
 
4222
def                                     table   253     64      2       Y       0       31      8
 
4223
def                                     type    253     10      3       Y       0       31      8
 
4224
def                                     possible_keys   253     4096    0       Y       0       31      8
 
4225
def                                     key     253     64      0       Y       0       31      8
 
4226
def                                     key_len 253     4096    0       Y       0       31      8
 
4227
def                                     ref     253     1024    0       Y       0       31      8
 
4228
def                                     rows    8       10      1       Y       32928   0       63
 
4229
def                                     Extra   253     255     0       N       1       31      8
 
4230
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
4231
1       SIMPLE  t9      ALL     NULL    NULL    NULL    NULL    2       
 
4232
test_sequence
 
4233
------ delete tests ------
 
4234
delete from t1 ;
 
4235
insert into t1 values (1,'one');
 
4236
insert into t1 values (2,'two');
 
4237
insert into t1 values (3,'three');
 
4238
insert into t1 values (4,'four');
 
4239
commit ;
 
4240
delete from t9 ;
 
4241
insert into t9
 
4242
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
4243
c10= 1, c11= 1, c12 = 1,
 
4244
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4245
c16= '11:11:11', c17= '2004',
 
4246
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
4247
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4248
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4249
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
4250
insert into t9
 
4251
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
4252
c10= 9, c11= 9, c12 = 9,
 
4253
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4254
c16= '11:11:11', c17= '2004',
 
4255
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
4256
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4257
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4258
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
4259
commit ;
 
4260
prepare stmt1 from 'delete from t1 where a=2' ;
 
4261
execute stmt1;
 
4262
select a,b from t1 where a=2;
 
4263
a       b
 
4264
execute stmt1;
 
4265
insert into t1 values(0,NULL);
 
4266
set @arg00=NULL;
 
4267
prepare stmt1 from 'delete from t1 where b=?' ;
 
4268
execute stmt1 using @arg00;
 
4269
select a,b from t1 where b is NULL ;
 
4270
a       b
 
4271
0       NULL
 
4272
set @arg00='one';
 
4273
execute stmt1 using @arg00;
 
4274
select a,b from t1 where b=@arg00;
 
4275
a       b
 
4276
prepare stmt1 from 'truncate table t1' ;
 
4277
test_sequence
 
4278
------ update tests ------
 
4279
delete from t1 ;
 
4280
insert into t1 values (1,'one');
 
4281
insert into t1 values (2,'two');
 
4282
insert into t1 values (3,'three');
 
4283
insert into t1 values (4,'four');
 
4284
commit ;
 
4285
delete from t9 ;
 
4286
insert into t9
 
4287
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
4288
c10= 1, c11= 1, c12 = 1,
 
4289
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4290
c16= '11:11:11', c17= '2004',
 
4291
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
4292
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4293
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4294
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
4295
insert into t9
 
4296
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
4297
c10= 9, c11= 9, c12 = 9,
 
4298
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4299
c16= '11:11:11', c17= '2004',
 
4300
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
4301
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4302
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4303
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
4304
commit ;
 
4305
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
 
4306
execute stmt1;
 
4307
select a,b from t1 where a=2;
 
4308
a       b
 
4309
2       a=two
 
4310
execute stmt1;
 
4311
select a,b from t1 where a=2;
 
4312
a       b
 
4313
2       a=two
 
4314
set @arg00=NULL;
 
4315
prepare stmt1 from 'update t1 set b=? where a=2' ;
 
4316
execute stmt1 using @arg00;
 
4317
select a,b from t1 where a=2;
 
4318
a       b
 
4319
2       NULL
 
4320
set @arg00='two';
 
4321
execute stmt1 using @arg00;
 
4322
select a,b from t1 where a=2;
 
4323
a       b
 
4324
2       two
 
4325
set @arg00=2;
 
4326
prepare stmt1 from 'update t1 set b=NULL where a=?' ;
 
4327
execute stmt1 using @arg00;
 
4328
select a,b from t1 where a=@arg00;
 
4329
a       b
 
4330
2       NULL
 
4331
update t1 set b='two' where a=@arg00;
 
4332
set @arg00=2000;
 
4333
execute stmt1 using @arg00;
 
4334
select a,b from t1 where a=@arg00;
 
4335
a       b
 
4336
set @arg00=2;
 
4337
set @arg01=22;
 
4338
prepare stmt1 from 'update t1 set a=? where a=?' ;
 
4339
execute stmt1 using @arg00, @arg00;
 
4340
select a,b from t1 where a=@arg00;
 
4341
a       b
 
4342
2       two
 
4343
execute stmt1 using @arg01, @arg00;
 
4344
select a,b from t1 where a=@arg01;
 
4345
a       b
 
4346
22      two
 
4347
execute stmt1 using @arg00, @arg01;
 
4348
select a,b from t1 where a=@arg00;
 
4349
a       b
 
4350
2       two
 
4351
set @arg00=NULL;
 
4352
set @arg01=2;
 
4353
execute stmt1 using @arg00, @arg01;
 
4354
Warnings:
 
4355
Warning 1048    Column 'a' cannot be null
 
4356
select a,b from t1 order by a;
 
4357
a       b
 
4358
0       two
 
4359
1       one
 
4360
3       three
 
4361
4       four
 
4362
set @arg00=0;
 
4363
execute stmt1 using @arg01, @arg00;
 
4364
select a,b from t1 order by a;
 
4365
a       b
 
4366
1       one
 
4367
2       two
 
4368
3       three
 
4369
4       four
 
4370
set @arg00=23;
 
4371
set @arg01='two';
 
4372
set @arg02=2;
 
4373
set @arg03='two';
 
4374
set @arg04=2;
 
4375
drop table if exists t2;
 
4376
create table t2 as select a,b from t1 ;
 
4377
prepare stmt1 from 'update t1 set a=? where b=?
 
4378
                    and a in (select ? from t2
 
4379
                              where b = ? or a = ?)';
 
4380
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
 
4381
affected rows: 1
 
4382
info: Rows matched: 1  Changed: 1  Warnings: 0
 
4383
select a,b from t1 where a = @arg00 ;
 
4384
a       b
 
4385
23      two
 
4386
prepare stmt1 from 'update t1 set a=? where b=?
 
4387
                    and a not in (select ? from t2
 
4388
                              where b = ? or a = ?)';
 
4389
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
 
4390
affected rows: 1
 
4391
info: Rows matched: 1  Changed: 1  Warnings: 0
 
4392
select a,b from t1 order by a ;
 
4393
a       b
 
4394
1       one
 
4395
2       two
 
4396
3       three
 
4397
4       four
 
4398
drop table t2 ;
 
4399
create table t2
 
4400
(
 
4401
a int, b varchar(30),
 
4402
primary key(a)
 
4403
) engine = 'MYISAM'  ;
 
4404
insert into t2(a,b) select a, b from t1 ;
 
4405
prepare stmt1 from 'update t1 set a=? where b=?
 
4406
                    and a in (select ? from t2
 
4407
                              where b = ? or a = ?)';
 
4408
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
 
4409
affected rows: 1
 
4410
info: Rows matched: 1  Changed: 1  Warnings: 0
 
4411
select a,b from t1 where a = @arg00 ;
 
4412
a       b
 
4413
23      two
 
4414
prepare stmt1 from 'update t1 set a=? where b=?
 
4415
                    and a not in (select ? from t2
 
4416
                              where b = ? or a = ?)';
 
4417
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
 
4418
affected rows: 1
 
4419
info: Rows matched: 1  Changed: 1  Warnings: 0
 
4420
select a,b from t1 order by a ;
 
4421
a       b
 
4422
1       one
 
4423
2       two
 
4424
3       three
 
4425
4       four
 
4426
drop table t2 ;
 
4427
set @arg00=1;
 
4428
prepare stmt1 from 'update t1 set b=''bla''
 
4429
where a=2
 
4430
limit 1';
 
4431
execute stmt1 ;
 
4432
select a,b from t1 where b = 'bla' ;
 
4433
a       b
 
4434
2       bla
 
4435
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
 
4436
execute stmt1 using @arg00;
 
4437
test_sequence
 
4438
------ insert tests ------
 
4439
delete from t1 ;
 
4440
insert into t1 values (1,'one');
 
4441
insert into t1 values (2,'two');
 
4442
insert into t1 values (3,'three');
 
4443
insert into t1 values (4,'four');
 
4444
commit ;
 
4445
delete from t9 ;
 
4446
insert into t9
 
4447
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
4448
c10= 1, c11= 1, c12 = 1,
 
4449
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4450
c16= '11:11:11', c17= '2004',
 
4451
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
4452
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4453
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4454
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
4455
insert into t9
 
4456
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
4457
c10= 9, c11= 9, c12 = 9,
 
4458
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4459
c16= '11:11:11', c17= '2004',
 
4460
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
4461
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4462
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4463
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
4464
commit ;
 
4465
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
 
4466
execute stmt1;
 
4467
select a,b from t1 where a = 5;
 
4468
a       b
 
4469
5       five
 
4470
set @arg00='six' ;
 
4471
prepare stmt1 from 'insert into t1 values(6, ? )';
 
4472
execute stmt1 using @arg00;
 
4473
select a,b from t1 where b = @arg00;
 
4474
a       b
 
4475
6       six
 
4476
execute stmt1 using @arg00;
 
4477
ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
 
4478
set @arg00=NULL ;
 
4479
prepare stmt1 from 'insert into t1 values(0, ? )';
 
4480
execute stmt1 using @arg00;
 
4481
select a,b from t1 where b is NULL;
 
4482
a       b
 
4483
0       NULL
 
4484
set @arg00=8 ;
 
4485
set @arg01='eight' ;
 
4486
prepare stmt1 from 'insert into t1 values(?, ? )';
 
4487
execute stmt1 using @arg00, @arg01 ;
 
4488
select a,b from t1 where b = @arg01;
 
4489
a       b
 
4490
8       eight
 
4491
set @NULL= null ;
 
4492
set @arg00= 'abc' ;
 
4493
execute stmt1 using @NULL, @NULL ;
 
4494
ERROR 23000: Column 'a' cannot be null
 
4495
execute stmt1 using @NULL, @NULL ;
 
4496
ERROR 23000: Column 'a' cannot be null
 
4497
execute stmt1 using @NULL, @arg00 ;
 
4498
ERROR 23000: Column 'a' cannot be null
 
4499
execute stmt1 using @NULL, @arg00 ;
 
4500
ERROR 23000: Column 'a' cannot be null
 
4501
set @arg01= 10000 + 2 ;
 
4502
execute stmt1 using @arg01, @arg00 ;
 
4503
set @arg01= 10000 + 1 ;
 
4504
execute stmt1 using @arg01, @arg00 ;
 
4505
select * from t1 where a > 10000 order by a ;
 
4506
a       b
 
4507
10001   abc
 
4508
10002   abc
 
4509
delete from t1 where a > 10000 ;
 
4510
set @arg01= 10000 + 2 ;
 
4511
execute stmt1 using @arg01, @NULL ;
 
4512
set @arg01= 10000 + 1 ;
 
4513
execute stmt1 using @arg01, @NULL ;
 
4514
select * from t1 where a > 10000 order by a ;
 
4515
a       b
 
4516
10001   NULL
 
4517
10002   NULL
 
4518
delete from t1 where a > 10000 ;
 
4519
set @arg01= 10000 + 10 ;
 
4520
execute stmt1 using @arg01, @arg01 ;
 
4521
set @arg01= 10000 + 9 ;
 
4522
execute stmt1 using @arg01, @arg01 ;
 
4523
set @arg01= 10000 + 8 ;
 
4524
execute stmt1 using @arg01, @arg01 ;
 
4525
set @arg01= 10000 + 7 ;
 
4526
execute stmt1 using @arg01, @arg01 ;
 
4527
set @arg01= 10000 + 6 ;
 
4528
execute stmt1 using @arg01, @arg01 ;
 
4529
set @arg01= 10000 + 5 ;
 
4530
execute stmt1 using @arg01, @arg01 ;
 
4531
set @arg01= 10000 + 4 ;
 
4532
execute stmt1 using @arg01, @arg01 ;
 
4533
set @arg01= 10000 + 3 ;
 
4534
execute stmt1 using @arg01, @arg01 ;
 
4535
set @arg01= 10000 + 2 ;
 
4536
execute stmt1 using @arg01, @arg01 ;
 
4537
set @arg01= 10000 + 1 ;
 
4538
execute stmt1 using @arg01, @arg01 ;
 
4539
select * from t1 where a > 10000 order by a ;
 
4540
a       b
 
4541
10001   10001
 
4542
10002   10002
 
4543
10003   10003
 
4544
10004   10004
 
4545
10005   10005
 
4546
10006   10006
 
4547
10007   10007
 
4548
10008   10008
 
4549
10009   10009
 
4550
10010   10010
 
4551
delete from t1 where a > 10000 ;
 
4552
set @arg00=81 ;
 
4553
set @arg01='8-1' ;
 
4554
set @arg02=82 ;
 
4555
set @arg03='8-2' ;
 
4556
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
 
4557
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
 
4558
select a,b from t1 where a in (@arg00,@arg02) ;
 
4559
a       b
 
4560
81      8-1
 
4561
82      8-2
 
4562
set @arg00=9 ;
 
4563
set @arg01='nine' ;
 
4564
prepare stmt1 from 'insert into t1 set a=?, b=? ';
 
4565
execute stmt1 using @arg00, @arg01 ;
 
4566
select a,b from t1 where a = @arg00 ;
 
4567
a       b
 
4568
9       nine
 
4569
set @arg00=6 ;
 
4570
set @arg01=1 ;
 
4571
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
 
4572
                    on duplicate key update a=a + ?, b=concat(b,''modified'') ';
 
4573
execute stmt1 using @arg00, @arg01;
 
4574
select * from t1 order by a;
 
4575
a       b
 
4576
0       NULL
 
4577
1       one
 
4578
2       two
 
4579
3       three
 
4580
4       four
 
4581
5       five
 
4582
7       sixmodified
 
4583
8       eight
 
4584
9       nine
 
4585
81      8-1
 
4586
82      8-2
 
4587
set @arg00=81 ;
 
4588
set @arg01=1 ;
 
4589
execute stmt1 using @arg00, @arg01;
 
4590
ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
 
4591
drop table if exists t2 ;
 
4592
create table t2 (id int auto_increment primary key) 
 
4593
ENGINE= 'MYISAM'  ;
 
4594
prepare stmt1 from ' select last_insert_id() ' ;
 
4595
insert into t2 values (NULL) ;
 
4596
execute stmt1 ;
 
4597
last_insert_id()
 
4598
1
 
4599
insert into t2 values (NULL) ;
 
4600
execute stmt1 ;
 
4601
last_insert_id()
 
4602
2
 
4603
drop table t2 ;
 
4604
set @1000=1000 ;
 
4605
set @x1000_2="x1000_2" ;
 
4606
set @x1000_3="x1000_3" ;
 
4607
set @x1000="x1000" ;
 
4608
set @1100=1100 ;
 
4609
set @x1100="x1100" ;
 
4610
set @100=100 ;
 
4611
set @updated="updated" ;
 
4612
insert into t1 values(1000,'x1000_1') ;
 
4613
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
 
4614
on duplicate key update a = a + @100, b = concat(b,@updated) ;
 
4615
select a,b from t1 where a >= 1000 order by a ;
 
4616
a       b
 
4617
1000    x1000_3
 
4618
1100    x1000_1updated
 
4619
delete from t1 where a >= 1000 ;
 
4620
insert into t1 values(1000,'x1000_1') ;
 
4621
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
 
4622
               on duplicate key update a = a + ?, b = concat(b,?) ';
 
4623
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
 
4624
select a,b from t1 where a >= 1000 order by a ;
 
4625
a       b
 
4626
1000    x1000_3
 
4627
1100    x1000_1updated
 
4628
delete from t1 where a >= 1000 ;
 
4629
insert into t1 values(1000,'x1000_1') ;
 
4630
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
 
4631
select a,b from t1 where a >= 1000 order by a ;
 
4632
a       b
 
4633
1200    x1000_1updatedupdated
 
4634
delete from t1 where a >= 1000 ;
 
4635
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
 
4636
execute stmt1;
 
4637
execute stmt1;
 
4638
execute stmt1;
 
4639
test_sequence
 
4640
------ multi table tests ------
 
4641
delete from t1 ;
 
4642
delete from t9 ;
 
4643
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
 
4644
insert into t9 (c1,c21)
 
4645
values (1, 'one'), (2, 'two'), (3, 'three') ;
 
4646
prepare stmt_delete from " delete t1, t9 
 
4647
  from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
 
4648
prepare stmt_update from " update t1, t9 
 
4649
  set t1.b='updated', t9.c21='updated'
 
4650
  where t1.a=t9.c1 and t1.a=? ";
 
4651
prepare stmt_select1 from " select a, b from t1 order by a" ;
 
4652
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
 
4653
set @arg00= 1 ;
 
4654
execute stmt_update using @arg00 ;
 
4655
execute stmt_delete ;
 
4656
execute stmt_select1 ;
 
4657
a       b
 
4658
2       two
 
4659
3       three
 
4660
execute stmt_select2 ;
 
4661
c1      c21
 
4662
2       two
 
4663
3       three
 
4664
set @arg00= @arg00 + 1 ;
 
4665
execute stmt_update using @arg00 ;
 
4666
execute stmt_delete ;
 
4667
execute stmt_select1 ;
 
4668
a       b
 
4669
3       three
 
4670
execute stmt_select2 ;
 
4671
c1      c21
 
4672
3       three
 
4673
set @arg00= @arg00 + 1 ;
 
4674
execute stmt_update using @arg00 ;
 
4675
execute stmt_delete ;
 
4676
execute stmt_select1 ;
 
4677
a       b
 
4678
execute stmt_select2 ;
 
4679
c1      c21
 
4680
set @arg00= @arg00 + 1 ;
 
4681
drop table if exists t5 ;
 
4682
set @arg01= 8;
 
4683
set @arg02= 8.0;
 
4684
set @arg03= 80.00000000000e-1;
 
4685
set @arg04= 'abc' ;
 
4686
set @arg05= CAST('abc' as binary) ;
 
4687
set @arg06= '1991-08-05' ;
 
4688
set @arg07= CAST('1991-08-05' as date);
 
4689
set @arg08= '1991-08-05 01:01:01' ;
 
4690
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
 
4691
set @arg10= unix_timestamp('1991-01-01 01:01:01');
 
4692
set @arg11= YEAR('1991-01-01 01:01:01');
 
4693
set @arg12= 8 ;
 
4694
set @arg12= NULL ;
 
4695
set @arg13= 8.0 ;
 
4696
set @arg13= NULL ;
 
4697
set @arg14= 'abc';
 
4698
set @arg14= NULL ;
 
4699
set @arg15= CAST('abc' as binary) ;
 
4700
set @arg15= NULL ;
 
4701
create table t5 as select
 
4702
8                           as const01, @arg01 as param01,
 
4703
8.0                         as const02, @arg02 as param02,
 
4704
80.00000000000e-1           as const03, @arg03 as param03,
 
4705
'abc'                       as const04, @arg04 as param04,
 
4706
CAST('abc' as binary)       as const05, @arg05 as param05,
 
4707
'1991-08-05'                as const06, @arg06 as param06,
 
4708
CAST('1991-08-05' as date)  as const07, @arg07 as param07,
 
4709
'1991-08-05 01:01:01'       as const08, @arg08 as param08,
 
4710
CAST('1991-08-05 01:01:01'  as datetime) as const09, @arg09 as param09,
 
4711
unix_timestamp('1991-01-01 01:01:01')    as const10, @arg10 as param10,
 
4712
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, 
 
4713
NULL                        as const12, @arg12 as param12,
 
4714
@arg13 as param13,
 
4715
@arg14 as param14,
 
4716
@arg15 as param15;
 
4717
show create table t5 ;
 
4718
Table   Create Table
 
4719
t5      CREATE TABLE `t5` (
 
4720
  `const01` int(1) NOT NULL DEFAULT '0',
 
4721
  `param01` bigint(20) DEFAULT NULL,
 
4722
  `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
 
4723
  `param02` decimal(65,30) DEFAULT NULL,
 
4724
  `const03` double NOT NULL DEFAULT '0',
 
4725
  `param03` double DEFAULT NULL,
 
4726
  `const04` varchar(3) NOT NULL DEFAULT '',
 
4727
  `param04` longtext,
 
4728
  `const05` varbinary(3) NOT NULL DEFAULT '',
 
4729
  `param05` longblob,
 
4730
  `const06` varchar(10) NOT NULL DEFAULT '',
 
4731
  `param06` longtext,
 
4732
  `const07` date DEFAULT NULL,
 
4733
  `param07` longblob,
 
4734
  `const08` varchar(19) NOT NULL DEFAULT '',
 
4735
  `param08` longtext,
 
4736
  `const09` datetime DEFAULT NULL,
 
4737
  `param09` longblob,
 
4738
  `const10` int(10) NOT NULL DEFAULT '0',
 
4739
  `param10` bigint(20) DEFAULT NULL,
 
4740
  `const11` int(4) DEFAULT NULL,
 
4741
  `param11` bigint(20) DEFAULT NULL,
 
4742
  `const12` binary(0) DEFAULT NULL,
 
4743
  `param12` bigint(20) DEFAULT NULL,
 
4744
  `param13` decimal(65,30) DEFAULT NULL,
 
4745
  `param14` longtext,
 
4746
  `param15` longblob
 
4747
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
4748
select * from t5 ;
 
4749
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4750
def     test    t5      t5      const01 const01 3       1       1       N       32769   0       63
 
4751
def     test    t5      t5      param01 param01 8       20      1       Y       32768   0       63
 
4752
def     test    t5      t5      const02 const02 246     4       3       N       1       1       63
 
4753
def     test    t5      t5      param02 param02 246     67      32      Y       0       30      63
 
4754
def     test    t5      t5      const03 const03 5       17      1       N       32769   31      63
 
4755
def     test    t5      t5      param03 param03 5       23      1       Y       32768   31      63
 
4756
def     test    t5      t5      const04 const04 253     3       3       N       1       0       8
 
4757
def     test    t5      t5      param04 param04 252     4294967295      3       Y       16      0       8
 
4758
def     test    t5      t5      const05 const05 253     3       3       N       129     0       63
 
4759
def     test    t5      t5      param05 param05 252     4294967295      3       Y       144     0       63
 
4760
def     test    t5      t5      const06 const06 253     10      10      N       1       0       8
 
4761
def     test    t5      t5      param06 param06 252     4294967295      10      Y       16      0       8
 
4762
def     test    t5      t5      const07 const07 10      10      10      Y       128     0       63
 
4763
def     test    t5      t5      param07 param07 252     4294967295      10      Y       144     0       63
 
4764
def     test    t5      t5      const08 const08 253     19      19      N       1       0       8
 
4765
def     test    t5      t5      param08 param08 252     4294967295      19      Y       16      0       8
 
4766
def     test    t5      t5      const09 const09 12      19      19      Y       128     0       63
 
4767
def     test    t5      t5      param09 param09 252     4294967295      19      Y       144     0       63
 
4768
def     test    t5      t5      const10 const10 3       10      9       N       32769   0       63
 
4769
def     test    t5      t5      param10 param10 8       20      9       Y       32768   0       63
 
4770
def     test    t5      t5      const11 const11 3       4       4       Y       32768   0       63
 
4771
def     test    t5      t5      param11 param11 8       20      4       Y       32768   0       63
 
4772
def     test    t5      t5      const12 const12 254     0       0       Y       128     0       63
 
4773
def     test    t5      t5      param12 param12 8       20      0       Y       32768   0       63
 
4774
def     test    t5      t5      param13 param13 246     67      0       Y       0       30      63
 
4775
def     test    t5      t5      param14 param14 252     4294967295      0       Y       16      0       8
 
4776
def     test    t5      t5      param15 param15 252     4294967295      0       Y       144     0       63
 
4777
const01 8
 
4778
param01 8
 
4779
const02 8.0
 
4780
param02 8.000000000000000000000000000000
 
4781
const03 8
 
4782
param03 8
 
4783
const04 abc
 
4784
param04 abc
 
4785
const05 abc
 
4786
param05 abc
 
4787
const06 1991-08-05
 
4788
param06 1991-08-05
 
4789
const07 1991-08-05
 
4790
param07 1991-08-05
 
4791
const08 1991-08-05 01:01:01
 
4792
param08 1991-08-05 01:01:01
 
4793
const09 1991-08-05 01:01:01
 
4794
param09 1991-08-05 01:01:01
 
4795
const10 662680861
 
4796
param10 662680861
 
4797
const11 1991
 
4798
param11 1991
 
4799
const12 NULL
 
4800
param12 NULL
 
4801
param13 NULL
 
4802
param14 NULL
 
4803
param15 NULL
 
4804
drop table t5 ;
 
4805
test_sequence
 
4806
------ data type conversion tests ------
 
4807
delete from t1 ;
 
4808
insert into t1 values (1,'one');
 
4809
insert into t1 values (2,'two');
 
4810
insert into t1 values (3,'three');
 
4811
insert into t1 values (4,'four');
 
4812
commit ;
 
4813
delete from t9 ;
 
4814
insert into t9
 
4815
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
 
4816
c10= 1, c11= 1, c12 = 1,
 
4817
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4818
c16= '11:11:11', c17= '2004',
 
4819
c18= 1, c19=true, c20= 'a', c21= '123456789a', 
 
4820
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4821
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4822
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
 
4823
insert into t9
 
4824
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
 
4825
c10= 9, c11= 9, c12 = 9,
 
4826
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
 
4827
c16= '11:11:11', c17= '2004',
 
4828
c18= 1, c19=false, c20= 'a', c21= '123456789a', 
 
4829
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
 
4830
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
 
4831
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
 
4832
commit ;
 
4833
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
 
4834
select * from t9 order by c1 ;
 
4835
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c11     c12     c13     c14     c15     c16     c17     c18     c19     c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30     c31     c32
 
4836
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
4837
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
4838
9       9       9       9       9       9       9       9       9       9       9.0000  9.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       0       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        two     tuesday
 
4839
test_sequence
 
4840
------ select @parameter:= column ------
 
4841
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
 
4842
       @arg05, @arg06, @arg07, @arg08,
 
4843
       @arg09, @arg10, @arg11, @arg12,
 
4844
       @arg13, @arg14, @arg15, @arg16,
 
4845
       @arg17, @arg18, @arg19, @arg20,
 
4846
       @arg21, @arg22, @arg23, @arg24,
 
4847
       @arg25, @arg26, @arg27, @arg28,
 
4848
       @arg29, @arg30, @arg31, @arg32" ;
 
4849
select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
4850
@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
4851
@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
4852
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
4853
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
4854
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
4855
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
4856
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
4857
from t9 where c1= 1 ;
 
4858
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
4859
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
4860
execute full_info ;
 
4861
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4862
def                                     @arg01  8       20      1       Y       32896   0       63
 
4863
def                                     @arg02  8       20      1       Y       32896   0       63
 
4864
def                                     @arg03  8       20      1       Y       32896   0       63
 
4865
def                                     @arg04  8       20      1       Y       32896   0       63
 
4866
def                                     @arg05  8       20      1       Y       32896   0       63
 
4867
def                                     @arg06  8       20      1       Y       32896   0       63
 
4868
def                                     @arg07  5       23      1       Y       32896   31      63
 
4869
def                                     @arg08  5       23      1       Y       32896   31      63
 
4870
def                                     @arg09  5       23      1       Y       32896   31      63
 
4871
def                                     @arg10  5       23      1       Y       32896   31      63
 
4872
def                                     @arg11  246     83      6       Y       128     30      63
 
4873
def                                     @arg12  246     83      6       Y       128     30      63
 
4874
def                                     @arg13  251     16777216        10      Y       128     31      63
 
4875
def                                     @arg14  251     16777216        19      Y       128     31      63
 
4876
def                                     @arg15  251     16777216        19      Y       128     31      63
 
4877
def                                     @arg16  251     16777216        8       Y       128     31      63
 
4878
def                                     @arg17  8       20      4       Y       32928   0       63
 
4879
def                                     @arg18  8       20      1       Y       32896   0       63
 
4880
def                                     @arg19  8       20      1       Y       32896   0       63
 
4881
def                                     @arg20  251     16777216        1       Y       0       31      8
 
4882
def                                     @arg21  251     16777216        10      Y       0       31      8
 
4883
def                                     @arg22  251     16777216        30      Y       0       31      8
 
4884
def                                     @arg23  251     16777216        8       Y       128     31      63
 
4885
def                                     @arg24  251     16777216        8       Y       0       31      8
 
4886
def                                     @arg25  251     16777216        4       Y       128     31      63
 
4887
def                                     @arg26  251     16777216        4       Y       0       31      8
 
4888
def                                     @arg27  251     16777216        10      Y       128     31      63
 
4889
def                                     @arg28  251     16777216        10      Y       0       31      8
 
4890
def                                     @arg29  251     16777216        8       Y       128     31      63
 
4891
def                                     @arg30  251     16777216        8       Y       0       31      8
 
4892
def                                     @arg31  251     16777216        3       Y       0       31      8
 
4893
def                                     @arg32  251     16777216        6       Y       0       31      8
 
4894
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
4895
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
4896
select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
4897
@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
4898
@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
4899
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
4900
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
4901
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
4902
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
4903
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
4904
from t9 where c1= 0 ;
 
4905
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
4906
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
4907
execute full_info ;
 
4908
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4909
def                                     @arg01  8       20      1       Y       32896   0       63
 
4910
def                                     @arg02  8       20      0       Y       32896   0       63
 
4911
def                                     @arg03  8       20      0       Y       32896   0       63
 
4912
def                                     @arg04  8       20      0       Y       32896   0       63
 
4913
def                                     @arg05  8       20      0       Y       32896   0       63
 
4914
def                                     @arg06  8       20      0       Y       32896   0       63
 
4915
def                                     @arg07  5       23      0       Y       32896   31      63
 
4916
def                                     @arg08  5       23      0       Y       32896   31      63
 
4917
def                                     @arg09  5       23      0       Y       32896   31      63
 
4918
def                                     @arg10  5       23      0       Y       32896   31      63
 
4919
def                                     @arg11  246     83      0       Y       128     30      63
 
4920
def                                     @arg12  246     83      0       Y       128     30      63
 
4921
def                                     @arg13  251     16777216        0       Y       128     31      63
 
4922
def                                     @arg14  251     16777216        0       Y       128     31      63
 
4923
def                                     @arg15  251     16777216        19      Y       128     31      63
 
4924
def                                     @arg16  251     16777216        0       Y       128     31      63
 
4925
def                                     @arg17  8       20      0       Y       32928   0       63
 
4926
def                                     @arg18  8       20      0       Y       32896   0       63
 
4927
def                                     @arg19  8       20      0       Y       32896   0       63
 
4928
def                                     @arg20  251     16777216        0       Y       0       31      8
 
4929
def                                     @arg21  251     16777216        0       Y       0       31      8
 
4930
def                                     @arg22  251     16777216        0       Y       0       31      8
 
4931
def                                     @arg23  251     16777216        0       Y       128     31      63
 
4932
def                                     @arg24  251     16777216        0       Y       0       31      8
 
4933
def                                     @arg25  251     16777216        0       Y       128     31      63
 
4934
def                                     @arg26  251     16777216        0       Y       0       31      8
 
4935
def                                     @arg27  251     16777216        0       Y       128     31      63
 
4936
def                                     @arg28  251     16777216        0       Y       0       31      8
 
4937
def                                     @arg29  251     16777216        0       Y       128     31      63
 
4938
def                                     @arg30  251     16777216        0       Y       0       31      8
 
4939
def                                     @arg31  251     16777216        0       Y       0       31      8
 
4940
def                                     @arg32  251     16777216        0       Y       0       31      8
 
4941
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
4942
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
4943
prepare stmt1 from "select 
 
4944
       @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
 
4945
       @arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
 
4946
       @arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
 
4947
       @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
 
4948
       @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
 
4949
       @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
 
4950
       @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
 
4951
       @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
 
4952
from t9 where c1= ?" ;
 
4953
set @my_key= 1 ;
 
4954
execute stmt1 using @my_key ;
 
4955
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
4956
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
4957
execute full_info ;
 
4958
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4959
def                                     @arg01  8       20      1       Y       32896   0       63
 
4960
def                                     @arg02  8       20      1       Y       32896   0       63
 
4961
def                                     @arg03  8       20      1       Y       32896   0       63
 
4962
def                                     @arg04  8       20      1       Y       32896   0       63
 
4963
def                                     @arg05  8       20      1       Y       32896   0       63
 
4964
def                                     @arg06  8       20      1       Y       32896   0       63
 
4965
def                                     @arg07  5       23      1       Y       32896   31      63
 
4966
def                                     @arg08  5       23      1       Y       32896   31      63
 
4967
def                                     @arg09  5       23      1       Y       32896   31      63
 
4968
def                                     @arg10  5       23      1       Y       32896   31      63
 
4969
def                                     @arg11  246     83      6       Y       128     30      63
 
4970
def                                     @arg12  246     83      6       Y       128     30      63
 
4971
def                                     @arg13  251     16777216        10      Y       128     31      63
 
4972
def                                     @arg14  251     16777216        19      Y       128     31      63
 
4973
def                                     @arg15  251     16777216        19      Y       128     31      63
 
4974
def                                     @arg16  251     16777216        8       Y       128     31      63
 
4975
def                                     @arg17  8       20      4       Y       32928   0       63
 
4976
def                                     @arg18  8       20      1       Y       32896   0       63
 
4977
def                                     @arg19  8       20      1       Y       32896   0       63
 
4978
def                                     @arg20  251     16777216        1       Y       0       31      8
 
4979
def                                     @arg21  251     16777216        10      Y       0       31      8
 
4980
def                                     @arg22  251     16777216        30      Y       0       31      8
 
4981
def                                     @arg23  251     16777216        8       Y       128     31      63
 
4982
def                                     @arg24  251     16777216        8       Y       0       31      8
 
4983
def                                     @arg25  251     16777216        4       Y       128     31      63
 
4984
def                                     @arg26  251     16777216        4       Y       0       31      8
 
4985
def                                     @arg27  251     16777216        10      Y       128     31      63
 
4986
def                                     @arg28  251     16777216        10      Y       0       31      8
 
4987
def                                     @arg29  251     16777216        8       Y       128     31      63
 
4988
def                                     @arg30  251     16777216        8       Y       0       31      8
 
4989
def                                     @arg31  251     16777216        3       Y       0       31      8
 
4990
def                                     @arg32  251     16777216        6       Y       0       31      8
 
4991
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
4992
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
4993
set @my_key= 0 ;
 
4994
execute stmt1 using @my_key ;
 
4995
@arg01:=  c1    @arg02:=  c2    @arg03:=  c3    @arg04:=  c4    @arg05:=  c5    @arg06:=  c6    @arg07:=  c7    @arg08:=  c8    @arg09:=  c9    @arg10:= c10    @arg11:= c11    @arg12:= c12    @arg13:= c13    @arg14:= c14    @arg15:= c15    @arg16:= c16    @arg17:= c17    @arg18:= c18    @arg19:= c19    @arg20:= c20    @arg21:= c21    @arg22:= c22    @arg23:= c23    @arg24:= c24    @arg25:= c25    @arg26:= c26    @arg27:= c27    @arg28:= c28    @arg29:= c29    @arg30:= c30    @arg31:= c31    @arg32:= c32
 
4996
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
4997
execute full_info ;
 
4998
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
4999
def                                     @arg01  8       20      1       Y       32896   0       63
 
5000
def                                     @arg02  8       20      0       Y       32896   0       63
 
5001
def                                     @arg03  8       20      0       Y       32896   0       63
 
5002
def                                     @arg04  8       20      0       Y       32896   0       63
 
5003
def                                     @arg05  8       20      0       Y       32896   0       63
 
5004
def                                     @arg06  8       20      0       Y       32896   0       63
 
5005
def                                     @arg07  5       23      0       Y       32896   31      63
 
5006
def                                     @arg08  5       23      0       Y       32896   31      63
 
5007
def                                     @arg09  5       23      0       Y       32896   31      63
 
5008
def                                     @arg10  5       23      0       Y       32896   31      63
 
5009
def                                     @arg11  246     83      0       Y       128     30      63
 
5010
def                                     @arg12  246     83      0       Y       128     30      63
 
5011
def                                     @arg13  251     16777216        0       Y       128     31      63
 
5012
def                                     @arg14  251     16777216        0       Y       128     31      63
 
5013
def                                     @arg15  251     16777216        19      Y       128     31      63
 
5014
def                                     @arg16  251     16777216        0       Y       128     31      63
 
5015
def                                     @arg17  8       20      0       Y       32928   0       63
 
5016
def                                     @arg18  8       20      0       Y       32896   0       63
 
5017
def                                     @arg19  8       20      0       Y       32896   0       63
 
5018
def                                     @arg20  251     16777216        0       Y       0       31      8
 
5019
def                                     @arg21  251     16777216        0       Y       0       31      8
 
5020
def                                     @arg22  251     16777216        0       Y       0       31      8
 
5021
def                                     @arg23  251     16777216        0       Y       128     31      63
 
5022
def                                     @arg24  251     16777216        0       Y       0       31      8
 
5023
def                                     @arg25  251     16777216        0       Y       128     31      63
 
5024
def                                     @arg26  251     16777216        0       Y       0       31      8
 
5025
def                                     @arg27  251     16777216        0       Y       128     31      63
 
5026
def                                     @arg28  251     16777216        0       Y       0       31      8
 
5027
def                                     @arg29  251     16777216        0       Y       128     31      63
 
5028
def                                     @arg30  251     16777216        0       Y       0       31      8
 
5029
def                                     @arg31  251     16777216        0       Y       0       31      8
 
5030
def                                     @arg32  251     16777216        0       Y       0       31      8
 
5031
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
5032
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5033
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
 
5034
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
 
5035
test_sequence
 
5036
------ select column, .. into @parm,.. ------
 
5037
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
5038
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
5039
c25, c26, c27, c28, c29, c30, c31, c32
 
5040
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
5041
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
5042
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
5043
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
5044
from t9 where c1= 1 ;
 
5045
execute full_info ;
 
5046
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
5047
def                                     @arg01  8       20      1       Y       32896   0       63
 
5048
def                                     @arg02  8       20      1       Y       32896   0       63
 
5049
def                                     @arg03  8       20      1       Y       32896   0       63
 
5050
def                                     @arg04  8       20      1       Y       32896   0       63
 
5051
def                                     @arg05  8       20      1       Y       32896   0       63
 
5052
def                                     @arg06  8       20      1       Y       32896   0       63
 
5053
def                                     @arg07  5       23      1       Y       32896   31      63
 
5054
def                                     @arg08  5       23      1       Y       32896   31      63
 
5055
def                                     @arg09  5       23      1       Y       32896   31      63
 
5056
def                                     @arg10  5       23      1       Y       32896   31      63
 
5057
def                                     @arg11  246     83      6       Y       128     30      63
 
5058
def                                     @arg12  246     83      6       Y       128     30      63
 
5059
def                                     @arg13  251     16777216        10      Y       128     31      63
 
5060
def                                     @arg14  251     16777216        19      Y       128     31      63
 
5061
def                                     @arg15  251     16777216        19      Y       128     31      63
 
5062
def                                     @arg16  251     16777216        8       Y       128     31      63
 
5063
def                                     @arg17  8       20      4       Y       32928   0       63
 
5064
def                                     @arg18  8       20      1       Y       32896   0       63
 
5065
def                                     @arg19  8       20      1       Y       32896   0       63
 
5066
def                                     @arg20  251     16777216        1       Y       0       31      8
 
5067
def                                     @arg21  251     16777216        10      Y       0       31      8
 
5068
def                                     @arg22  251     16777216        30      Y       0       31      8
 
5069
def                                     @arg23  251     16777216        8       Y       128     31      63
 
5070
def                                     @arg24  251     16777216        8       Y       0       31      8
 
5071
def                                     @arg25  251     16777216        4       Y       128     31      63
 
5072
def                                     @arg26  251     16777216        4       Y       0       31      8
 
5073
def                                     @arg27  251     16777216        10      Y       128     31      63
 
5074
def                                     @arg28  251     16777216        10      Y       0       31      8
 
5075
def                                     @arg29  251     16777216        8       Y       128     31      63
 
5076
def                                     @arg30  251     16777216        8       Y       0       31      8
 
5077
def                                     @arg31  251     16777216        3       Y       0       31      8
 
5078
def                                     @arg32  251     16777216        6       Y       0       31      8
 
5079
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
5080
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
5081
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
5082
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
5083
c25, c26, c27, c28, c29, c30, c31, c32
 
5084
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
5085
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
5086
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
5087
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
5088
from t9 where c1= 0 ;
 
5089
execute full_info ;
 
5090
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
5091
def                                     @arg01  8       20      1       Y       32896   0       63
 
5092
def                                     @arg02  8       20      0       Y       32896   0       63
 
5093
def                                     @arg03  8       20      0       Y       32896   0       63
 
5094
def                                     @arg04  8       20      0       Y       32896   0       63
 
5095
def                                     @arg05  8       20      0       Y       32896   0       63
 
5096
def                                     @arg06  8       20      0       Y       32896   0       63
 
5097
def                                     @arg07  5       23      0       Y       32896   31      63
 
5098
def                                     @arg08  5       23      0       Y       32896   31      63
 
5099
def                                     @arg09  5       23      0       Y       32896   31      63
 
5100
def                                     @arg10  5       23      0       Y       32896   31      63
 
5101
def                                     @arg11  246     83      0       Y       128     30      63
 
5102
def                                     @arg12  246     83      0       Y       128     30      63
 
5103
def                                     @arg13  251     16777216        0       Y       128     31      63
 
5104
def                                     @arg14  251     16777216        0       Y       128     31      63
 
5105
def                                     @arg15  251     16777216        19      Y       128     31      63
 
5106
def                                     @arg16  251     16777216        0       Y       128     31      63
 
5107
def                                     @arg17  8       20      0       Y       32928   0       63
 
5108
def                                     @arg18  8       20      0       Y       32896   0       63
 
5109
def                                     @arg19  8       20      0       Y       32896   0       63
 
5110
def                                     @arg20  251     16777216        0       Y       0       31      8
 
5111
def                                     @arg21  251     16777216        0       Y       0       31      8
 
5112
def                                     @arg22  251     16777216        0       Y       0       31      8
 
5113
def                                     @arg23  251     16777216        0       Y       128     31      63
 
5114
def                                     @arg24  251     16777216        0       Y       0       31      8
 
5115
def                                     @arg25  251     16777216        0       Y       128     31      63
 
5116
def                                     @arg26  251     16777216        0       Y       0       31      8
 
5117
def                                     @arg27  251     16777216        0       Y       128     31      63
 
5118
def                                     @arg28  251     16777216        0       Y       0       31      8
 
5119
def                                     @arg29  251     16777216        0       Y       128     31      63
 
5120
def                                     @arg30  251     16777216        0       Y       0       31      8
 
5121
def                                     @arg31  251     16777216        0       Y       0       31      8
 
5122
def                                     @arg32  251     16777216        0       Y       0       31      8
 
5123
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
5124
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5125
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
 
5126
       c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
 
5127
       c25, c26, c27, c28, c29, c30, c31, c32
 
5128
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
 
5129
     @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
 
5130
     @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
 
5131
     @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
 
5132
from t9 where c1= ?" ;
 
5133
set @my_key= 1 ;
 
5134
execute stmt1 using @my_key ;
 
5135
execute full_info ;
 
5136
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
5137
def                                     @arg01  8       20      1       Y       32896   0       63
 
5138
def                                     @arg02  8       20      1       Y       32896   0       63
 
5139
def                                     @arg03  8       20      1       Y       32896   0       63
 
5140
def                                     @arg04  8       20      1       Y       32896   0       63
 
5141
def                                     @arg05  8       20      1       Y       32896   0       63
 
5142
def                                     @arg06  8       20      1       Y       32896   0       63
 
5143
def                                     @arg07  5       23      1       Y       32896   31      63
 
5144
def                                     @arg08  5       23      1       Y       32896   31      63
 
5145
def                                     @arg09  5       23      1       Y       32896   31      63
 
5146
def                                     @arg10  5       23      1       Y       32896   31      63
 
5147
def                                     @arg11  246     83      6       Y       128     30      63
 
5148
def                                     @arg12  246     83      6       Y       128     30      63
 
5149
def                                     @arg13  251     16777216        10      Y       128     31      63
 
5150
def                                     @arg14  251     16777216        19      Y       128     31      63
 
5151
def                                     @arg15  251     16777216        19      Y       128     31      63
 
5152
def                                     @arg16  251     16777216        8       Y       128     31      63
 
5153
def                                     @arg17  8       20      4       Y       32928   0       63
 
5154
def                                     @arg18  8       20      1       Y       32896   0       63
 
5155
def                                     @arg19  8       20      1       Y       32896   0       63
 
5156
def                                     @arg20  251     16777216        1       Y       0       31      8
 
5157
def                                     @arg21  251     16777216        10      Y       0       31      8
 
5158
def                                     @arg22  251     16777216        30      Y       0       31      8
 
5159
def                                     @arg23  251     16777216        8       Y       128     31      63
 
5160
def                                     @arg24  251     16777216        8       Y       0       31      8
 
5161
def                                     @arg25  251     16777216        4       Y       128     31      63
 
5162
def                                     @arg26  251     16777216        4       Y       0       31      8
 
5163
def                                     @arg27  251     16777216        10      Y       128     31      63
 
5164
def                                     @arg28  251     16777216        10      Y       0       31      8
 
5165
def                                     @arg29  251     16777216        8       Y       128     31      63
 
5166
def                                     @arg30  251     16777216        8       Y       0       31      8
 
5167
def                                     @arg31  251     16777216        3       Y       0       31      8
 
5168
def                                     @arg32  251     16777216        6       Y       0       31      8
 
5169
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
5170
1       1       1       1       1       1       1       1       1       1       1.0000  1.0000  2004-02-29      2004-02-29 11:11:11     2004-02-29 11:11:11     11:11:11        2004    1       1       a       123456789a      123456789a123456789b123456789c  tinyblob        tinytext        blob    text    mediumblob      mediumtext      longblob        longtext        one     monday
 
5171
set @my_key= 0 ;
 
5172
execute stmt1 using @my_key ;
 
5173
execute full_info ;
 
5174
Catalog Database        Table   Table_alias     Column  Column_alias    Type    Length  Max length      Is_null Flags   Decimals        Charsetnr
 
5175
def                                     @arg01  8       20      1       Y       32896   0       63
 
5176
def                                     @arg02  8       20      0       Y       32896   0       63
 
5177
def                                     @arg03  8       20      0       Y       32896   0       63
 
5178
def                                     @arg04  8       20      0       Y       32896   0       63
 
5179
def                                     @arg05  8       20      0       Y       32896   0       63
 
5180
def                                     @arg06  8       20      0       Y       32896   0       63
 
5181
def                                     @arg07  5       23      0       Y       32896   31      63
 
5182
def                                     @arg08  5       23      0       Y       32896   31      63
 
5183
def                                     @arg09  5       23      0       Y       32896   31      63
 
5184
def                                     @arg10  5       23      0       Y       32896   31      63
 
5185
def                                     @arg11  246     83      0       Y       128     30      63
 
5186
def                                     @arg12  246     83      0       Y       128     30      63
 
5187
def                                     @arg13  251     16777216        0       Y       128     31      63
 
5188
def                                     @arg14  251     16777216        0       Y       128     31      63
 
5189
def                                     @arg15  251     16777216        19      Y       128     31      63
 
5190
def                                     @arg16  251     16777216        0       Y       128     31      63
 
5191
def                                     @arg17  8       20      0       Y       32928   0       63
 
5192
def                                     @arg18  8       20      0       Y       32896   0       63
 
5193
def                                     @arg19  8       20      0       Y       32896   0       63
 
5194
def                                     @arg20  251     16777216        0       Y       0       31      8
 
5195
def                                     @arg21  251     16777216        0       Y       0       31      8
 
5196
def                                     @arg22  251     16777216        0       Y       0       31      8
 
5197
def                                     @arg23  251     16777216        0       Y       128     31      63
 
5198
def                                     @arg24  251     16777216        0       Y       0       31      8
 
5199
def                                     @arg25  251     16777216        0       Y       128     31      63
 
5200
def                                     @arg26  251     16777216        0       Y       0       31      8
 
5201
def                                     @arg27  251     16777216        0       Y       128     31      63
 
5202
def                                     @arg28  251     16777216        0       Y       0       31      8
 
5203
def                                     @arg29  251     16777216        0       Y       128     31      63
 
5204
def                                     @arg30  251     16777216        0       Y       0       31      8
 
5205
def                                     @arg31  251     16777216        0       Y       0       31      8
 
5206
def                                     @arg32  251     16777216        0       Y       0       31      8
 
5207
@arg01  @arg02  @arg03  @arg04  @arg05  @arg06  @arg07  @arg08  @arg09  @arg10  @arg11  @arg12  @arg13  @arg14  @arg15  @arg16  @arg17  @arg18  @arg19  @arg20  @arg21  @arg22  @arg23  @arg24  @arg25  @arg26  @arg27  @arg28  @arg29  @arg30  @arg31  @arg32
 
5208
0       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    1991-01-01 01:01:01     NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5209
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
 
5210
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
 
5211
test_sequence
 
5212
-- insert into numeric columns --
 
5213
insert into t9 
 
5214
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5215
values
 
5216
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
 
5217
set @arg00= 21 ;
 
5218
insert into t9 
 
5219
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5220
values
 
5221
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5222
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5223
prepare stmt1 from "insert into t9 
 
5224
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5225
values
 
5226
  ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
 
5227
execute stmt1 ;
 
5228
set @arg00= 23;
 
5229
prepare stmt2 from "insert into t9 
 
5230
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5231
values 
 
5232
  (  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5233
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5234
@arg00, @arg00, @arg00, @arg00 ;
 
5235
insert into t9 
 
5236
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5237
values
 
5238
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
 
5239
30.0, 30.0, 30.0 ) ;
 
5240
set @arg00= 31.0 ;
 
5241
insert into t9 
 
5242
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5243
values
 
5244
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5245
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5246
prepare stmt1 from "insert into t9 
 
5247
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5248
values
 
5249
  ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
 
5250
    32.0, 32.0, 32.0 )" ;
 
5251
execute stmt1 ;
 
5252
set @arg00= 33.0;
 
5253
prepare stmt2 from "insert into t9 
 
5254
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5255
values 
 
5256
  (  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
 
5257
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5258
@arg00, @arg00, @arg00, @arg00 ;
 
5259
insert into t9 
 
5260
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5261
values
 
5262
( '40', '40', '40', '40', '40', '40', '40', '40',
 
5263
'40', '40', '40' ) ;
 
5264
set @arg00= '41' ;
 
5265
insert into t9 
 
5266
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5267
values
 
5268
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5269
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5270
prepare stmt1 from "insert into t9 
 
5271
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5272
values
 
5273
  ( '42', '42', '42', '42', '42', '42', '42', '42',
 
5274
    '42', '42', '42' )" ;
 
5275
execute stmt1 ;
 
5276
set @arg00= '43';
 
5277
prepare stmt2 from "insert into t9 
 
5278
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5279
values 
 
5280
  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5281
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5282
@arg00, @arg00, @arg00, @arg00 ;
 
5283
insert into t9 
 
5284
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5285
values
 
5286
( CAST('50' as binary), CAST('50' as binary), 
 
5287
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 
 
5288
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
 
5289
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
 
5290
set @arg00= CAST('51' as binary) ;
 
5291
insert into t9 
 
5292
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5293
values
 
5294
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5295
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5296
prepare stmt1 from "insert into t9 
 
5297
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5298
values
 
5299
  ( CAST('52' as binary), CAST('52' as binary),
 
5300
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 
 
5301
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
 
5302
  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
 
5303
execute stmt1 ;
 
5304
set @arg00= CAST('53' as binary) ;
 
5305
prepare stmt2 from "insert into t9 
 
5306
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5307
values 
 
5308
  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5309
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5310
@arg00, @arg00, @arg00, @arg00 ;
 
5311
set @arg00= 2 ;
 
5312
set @arg00= NULL ;
 
5313
insert into t9
 
5314
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5315
values
 
5316
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
5317
NULL, NULL, NULL ) ;
 
5318
insert into t9
 
5319
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5320
values
 
5321
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5322
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5323
prepare stmt1 from "insert into t9
 
5324
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5325
values
 
5326
  ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
5327
    NULL, NULL, NULL )" ;
 
5328
execute stmt1 ;
 
5329
prepare stmt2 from "insert into t9
 
5330
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5331
values
 
5332
  ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5333
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5334
@arg00, @arg00, @arg00, @arg00 ;
 
5335
set @arg00= 8.0 ;
 
5336
set @arg00= NULL ;
 
5337
insert into t9
 
5338
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5339
values
 
5340
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5341
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5342
prepare stmt2 from "insert into t9
 
5343
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5344
values
 
5345
  ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5346
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5347
@arg00, @arg00, @arg00, @arg00 ;
 
5348
set @arg00= 'abc' ;
 
5349
set @arg00= NULL ;
 
5350
insert into t9
 
5351
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5352
values
 
5353
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5354
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
 
5355
prepare stmt2 from "insert into t9
 
5356
  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5357
values
 
5358
  ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
 
5359
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5360
@arg00, @arg00, @arg00, @arg00 ;
 
5361
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
 
5362
from t9 where c1 >= 20
 
5363
order by c1 ;
 
5364
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c12
 
5365
20      20      20      20      20      20      20      20      20      20      20.0000
 
5366
21      21      21      21      21      21      21      21      21      21      21.0000
 
5367
22      22      22      22      22      22      22      22      22      22      22.0000
 
5368
23      23      23      23      23      23      23      23      23      23      23.0000
 
5369
30      30      30      30      30      30      30      30      30      30      30.0000
 
5370
31      31      31      31      31      31      31      31      31      31      31.0000
 
5371
32      32      32      32      32      32      32      32      32      32      32.0000
 
5372
33      33      33      33      33      33      33      33      33      33      33.0000
 
5373
40      40      40      40      40      40      40      40      40      40      40.0000
 
5374
41      41      41      41      41      41      41      41      41      41      41.0000
 
5375
42      42      42      42      42      42      42      42      42      42      42.0000
 
5376
43      43      43      43      43      43      43      43      43      43      43.0000
 
5377
50      50      50      50      50      50      50      50      50      50      50.0000
 
5378
51      51      51      51      51      51      51      51      51      51      51.0000
 
5379
52      52      52      52      52      52      52      52      52      52      52.0000
 
5380
53      53      53      53      53      53      53      53      53      53      53.0000
 
5381
60      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5382
61      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5383
62      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5384
63      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5385
71      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5386
73      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5387
81      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5388
83      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5389
test_sequence
 
5390
-- select .. where numeric column = .. --
 
5391
set @arg00= 20;
 
5392
select 'true' as found from t9 
 
5393
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
 
5394
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
 
5395
found
 
5396
true
 
5397
select 'true' as found from t9 
 
5398
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
5399
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
5400
and c12= @arg00;
 
5401
found
 
5402
true
 
5403
prepare stmt1 from "select 'true' as found from t9 
 
5404
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
 
5405
  and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
 
5406
execute stmt1 ;
 
5407
found
 
5408
true
 
5409
prepare stmt1 from "select 'true' as found from t9 
 
5410
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
5411
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
5412
  and c12= ? ";
 
5413
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5414
@arg00, @arg00, @arg00, @arg00 ;
 
5415
found
 
5416
true
 
5417
set @arg00= 20.0;
 
5418
select 'true' as found from t9 
 
5419
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
 
5420
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
 
5421
found
 
5422
true
 
5423
select 'true' as found from t9 
 
5424
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
5425
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
5426
and c12= @arg00;
 
5427
found
 
5428
true
 
5429
prepare stmt1 from "select 'true' as found from t9 
 
5430
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
 
5431
  and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
 
5432
execute stmt1 ;
 
5433
found
 
5434
true
 
5435
prepare stmt1 from "select 'true' as found from t9 
 
5436
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
5437
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
5438
  and c12= ? ";
 
5439
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5440
@arg00, @arg00, @arg00, @arg00 ;
 
5441
found
 
5442
true
 
5443
select 'true' as found from t9 
 
5444
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
 
5445
  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
 
5446
found
 
5447
true
 
5448
prepare stmt1 from "select 'true' as found from t9
 
5449
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
 
5450
  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
 
5451
execute stmt1 ;
 
5452
found
 
5453
true
 
5454
set @arg00= '20';
 
5455
select 'true' as found from t9 
 
5456
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
5457
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
5458
and c12= @arg00;
 
5459
found
 
5460
true
 
5461
prepare stmt1 from "select 'true' as found from t9 
 
5462
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
5463
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
5464
  and c12= ? ";
 
5465
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5466
@arg00, @arg00, @arg00, @arg00 ;
 
5467
found
 
5468
true
 
5469
select 'true' as found from t9 
 
5470
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 
 
5471
c3= CAST('20' as binary) and c4= CAST('20' as binary) and 
 
5472
c5= CAST('20' as binary) and c6= CAST('20' as binary) and 
 
5473
c7= CAST('20' as binary) and c8= CAST('20' as binary) and 
 
5474
c9= CAST('20' as binary) and c10= CAST('20' as binary) and 
 
5475
c12= CAST('20' as binary);
 
5476
found
 
5477
true
 
5478
prepare stmt1 from "select 'true' as found from t9
 
5479
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 
 
5480
      c3= CAST('20' as binary) and c4= CAST('20' as binary) and 
 
5481
      c5= CAST('20' as binary) and c6= CAST('20' as binary) and 
 
5482
      c7= CAST('20' as binary) and c8= CAST('20' as binary) and 
 
5483
      c9= CAST('20' as binary) and c10= CAST('20' as binary) and 
 
5484
      c12= CAST('20' as binary) ";
 
5485
execute stmt1 ;
 
5486
found
 
5487
true
 
5488
set @arg00= CAST('20' as binary) ;
 
5489
select 'true' as found from t9 
 
5490
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 
 
5491
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
 
5492
and c12= @arg00;
 
5493
found
 
5494
true
 
5495
prepare stmt1 from "select 'true' as found from t9 
 
5496
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 
 
5497
  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
 
5498
  and c12= ? ";
 
5499
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5500
@arg00, @arg00, @arg00, @arg00 ;
 
5501
found
 
5502
true
 
5503
delete from t9 ;
 
5504
test_sequence
 
5505
-- some numeric overflow experiments --
 
5506
prepare my_insert from "insert into t9 
 
5507
   ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
 
5508
values 
 
5509
   ( 'O',  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
 
5510
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
 
5511
from t9 where c21 = 'O' ";
 
5512
prepare my_delete from "delete from t9 where c21 = 'O' ";
 
5513
set @arg00= 9223372036854775807 ;
 
5514
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5515
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5516
Warnings:
 
5517
Warning 1264    Out of range value for column 'c1' at row 1
 
5518
Warning 1264    Out of range value for column 'c2' at row 1
 
5519
Warning 1264    Out of range value for column 'c3' at row 1
 
5520
Warning 1264    Out of range value for column 'c4' at row 1
 
5521
Warning 1264    Out of range value for column 'c5' at row 1
 
5522
Warning 1264    Out of range value for column 'c12' at row 1
 
5523
execute my_select ;
 
5524
c1      127
 
5525
c2      32767
 
5526
c3      8388607
 
5527
c4      2147483647
 
5528
c5      2147483647
 
5529
c6      9223372036854775807
 
5530
c7      9.22337e+18
 
5531
c8      9.22337203685478e+18
 
5532
c9      9.22337203685478e+18
 
5533
c10     9.22337203685478e+18
 
5534
c12     9999.9999
 
5535
execute my_delete ;
 
5536
set @arg00= '9223372036854775807' ;
 
5537
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5538
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5539
Warnings:
 
5540
Warning 1264    Out of range value for column 'c1' at row 1
 
5541
Warning 1264    Out of range value for column 'c2' at row 1
 
5542
Warning 1264    Out of range value for column 'c3' at row 1
 
5543
Warning 1264    Out of range value for column 'c4' at row 1
 
5544
Warning 1264    Out of range value for column 'c5' at row 1
 
5545
Warning 1264    Out of range value for column 'c12' at row 1
 
5546
execute my_select ;
 
5547
c1      127
 
5548
c2      32767
 
5549
c3      8388607
 
5550
c4      2147483647
 
5551
c5      2147483647
 
5552
c6      9223372036854775807
 
5553
c7      9.22337e+18
 
5554
c8      9.22337203685478e+18
 
5555
c9      9.22337203685478e+18
 
5556
c10     9.22337203685478e+18
 
5557
c12     9999.9999
 
5558
execute my_delete ;
 
5559
set @arg00= -9223372036854775808 ;
 
5560
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5561
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5562
Warnings:
 
5563
Warning 1264    Out of range value for column 'c1' at row 1
 
5564
Warning 1264    Out of range value for column 'c2' at row 1
 
5565
Warning 1264    Out of range value for column 'c3' at row 1
 
5566
Warning 1264    Out of range value for column 'c4' at row 1
 
5567
Warning 1264    Out of range value for column 'c5' at row 1
 
5568
Warning 1264    Out of range value for column 'c12' at row 1
 
5569
execute my_select ;
 
5570
c1      -128
 
5571
c2      -32768
 
5572
c3      -8388608
 
5573
c4      -2147483648
 
5574
c5      -2147483648
 
5575
c6      -9223372036854775808
 
5576
c7      -9.22337e+18
 
5577
c8      -9.22337203685478e+18
 
5578
c9      -9.22337203685478e+18
 
5579
c10     -9.22337203685478e+18
 
5580
c12     -9999.9999
 
5581
execute my_delete ;
 
5582
set @arg00= '-9223372036854775808' ;
 
5583
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5584
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5585
Warnings:
 
5586
Warning 1264    Out of range value for column 'c1' at row 1
 
5587
Warning 1264    Out of range value for column 'c2' at row 1
 
5588
Warning 1264    Out of range value for column 'c3' at row 1
 
5589
Warning 1264    Out of range value for column 'c4' at row 1
 
5590
Warning 1264    Out of range value for column 'c5' at row 1
 
5591
Warning 1264    Out of range value for column 'c12' at row 1
 
5592
execute my_select ;
 
5593
c1      -128
 
5594
c2      -32768
 
5595
c3      -8388608
 
5596
c4      -2147483648
 
5597
c5      -2147483648
 
5598
c6      -9223372036854775808
 
5599
c7      -9.22337e+18
 
5600
c8      -9.22337203685478e+18
 
5601
c9      -9.22337203685478e+18
 
5602
c10     -9.22337203685478e+18
 
5603
c12     -9999.9999
 
5604
execute my_delete ;
 
5605
set @arg00= 1.11111111111111111111e+50 ;
 
5606
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5607
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5608
Warnings:
 
5609
Warning 1264    Out of range value for column 'c1' at row 1
 
5610
Warning 1264    Out of range value for column 'c2' at row 1
 
5611
Warning 1264    Out of range value for column 'c3' at row 1
 
5612
Warning 1264    Out of range value for column 'c4' at row 1
 
5613
Warning 1264    Out of range value for column 'c5' at row 1
 
5614
Warning 1264    Out of range value for column 'c6' at row 1
 
5615
Warning 1264    Out of range value for column 'c7' at row 1
 
5616
Warning 1264    Out of range value for column 'c12' at row 1
 
5617
execute my_select ;
 
5618
c1      127
 
5619
c2      32767
 
5620
c3      8388607
 
5621
c4      2147483647
 
5622
c5      2147483647
 
5623
c6      9223372036854775807
 
5624
c7      3.40282e+38
 
5625
c8      1.11111111111111e+50
 
5626
c9      1.11111111111111e+50
 
5627
c10     1.11111111111111e+50
 
5628
c12     9999.9999
 
5629
execute my_delete ;
 
5630
set @arg00= '1.11111111111111111111e+50' ;
 
5631
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5632
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5633
Warnings:
 
5634
Warning 1264    Out of range value for column 'c1' at row 1
 
5635
Warning 1264    Out of range value for column 'c2' at row 1
 
5636
Warning 1264    Out of range value for column 'c3' at row 1
 
5637
Warning 1264    Out of range value for column 'c4' at row 1
 
5638
Warning 1264    Out of range value for column 'c5' at row 1
 
5639
Warning 1264    Out of range value for column 'c6' at row 1
 
5640
Warning 1264    Out of range value for column 'c7' at row 1
 
5641
Warning 1264    Out of range value for column 'c12' at row 1
 
5642
execute my_select ;
 
5643
c1      127
 
5644
c2      32767
 
5645
c3      8388607
 
5646
c4      2147483647
 
5647
c5      2147483647
 
5648
c6      9223372036854775807
 
5649
c7      3.40282e+38
 
5650
c8      1.11111111111111e+50
 
5651
c9      1.11111111111111e+50
 
5652
c10     1.11111111111111e+50
 
5653
c12     9999.9999
 
5654
execute my_delete ;
 
5655
set @arg00= -1.11111111111111111111e+50 ;
 
5656
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5657
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5658
Warnings:
 
5659
Warning 1264    Out of range value for column 'c1' at row 1
 
5660
Warning 1264    Out of range value for column 'c2' at row 1
 
5661
Warning 1264    Out of range value for column 'c3' at row 1
 
5662
Warning 1264    Out of range value for column 'c4' at row 1
 
5663
Warning 1264    Out of range value for column 'c5' at row 1
 
5664
Warning 1264    Out of range value for column 'c6' at row 1
 
5665
Warning 1264    Out of range value for column 'c7' at row 1
 
5666
Warning 1264    Out of range value for column 'c12' at row 1
 
5667
execute my_select ;
 
5668
c1      -128
 
5669
c2      -32768
 
5670
c3      -8388608
 
5671
c4      -2147483648
 
5672
c5      -2147483648
 
5673
c6      -9223372036854775808
 
5674
c7      -3.40282e+38
 
5675
c8      -1.11111111111111e+50
 
5676
c9      -1.11111111111111e+50
 
5677
c10     -1.11111111111111e+50
 
5678
c12     -9999.9999
 
5679
execute my_delete ;
 
5680
set @arg00= '-1.11111111111111111111e+50' ;
 
5681
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
 
5682
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5683
Warnings:
 
5684
Warning 1264    Out of range value for column 'c1' at row 1
 
5685
Warning 1264    Out of range value for column 'c2' at row 1
 
5686
Warning 1264    Out of range value for column 'c3' at row 1
 
5687
Warning 1264    Out of range value for column 'c4' at row 1
 
5688
Warning 1264    Out of range value for column 'c5' at row 1
 
5689
Warning 1264    Out of range value for column 'c6' at row 1
 
5690
Warning 1264    Out of range value for column 'c7' at row 1
 
5691
Warning 1264    Out of range value for column 'c12' at row 1
 
5692
execute my_select ;
 
5693
c1      -128
 
5694
c2      -32768
 
5695
c3      -8388608
 
5696
c4      -2147483648
 
5697
c5      -2147483648
 
5698
c6      -9223372036854775808
 
5699
c7      -3.40282e+38
 
5700
c8      -1.11111111111111e+50
 
5701
c9      -1.11111111111111e+50
 
5702
c10     -1.11111111111111e+50
 
5703
c12     -9999.9999
 
5704
execute my_delete ;
 
5705
test_sequence
 
5706
-- insert into string columns --
 
5707
Warnings:
 
5708
Warning 1265    Data truncated for column 'c20' at row 1
 
5709
Warnings:
 
5710
Warning 1265    Data truncated for column 'c20' at row 1
 
5711
Warnings:
 
5712
Warning 1265    Data truncated for column 'c20' at row 1
 
5713
Warnings:
 
5714
Warning 1265    Data truncated for column 'c20' at row 1
 
5715
Warnings:
 
5716
Warning 1265    Data truncated for column 'c20' at row 1
 
5717
Warnings:
 
5718
Warning 1265    Data truncated for column 'c20' at row 1
 
5719
Warnings:
 
5720
Warning 1265    Data truncated for column 'c20' at row 1
 
5721
Warnings:
 
5722
Warning 1265    Data truncated for column 'c20' at row 1
 
5723
Warnings:
 
5724
Warning 1265    Data truncated for column 'c20' at row 1
 
5725
Warnings:
 
5726
Warning 1265    Data truncated for column 'c20' at row 1
 
5727
Warnings:
 
5728
Warning 1265    Data truncated for column 'c20' at row 1
 
5729
Warnings:
 
5730
Warning 1265    Data truncated for column 'c20' at row 1
 
5731
Warnings:
 
5732
Warning 1265    Data truncated for column 'c20' at row 1
 
5733
Warnings:
 
5734
Warning 1265    Data truncated for column 'c20' at row 1
 
5735
Warnings:
 
5736
Warning 1265    Data truncated for column 'c20' at row 1
 
5737
Warnings:
 
5738
Warning 1265    Data truncated for column 'c20' at row 1
 
5739
Warnings:
 
5740
Warning 1265    Data truncated for column 'c20' at row 1
 
5741
Warnings:
 
5742
Warning 1265    Data truncated for column 'c20' at row 1
 
5743
Warnings:
 
5744
Warning 1265    Data truncated for column 'c20' at row 1
 
5745
Warnings:
 
5746
Warning 1265    Data truncated for column 'c20' at row 1
 
5747
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
 
5748
from t9 where c1 >= 20
 
5749
order by c1 ;
 
5750
c1      c20     c21     c22     c23     c24     c25     c26     c27     c28     c29     c30
 
5751
20      2       20      20      20      20      20      20      20      20      20      20
 
5752
21      2       21      21      21      21      21      21      21      21      21      21
 
5753
22      2       22      22      22      22      22      22      22      22      22      22
 
5754
23      2       23      23      23      23      23      23      23      23      23      23
 
5755
30      3       30      30      30      30      30      30      30      30      30      30
 
5756
31      3       31      31      31      31      31      31      31      31      31      31
 
5757
32      3       32      32      32      32      32      32      32      32      32      32
 
5758
33      3       33      33      33      33      33      33      33      33      33      33
 
5759
40      4       40      40      40      40      40      40      40      40      40      40
 
5760
41      4       41      41      41      41      41      41      41      41      41      41
 
5761
42      4       42      42      42      42      42      42      42      42      42      42
 
5762
43      4       43      43      43      43      43      43      43      43      43      43
 
5763
50      5       50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0    50.0
 
5764
51      5       51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0    51.0
 
5765
52      5       52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0    52.0
 
5766
53      5       53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0    53.0
 
5767
54      5       54      54      54.00   54.00   54.00   54.00   54.00   54.00   54.00   54.00
 
5768
55      5       55      55      55      55      55      55      55      55      55      55
 
5769
56      6       56      56      56.00   56.00   56.00   56.00   56.00   56.00   56.00   56.00
 
5770
57      6       57      57      57.00   57.00   57.00   57.00   57.00   57.00   57.00   57.00
 
5771
60      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5772
61      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5773
62      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5774
63      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5775
71      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5776
73      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5777
81      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5778
83      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
 
5779
test_sequence
 
5780
-- select .. where string column = .. --
 
5781
set @arg00= '20';
 
5782
select 'true' as found from t9 
 
5783
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
 
5784
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
 
5785
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
 
5786
found
 
5787
true
 
5788
select 'true' as found from t9 
 
5789
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
5790
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
5791
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
5792
found
 
5793
true
 
5794
prepare stmt1 from "select 'true' as found from t9 
 
5795
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
 
5796
  c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
 
5797
  c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
 
5798
execute stmt1 ;
 
5799
found
 
5800
true
 
5801
prepare stmt1 from "select 'true' as found from t9 
 
5802
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
5803
  c21= ? and c22= ? and c23= ? and c25= ? and
 
5804
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
5805
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5806
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5807
found
 
5808
true
 
5809
set @arg00= CAST('20' as binary);
 
5810
select 'true' as found from t9 
 
5811
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
 
5812
= CAST('20' as binary) and c21= CAST('20' as binary)
 
5813
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
 
5814
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
 
5815
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
 
5816
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
 
5817
c30= CAST('20' as binary) ;
 
5818
found
 
5819
true
 
5820
select 'true' as found from t9 
 
5821
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
 
5822
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
5823
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
 
5824
c30= @arg00;
 
5825
found
 
5826
true
 
5827
prepare stmt1 from "select 'true' as found from t9 
 
5828
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
 
5829
                 = CAST('20' as binary) and c21= CAST('20' as binary)
 
5830
  and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
 
5831
  c24= CAST('20' as binary) and c25= CAST('20' as binary) and
 
5832
  c26= CAST('20' as binary) and c27= CAST('20' as binary) and
 
5833
  c28= CAST('20' as binary) and c29= CAST('20' as binary) and
 
5834
  c30= CAST('20' as binary)" ;
 
5835
execute stmt1 ;
 
5836
found
 
5837
true
 
5838
prepare stmt1 from "select 'true' as found from t9 
 
5839
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
 
5840
  c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
 
5841
  c29= ? and c30= ?";
 
5842
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5843
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5844
found
 
5845
true
 
5846
set @arg00= 20;
 
5847
select 'true' as found from t9 
 
5848
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
 
5849
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
 
5850
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
 
5851
found
 
5852
true
 
5853
select 'true' as found from t9 
 
5854
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
5855
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
5856
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
5857
found
 
5858
true
 
5859
prepare stmt1 from "select 'true' as found from t9 
 
5860
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
 
5861
  c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
 
5862
  c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
 
5863
execute stmt1 ;
 
5864
found
 
5865
true
 
5866
prepare stmt1 from "select 'true' as found from t9 
 
5867
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
5868
  c21= ? and c22= ? and c23= ? and c25= ? and
 
5869
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
5870
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5871
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5872
found
 
5873
true
 
5874
set @arg00= 20.0;
 
5875
select 'true' as found from t9 
 
5876
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
 
5877
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
 
5878
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
 
5879
found
 
5880
true
 
5881
select 'true' as found from t9 
 
5882
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
 
5883
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
 
5884
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
 
5885
found
 
5886
true
 
5887
prepare stmt1 from "select 'true' as found from t9 
 
5888
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
 
5889
  c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
 
5890
  c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
 
5891
execute stmt1 ;
 
5892
found
 
5893
true
 
5894
prepare stmt1 from "select 'true' as found from t9 
 
5895
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
 
5896
  c21= ? and c22= ? and c23= ? and c25= ? and
 
5897
  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
 
5898
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 
 
5899
@arg00, @arg00, @arg00, @arg00, @arg00 ;
 
5900
found
 
5901
true
 
5902
delete from t9 ;
 
5903
test_sequence
 
5904
-- insert into date/time columns --
 
5905
Warnings:
 
5906
Note    1265    Data truncated for column 'c13' at row 1
 
5907
Warning 1265    Data truncated for column 'c17' at row 1
 
5908
Warnings:
 
5909
Note    1265    Data truncated for column 'c13' at row 1
 
5910
Warning 1265    Data truncated for column 'c17' at row 1
 
5911
Warnings:
 
5912
Note    1265    Data truncated for column 'c13' at row 1
 
5913
Warning 1265    Data truncated for column 'c17' at row 1
 
5914
Warnings:
 
5915
Note    1265    Data truncated for column 'c13' at row 1
 
5916
Warning 1265    Data truncated for column 'c17' at row 1
 
5917
Warnings:
 
5918
Note    1265    Data truncated for column 'c13' at row 1
 
5919
Warning 1265    Data truncated for column 'c17' at row 1
 
5920
Warnings:
 
5921
Note    1265    Data truncated for column 'c13' at row 1
 
5922
Warning 1265    Data truncated for column 'c17' at row 1
 
5923
Warnings:
 
5924
Note    1265    Data truncated for column 'c13' at row 1
 
5925
Warning 1265    Data truncated for column 'c17' at row 1
 
5926
Warnings:
 
5927
Note    1265    Data truncated for column 'c13' at row 1
 
5928
Warning 1265    Data truncated for column 'c17' at row 1
 
5929
Warnings:
 
5930
Warning 1264    Out of range value for column 'c13' at row 1
 
5931
Warning 1264    Out of range value for column 'c14' at row 1
 
5932
Warning 1265    Data truncated for column 'c15' at row 1
 
5933
Warning 1264    Out of range value for column 'c16' at row 1
 
5934
Warning 1264    Out of range value for column 'c17' at row 1
 
5935
Warnings:
 
5936
Warning 1264    Out of range value for column 'c13' at row 1
 
5937
Warning 1264    Out of range value for column 'c14' at row 1
 
5938
Warning 1265    Data truncated for column 'c15' at row 1
 
5939
Warning 1264    Out of range value for column 'c16' at row 1
 
5940
Warning 1264    Out of range value for column 'c17' at row 1
 
5941
Warnings:
 
5942
Warning 1264    Out of range value for column 'c13' at row 1
 
5943
Warning 1264    Out of range value for column 'c14' at row 1
 
5944
Warning 1265    Data truncated for column 'c15' at row 1
 
5945
Warning 1264    Out of range value for column 'c16' at row 1
 
5946
Warning 1264    Out of range value for column 'c17' at row 1
 
5947
Warnings:
 
5948
Warning 1264    Out of range value for column 'c13' at row 1
 
5949
Warning 1264    Out of range value for column 'c14' at row 1
 
5950
Warning 1265    Data truncated for column 'c15' at row 1
 
5951
Warning 1264    Out of range value for column 'c16' at row 1
 
5952
Warning 1264    Out of range value for column 'c17' at row 1
 
5953
Warnings:
 
5954
Warning 1265    Data truncated for column 'c15' at row 1
 
5955
Warning 1264    Out of range value for column 'c16' at row 1
 
5956
Warning 1264    Out of range value for column 'c17' at row 1
 
5957
Warnings:
 
5958
Warning 1265    Data truncated for column 'c15' at row 1
 
5959
Warning 1264    Out of range value for column 'c16' at row 1
 
5960
Warning 1264    Out of range value for column 'c17' at row 1
 
5961
Warnings:
 
5962
Warning 1265    Data truncated for column 'c15' at row 1
 
5963
Warning 1264    Out of range value for column 'c16' at row 1
 
5964
Warning 1264    Out of range value for column 'c17' at row 1
 
5965
Warnings:
 
5966
Warning 1265    Data truncated for column 'c15' at row 1
 
5967
Warning 1264    Out of range value for column 'c16' at row 1
 
5968
Warning 1264    Out of range value for column 'c17' at row 1
 
5969
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
 
5970
c1      c13     c14     c15     c16     c17
 
5971
20      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5972
21      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5973
22      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5974
23      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5975
30      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5976
31      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5977
32      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5978
33      1991-01-01      1991-01-01 01:01:01     1991-01-01 01:01:01     01:01:01        1991
 
5979
40      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5980
41      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5981
42      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5982
43      0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5983
50      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5984
51      2010-00-00      2010-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5985
52      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5986
53      2001-00-00      2001-00-00 00:00:00     0000-00-00 00:00:00     838:59:59       0000
 
5987
60      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5988
61      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5989
62      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5990
63      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5991
71      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5992
73      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5993
81      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5994
83      NULL    NULL    1991-01-01 01:01:01     NULL    NULL
 
5995
test_sequence
 
5996
-- select .. where date/time column = .. --
 
5997
set @arg00= '1991-01-01 01:01:01' ;
 
5998
select 'true' as found from t9 
 
5999
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
 
6000
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
 
6001
c17= '1991-01-01 01:01:01' ;
 
6002
found
 
6003
true
 
6004
select 'true' as found from t9 
 
6005
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
 
6006
and c17= @arg00 ;
 
6007
found
 
6008
true
 
6009
prepare stmt1 from "select 'true' as found from t9 
 
6010
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
 
6011
  c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
 
6012
  c17= '1991-01-01 01:01:01'" ;
 
6013
execute stmt1 ;
 
6014
found
 
6015
true
 
6016
prepare stmt1 from "select 'true' as found from t9 
 
6017
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
 
6018
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
 
6019
found
 
6020
true
 
6021
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
 
6022
select 'true' as found from t9 
 
6023
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
 
6024
c14= CAST('1991-01-01 01:01:01' as datetime) and
 
6025
c15= CAST('1991-01-01 01:01:01' as datetime) and
 
6026
c16= CAST('1991-01-01 01:01:01' as datetime) and
 
6027
c17= CAST('1991-01-01 01:01:01' as datetime) ;
 
6028
found
 
6029
true
 
6030
select 'true' as found from t9 
 
6031
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
 
6032
and c17= @arg00 ;
 
6033
found
 
6034
true
 
6035
prepare stmt1 from "select 'true' as found from t9 
 
6036
where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
 
6037
  c14= CAST('1991-01-01 01:01:01' as datetime) and
 
6038
  c15= CAST('1991-01-01 01:01:01' as datetime) and
 
6039
  c16= CAST('1991-01-01 01:01:01' as datetime) and
 
6040
  c17= CAST('1991-01-01 01:01:01' as datetime)" ;
 
6041
execute stmt1 ;
 
6042
found
 
6043
true
 
6044
prepare stmt1 from "select 'true' as found from t9 
 
6045
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
 
6046
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
 
6047
found
 
6048
true
 
6049
set @arg00= 1991 ;
 
6050
select 'true' as found from t9 
 
6051
where c1= 20 and c17= 1991 ;
 
6052
found
 
6053
true
 
6054
select 'true' as found from t9 
 
6055
where c1= 20 and c17= @arg00 ;
 
6056
found
 
6057
true
 
6058
prepare stmt1 from "select 'true' as found from t9 
 
6059
where c1= 20 and c17= 1991" ;
 
6060
execute stmt1 ;
 
6061
found
 
6062
true
 
6063
prepare stmt1 from "select 'true' as found from t9
 
6064
where c1= 20 and c17= ?" ;
 
6065
execute stmt1 using @arg00 ;
 
6066
found
 
6067
true
 
6068
set @arg00= 1.991e+3 ;
 
6069
select 'true' as found from t9 
 
6070
where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
 
6071
found
 
6072
true
 
6073
select 'true' as found from t9 
 
6074
where c1= 20 and abs(c17 - @arg00) < 0.01 ;
 
6075
found
 
6076
true
 
6077
prepare stmt1 from "select 'true' as found from t9 
 
6078
where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
 
6079
execute stmt1 ;
 
6080
found
 
6081
true
 
6082
prepare stmt1 from "select 'true' as found from t9
 
6083
where c1= 20 and abs(c17 - ?) < 0.01" ;
 
6084
execute stmt1 using @arg00 ;
 
6085
found
 
6086
true
 
6087
drop table t1, t1_1, t1_2, 
 
6088
t9_1, t9_2, t9;