1drop table if exists t1, t9 ;
2create table t1
3(
4a int, b varchar(30),
5primary key(a)
6) engine = 'MYISAM'  ;
7create table t9
8(
9c1  tinyint, c2  smallint, c3  mediumint, c4  int,
10c5  integer, c6  bigint, c7  float, c8  double,
11c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
12c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
13ON UPDATE CURRENT_TIMESTAMP, c16 time,
14c17 year, c18 tinyint, c19 bool, c20 char,
15c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
16c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
17c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
18c32 set('monday', 'tuesday', 'wednesday'),
19primary key(c1)
20) engine = 'MYISAM'  ;
21delete from t1 ;
22insert into t1 values (1,'one');
23insert into t1 values (2,'two');
24insert into t1 values (3,'three');
25insert into t1 values (4,'four');
26commit ;
27delete from t9 ;
28insert into t9
29set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
30c10= 1, c11= 1, c12 = 1,
31c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
32c16= '11:11:11', c17= '2004',
33c18= 1, c19=true, c20= 'a', c21= '123456789a',
34c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
35c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
36c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
37insert into t9
38set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
39c10= 9, c11= 9, c12 = 9,
40c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
41c16= '11:11:11', c17= '2004',
42c18= 1, c19=false, c20= 'a', c21= '123456789a',
43c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
44c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
45c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
46commit ;
47PREPARE stmt1 FROM ' EXPLAIN SELECT a FROM t1 ORDER BY b ';
48EXECUTE stmt1;
49Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
50def					id	8	3	1	N	32929	0	63
51def					select_type	253	19	6	N	1	31	8
52def					table	253	64	2	Y	0	31	8
53def					partitions	250	6316032	0	Y	0	31	8
54def					type	253	10	3	Y	0	31	8
55def					possible_keys	253	4096	0	Y	0	31	8
56def					key	253	64	0	Y	0	31	8
57def					key_len	253	4096	0	Y	0	31	8
58def					ref	253	1024	0	Y	0	31	8
59def					rows	8	10	1	Y	32928	0	63
60def					filtered	5	4	6	Y	32896	2	63
61def					Extra	253	255	14	N	1	31	8
62id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
631	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	4	100.00	Using filesort
64Warnings:
65Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `test`.`t1`.`b`
66SET @arg00=1 ;
67PREPARE stmt1 FROM ' EXPLAIN SELECT a FROM t1 WHERE a > ? ORDER BY b ';
68EXECUTE stmt1 USING @arg00;
69Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
70def					id	8	3	1	N	32929	0	63
71def					select_type	253	19	6	N	1	31	8
72def					table	253	64	2	Y	0	31	8
73def					partitions	250	6316032	0	Y	0	31	8
74def					type	253	10	5	Y	0	31	8
75def					possible_keys	253	4096	7	Y	0	31	8
76def					key	253	64	7	Y	0	31	8
77def					key_len	253	4096	1	Y	0	31	8
78def					ref	253	1024	0	Y	0	31	8
79def					rows	8	10	1	Y	32928	0	63
80def					filtered	5	4	6	Y	32896	2	63
81def					Extra	253	255	37	N	1	31	8
82id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
831	SIMPLE	t1	NULL	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Using index condition; Using filesort
84Warnings:
85Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 1) order by `test`.`t1`.`b`
86DROP TABLE t1, t9;
87drop table if exists t1, t9 ;
88create table t1
89(
90a int, b varchar(30),
91primary key(a)
92) engine = 'MYISAM'  ;
93create table t9
94(
95c1  tinyint, c2  smallint, c3  mediumint, c4  int,
96c5  integer, c6  bigint, c7  float, c8  double,
97c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
98c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
99ON UPDATE CURRENT_TIMESTAMP, c16 time,
100c17 year, c18 tinyint, c19 bool, c20 char,
101c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
102c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
103c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
104c32 set('monday', 'tuesday', 'wednesday'),
105primary key(c1)
106) engine = 'MYISAM'  ;
107delete from t1 ;
108insert into t1 values (1,'one');
109insert into t1 values (2,'two');
110insert into t1 values (3,'three');
111insert into t1 values (4,'four');
112commit ;
113delete from t9 ;
114insert into t9
115set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
116c10= 1, c11= 1, c12 = 1,
117c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
118c16= '11:11:11', c17= '2004',
119c18= 1, c19=true, c20= 'a', c21= '123456789a',
120c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
121c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
122c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
123insert into t9
124set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
125c10= 9, c11= 9, c12 = 9,
126c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
127c16= '11:11:11', c17= '2004',
128c18= 1, c19=false, c20= 'a', c21= '123456789a',
129c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
130c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
131c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
132commit ;
133test_sequence
134------ explain select tests ------
135prepare stmt1 from ' explain select * from t9 ' ;
136execute stmt1;
137Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
138def					id	8	3	1	N	32929	0	63
139def					select_type	253	19	6	N	1	31	8
140def					table	253	64	2	Y	0	31	8
141def					partitions	250	6316032	0	Y	0	31	8
142def					type	253	10	3	Y	0	31	8
143def					possible_keys	253	4096	0	Y	0	31	8
144def					key	253	64	0	Y	0	31	8
145def					key_len	253	4096	0	Y	0	31	8
146def					ref	253	1024	0	Y	0	31	8
147def					rows	8	10	1	Y	32928	0	63
148def					filtered	5	4	6	Y	32896	2	63
149def					Extra	253	255	0	N	1	31	8
150id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1511	SIMPLE	t9	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
152Warnings:
153Note	1003	/* select#1 */ select `test`.`t9`.`c1` AS `c1`,`test`.`t9`.`c2` AS `c2`,`test`.`t9`.`c3` AS `c3`,`test`.`t9`.`c4` AS `c4`,`test`.`t9`.`c5` AS `c5`,`test`.`t9`.`c6` AS `c6`,`test`.`t9`.`c7` AS `c7`,`test`.`t9`.`c8` AS `c8`,`test`.`t9`.`c9` AS `c9`,`test`.`t9`.`c10` AS `c10`,`test`.`t9`.`c11` AS `c11`,`test`.`t9`.`c12` AS `c12`,`test`.`t9`.`c13` AS `c13`,`test`.`t9`.`c14` AS `c14`,`test`.`t9`.`c15` AS `c15`,`test`.`t9`.`c16` AS `c16`,`test`.`t9`.`c17` AS `c17`,`test`.`t9`.`c18` AS `c18`,`test`.`t9`.`c19` AS `c19`,`test`.`t9`.`c20` AS `c20`,`test`.`t9`.`c21` AS `c21`,`test`.`t9`.`c22` AS `c22`,`test`.`t9`.`c23` AS `c23`,`test`.`t9`.`c24` AS `c24`,`test`.`t9`.`c25` AS `c25`,`test`.`t9`.`c26` AS `c26`,`test`.`t9`.`c27` AS `c27`,`test`.`t9`.`c28` AS `c28`,`test`.`t9`.`c29` AS `c29`,`test`.`t9`.`c30` AS `c30`,`test`.`t9`.`c31` AS `c31`,`test`.`t9`.`c32` AS `c32` from `test`.`t9`
154DROP TABLE t1, t9;
155drop table if exists t1, t9 ;
156create table t1
157(
158a int, b varchar(30),
159primary key(a)
160) engine = 'InnoDB'  ;
161create table t9
162(
163c1  tinyint, c2  smallint, c3  mediumint, c4  int,
164c5  integer, c6  bigint, c7  float, c8  double,
165c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
166c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
167ON UPDATE CURRENT_TIMESTAMP, c16 time,
168c17 year, c18 tinyint, c19 bool, c20 char,
169c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
170c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
171c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
172c32 set('monday', 'tuesday', 'wednesday'),
173primary key(c1)
174) engine = 'InnoDB'  ;
175delete from t1 ;
176insert into t1 values (1,'one');
177insert into t1 values (2,'two');
178insert into t1 values (3,'three');
179insert into t1 values (4,'four');
180commit ;
181delete from t9 ;
182insert into t9
183set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
184c10= 1, c11= 1, c12 = 1,
185c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
186c16= '11:11:11', c17= '2004',
187c18= 1, c19=true, c20= 'a', c21= '123456789a',
188c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
189c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
190c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
191insert into t9
192set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
193c10= 9, c11= 9, c12 = 9,
194c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
195c16= '11:11:11', c17= '2004',
196c18= 1, c19=false, c20= 'a', c21= '123456789a',
197c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
198c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
199c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
200commit ;
201test_sequence
202------ explain select tests ------
203prepare stmt1 from ' explain select * from t9 ' ;
204execute stmt1;
205Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
206def					id	8	3	1	N	32929	0	63
207def					select_type	253	19	6	N	1	31	8
208def					table	253	64	2	Y	0	31	8
209def					partitions	250	6316032	0	Y	0	31	8
210def					type	253	10	3	Y	0	31	8
211def					possible_keys	253	4096	0	Y	0	31	8
212def					key	253	64	0	Y	0	31	8
213def					key_len	253	4096	0	Y	0	31	8
214def					ref	253	1024	0	Y	0	31	8
215def					rows	8	10	1	Y	32928	0	63
216def					filtered	5	4	6	Y	32896	2	63
217def					Extra	253	255	0	N	1	31	8
218id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
2191	SIMPLE	t9	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
220Warnings:
221Note	1003	/* select#1 */ select `test`.`t9`.`c1` AS `c1`,`test`.`t9`.`c2` AS `c2`,`test`.`t9`.`c3` AS `c3`,`test`.`t9`.`c4` AS `c4`,`test`.`t9`.`c5` AS `c5`,`test`.`t9`.`c6` AS `c6`,`test`.`t9`.`c7` AS `c7`,`test`.`t9`.`c8` AS `c8`,`test`.`t9`.`c9` AS `c9`,`test`.`t9`.`c10` AS `c10`,`test`.`t9`.`c11` AS `c11`,`test`.`t9`.`c12` AS `c12`,`test`.`t9`.`c13` AS `c13`,`test`.`t9`.`c14` AS `c14`,`test`.`t9`.`c15` AS `c15`,`test`.`t9`.`c16` AS `c16`,`test`.`t9`.`c17` AS `c17`,`test`.`t9`.`c18` AS `c18`,`test`.`t9`.`c19` AS `c19`,`test`.`t9`.`c20` AS `c20`,`test`.`t9`.`c21` AS `c21`,`test`.`t9`.`c22` AS `c22`,`test`.`t9`.`c23` AS `c23`,`test`.`t9`.`c24` AS `c24`,`test`.`t9`.`c25` AS `c25`,`test`.`t9`.`c26` AS `c26`,`test`.`t9`.`c27` AS `c27`,`test`.`t9`.`c28` AS `c28`,`test`.`t9`.`c29` AS `c29`,`test`.`t9`.`c30` AS `c30`,`test`.`t9`.`c31` AS `c31`,`test`.`t9`.`c32` AS `c32` from `test`.`t9`
222DROP TABLE t1, t9;
223CREATE TABLE t1
224(
225a INT, b VARCHAR(30),
226PRIMARY KEY(a)
227) ENGINE = 'HEAP'  ;
228CREATE TABLE t9
229(
230c1  tinYINT, c2  SMALLINT, c3  MEDIUMINT, c4  INT,
231c5  INTEGER, c6  BIGINT, c7  FLOAT, c8  DOUBLE,
232c9  DOUBLE PRECISION, c10 REAL, c11 DECIMAL(7, 4), c12 NUMERIC(8, 4),
233c13 DATE, c14 DATETIME, c15 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
234ON UPDATE CURRENT_TIMESTAMP, c16 TIME,
235c17 YEAR, c18 TINYINT, c19 BOOL, c20 CHAR,
236c21 CHAR(10), c22 VARCHAR(30), c23 VARCHAR(100), c24 VARCHAR(100),
237c25 VARCHAR(100), c26 VARCHAR(100), c27 VARCHAR(100), c28 VARCHAR(100),
238c29 VARCHAR(100), c30 VARCHAR(100), c31 ENUM('one', 'two', 'three'),
239c32 SET('monday', 'tuesday', 'wednesday'),
240PRIMARY KEY(c1)
241) ENGINE = 'HEAP'  ;
242delete from t1 ;
243insert into t1 values (1,'one');
244insert into t1 values (2,'two');
245insert into t1 values (3,'three');
246insert into t1 values (4,'four');
247commit ;
248delete from t9 ;
249insert into t9
250set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
251c10= 1, c11= 1, c12 = 1,
252c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
253c16= '11:11:11', c17= '2004',
254c18= 1, c19=true, c20= 'a', c21= '123456789a',
255c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
256c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
257c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
258insert into t9
259set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
260c10= 9, c11= 9, c12 = 9,
261c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
262c16= '11:11:11', c17= '2004',
263c18= 1, c19=false, c20= 'a', c21= '123456789a',
264c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
265c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
266c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
267commit ;
268test_sequence
269------ explain select tests ------
270prepare stmt1 from ' explain select * from t9 ' ;
271execute stmt1;
272Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
273def					id	8	3	1	N	32929	0	63
274def					select_type	253	19	6	N	1	31	8
275def					table	253	64	2	Y	0	31	8
276def					partitions	250	6316032	0	Y	0	31	8
277def					type	253	10	3	Y	0	31	8
278def					possible_keys	253	4096	0	Y	0	31	8
279def					key	253	64	0	Y	0	31	8
280def					key_len	253	4096	0	Y	0	31	8
281def					ref	253	1024	0	Y	0	31	8
282def					rows	8	10	1	Y	32928	0	63
283def					filtered	5	4	6	Y	32896	2	63
284def					Extra	253	255	0	N	1	31	8
285id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
2861	SIMPLE	t9	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
287Warnings:
288Note	1003	/* select#1 */ select `test`.`t9`.`c1` AS `c1`,`test`.`t9`.`c2` AS `c2`,`test`.`t9`.`c3` AS `c3`,`test`.`t9`.`c4` AS `c4`,`test`.`t9`.`c5` AS `c5`,`test`.`t9`.`c6` AS `c6`,`test`.`t9`.`c7` AS `c7`,`test`.`t9`.`c8` AS `c8`,`test`.`t9`.`c9` AS `c9`,`test`.`t9`.`c10` AS `c10`,`test`.`t9`.`c11` AS `c11`,`test`.`t9`.`c12` AS `c12`,`test`.`t9`.`c13` AS `c13`,`test`.`t9`.`c14` AS `c14`,`test`.`t9`.`c15` AS `c15`,`test`.`t9`.`c16` AS `c16`,`test`.`t9`.`c17` AS `c17`,`test`.`t9`.`c18` AS `c18`,`test`.`t9`.`c19` AS `c19`,`test`.`t9`.`c20` AS `c20`,`test`.`t9`.`c21` AS `c21`,`test`.`t9`.`c22` AS `c22`,`test`.`t9`.`c23` AS `c23`,`test`.`t9`.`c24` AS `c24`,`test`.`t9`.`c25` AS `c25`,`test`.`t9`.`c26` AS `c26`,`test`.`t9`.`c27` AS `c27`,`test`.`t9`.`c28` AS `c28`,`test`.`t9`.`c29` AS `c29`,`test`.`t9`.`c30` AS `c30`,`test`.`t9`.`c31` AS `c31`,`test`.`t9`.`c32` AS `c32` from `test`.`t9`
289DROP TABLE t1, t9;
290DROP TABLE IF EXISTS t1, t1_1, t1_2, t9, t9_1, t9_2;
291drop table if exists t1, t9 ;
292create table t1
293(
294a int, b varchar(30),
295primary key(a)
296) engine = 'MYISAM'  ;
297create table t9
298(
299c1  tinyint, c2  smallint, c3  mediumint, c4  int,
300c5  integer, c6  bigint, c7  float, c8  double,
301c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
302c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
303ON UPDATE CURRENT_TIMESTAMP, c16 time,
304c17 year, c18 tinyint, c19 bool, c20 char,
305c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
306c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
307c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
308c32 set('monday', 'tuesday', 'wednesday'),
309primary key(c1)
310) engine = 'MYISAM'  ;
311RENAME TABLE t1 TO t1_1, t9 TO t9_1 ;
312drop table if exists t1, t9 ;
313create table t1
314(
315a int, b varchar(30),
316primary key(a)
317) engine = 'MYISAM'  ;
318create table t9
319(
320c1  tinyint, c2  smallint, c3  mediumint, c4  int,
321c5  integer, c6  bigint, c7  float, c8  double,
322c9  double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
323c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
324ON UPDATE CURRENT_TIMESTAMP, c16 time,
325c17 year, c18 tinyint, c19 bool, c20 char,
326c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
327c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
328c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
329c32 set('monday', 'tuesday', 'wednesday'),
330primary key(c1)
331) engine = 'MYISAM'  ;
332RENAME TABLE t1 TO t1_2, t9 TO t9_2 ;
333CREATE TABLE t1
334(
335a INT, b VARCHAR(30),
336PRIMARY KEY(a)
337) ENGINE = MERGE UNION=(t1_1,t1_2)
338INSERT_METHOD=FIRST;
339CREATE TABLE t9
340(
341c1  TINYINT, c2  SMALLINT, c3  MEDIUMINT, c4  INT,
342c5  INTEGER, c6  BIGINT, c7  FLOAT, c8  DOUBLE,
343c9  DOUBLE PRECISION, c10 REAL, c11 DECIMAL(7, 4), c12 NUMERIC(8, 4),
344c13 DATE, c14 DATETIME, c15 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 TIME,
345c17 YEAR, c18 TINYINT, c19 BOOL, c20 CHAR,
346c21 CHAR(10), c22 VARCHAR(30), c23 TINYBLOB, c24 TINYTEXT,
347c25 BLOB, c26 TEXT, c27 MEDIUMBLOB, c28 MEDIUMTEXT,
348c29 LONGBLOB, c30 LONGTEXT, c31 ENUM('one', 'two', 'three'),
349c32 SET('monday', 'tuesday', 'wednesday'),
350PRIMARY KEY(c1)
351)  ENGINE = MERGE UNION=(t9_1,t9_2)
352INSERT_METHOD=FIRST;
353delete from t1 ;
354insert into t1 values (1,'one');
355insert into t1 values (2,'two');
356insert into t1 values (3,'three');
357insert into t1 values (4,'four');
358commit ;
359delete from t9 ;
360insert into t9
361set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
362c10= 1, c11= 1, c12 = 1,
363c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
364c16= '11:11:11', c17= '2004',
365c18= 1, c19=true, c20= 'a', c21= '123456789a',
366c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
367c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
368c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
369insert into t9
370set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
371c10= 9, c11= 9, c12 = 9,
372c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
373c16= '11:11:11', c17= '2004',
374c18= 1, c19=false, c20= 'a', c21= '123456789a',
375c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
376c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
377c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
378commit ;
379test_sequence
380------ simple select tests ------
381prepare stmt1 from ' select * from t9 order by c1 ' ;
382execute stmt1;
383Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
384def	test	t9	t9	c1	c1	1	4	1	N	53251	0	63
385def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
386def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
387def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
388def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
389def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
390def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
391def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
392def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
393def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
394def	test	t9	t9	c11	c11	246	9	6	Y	32768	4	63
395def	test	t9	t9	c12	c12	246	10	6	Y	32768	4	63
396def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
397def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
398def	test	t9	t9	c15	c15	7	19	19	N	9345	0	63
399def	test	t9	t9	c16	c16	11	10	8	Y	128	0	63
400def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
401def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
402def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
403def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
404def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
405def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
406def	test	t9	t9	c23	c23	252	255	8	Y	144	0	63
407def	test	t9	t9	c24	c24	252	255	8	Y	16	0	8
408def	test	t9	t9	c25	c25	252	65535	4	Y	144	0	63
409def	test	t9	t9	c26	c26	252	65535	4	Y	16	0	8
410def	test	t9	t9	c27	c27	252	16777215	10	Y	144	0	63
411def	test	t9	t9	c28	c28	252	16777215	10	Y	16	0	8
412def	test	t9	t9	c29	c29	252	4294967295	8	Y	144	0	63
413def	test	t9	t9	c30	c30	252	4294967295	8	Y	16	0	8
414def	test	t9	t9	c31	c31	254	5	3	Y	256	0	8
415def	test	t9	t9	c32	c32	254	24	7	Y	2048	0	8
416c1	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
4171	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
4189	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
419set @arg00='SELECT' ;
420@arg00 a from t1 where a=1;
421ERROR 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
422prepare stmt1 from ' ? a from t1 where a=1 ';
423ERROR 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
424set @arg00=1 ;
425select @arg00, b from t1 where a=1 ;
426@arg00	b
4271	one
428prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
429execute stmt1 using @arg00 ;
430?	b
4311	one
432set @arg00='lion' ;
433select @arg00, b from t1 where a=1 ;
434@arg00	b
435lion	one
436prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
437execute stmt1 using @arg00 ;
438?	b
439lion	one
440set @arg00=NULL ;
441select @arg00, b from t1 where a=1 ;
442@arg00	b
443NULL	one
444prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
445execute stmt1 using @arg00 ;
446?	b
447NULL	one
448set @arg00=1 ;
449select b, a - @arg00 from t1 where a=1 ;
450b	a - @arg00
451one	0
452prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
453execute stmt1 using @arg00 ;
454b	a - ?
455one	0
456set @arg00=null ;
457select @arg00 as my_col ;
458my_col
459NULL
460prepare stmt1 from ' select ? as my_col';
461execute stmt1 using @arg00 ;
462my_col
463NULL
464select @arg00 + 1 as my_col ;
465my_col
466NULL
467prepare stmt1 from ' select ? + 1 as my_col';
468execute stmt1 using @arg00 ;
469my_col
470NULL
471select 1 + @arg00 as my_col ;
472my_col
473NULL
474prepare stmt1 from ' select 1 + ? as my_col';
475execute stmt1 using @arg00 ;
476my_col
477NULL
478set @arg00='MySQL' ;
479select substr(@arg00,1,2) from t1 where a=1 ;
480substr(@arg00,1,2)
481My
482prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
483execute stmt1 using @arg00 ;
484substr(?,1,2)
485My
486set @arg00=3 ;
487select substr('MySQL',@arg00,5) from t1 where a=1 ;
488substr('MySQL',@arg00,5)
489SQL
490prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
491execute stmt1 using @arg00 ;
492substr('MySQL',?,5)
493SQL
494select substr('MySQL',1,@arg00) from t1 where a=1 ;
495substr('MySQL',1,@arg00)
496MyS
497prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
498execute stmt1 using @arg00 ;
499substr('MySQL',1,?)
500MyS
501set @arg00='MySQL' ;
502select a , concat(@arg00,b) from t1 order by a;
503a	concat(@arg00,b)
5041	MySQLone
5052	MySQLtwo
5063	MySQLthree
5074	MySQLfour
508prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
509execute stmt1 using @arg00;
510a	concat(?,b)
5111	MySQLone
5122	MySQLtwo
5133	MySQLthree
5144	MySQLfour
515select a , concat(b,@arg00) from t1 order by a ;
516a	concat(b,@arg00)
5171	oneMySQL
5182	twoMySQL
5193	threeMySQL
5204	fourMySQL
521prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
522execute stmt1 using @arg00;
523a	concat(b,?)
5241	oneMySQL
5252	twoMySQL
5263	threeMySQL
5274	fourMySQL
528set @arg00='MySQL' ;
529select group_concat(@arg00,b order by a) from t1
530group by 'a' ;
531group_concat(@arg00,b order by a)
532MySQLone,MySQLtwo,MySQLthree,MySQLfour
533prepare stmt1 from ' select group_concat(?,b order by a) from t1
534group by ''a'' ' ;
535execute stmt1 using @arg00;
536group_concat(?,b order by a)
537MySQLone,MySQLtwo,MySQLthree,MySQLfour
538select group_concat(b,@arg00 order by a) from t1
539group by 'a' ;
540group_concat(b,@arg00 order by a)
541oneMySQL,twoMySQL,threeMySQL,fourMySQL
542prepare stmt1 from ' select group_concat(b,? order by a) from t1
543group by ''a'' ' ;
544execute stmt1 using @arg00;
545group_concat(b,? order by a)
546oneMySQL,twoMySQL,threeMySQL,fourMySQL
547set @arg00='first' ;
548set @arg01='second' ;
549set @arg02=NULL;
550select @arg00, @arg01 from t1 where a=1 ;
551@arg00	@arg01
552first	second
553prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
554execute stmt1 using @arg00, @arg01 ;
555?	?
556first	second
557execute stmt1 using @arg02, @arg01 ;
558?	?
559NULL	second
560execute stmt1 using @arg00, @arg02 ;
561?	?
562first	NULL
563execute stmt1 using @arg02, @arg02 ;
564?	?
565NULL	NULL
566drop table if exists t5 ;
567create table t5 (id1 int(11) not null default '0',
568value2 varchar(100), value1 varchar(100)) ;
569insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
570(1,'ii','ii'),(2,'ii','ii') ;
571prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
572set @arg00=1 ;
573set @arg01='hh' ;
574execute stmt1 using @arg00, @arg01 ;
575id1	value1
5761	hh
5771	ii
5782	hh
579drop table t5 ;
580drop table if exists t5 ;
581create table t5(session_id  char(9) not null) ;
582insert into t5 values ('abc') ;
583prepare stmt1 from ' select * from t5
584where ?=''1111'' and session_id = ''abc'' ' ;
585set @arg00='abc' ;
586execute stmt1 using @arg00 ;
587session_id
588set @arg00='1111' ;
589execute stmt1 using @arg00 ;
590session_id
591abc
592set @arg00='abc' ;
593execute stmt1 using @arg00 ;
594session_id
595drop table t5 ;
596set @arg00='FROM' ;
597select a @arg00 t1 where a=1 ;
598ERROR 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
599prepare stmt1 from ' select a ? t1 where a=1 ' ;
600ERROR 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
601set @arg00='t1' ;
602select a from @arg00 where a=1 ;
603ERROR 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
604prepare stmt1 from ' select a from ? where a=1 ' ;
605ERROR 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
606set @arg00='WHERE' ;
607select a from t1 @arg00 a=1 ;
608ERROR 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
609prepare stmt1 from ' select a from t1 ? a=1 ' ;
610ERROR 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
611set @arg00=1 ;
612select a FROM t1 where a=@arg00 ;
613a
6141
615prepare stmt1 from ' select a FROM t1 where a=? ' ;
616execute stmt1 using @arg00 ;
617a
6181
619set @arg00=1000 ;
620execute stmt1 using @arg00 ;
621a
622set @arg00=NULL ;
623select a FROM t1 where a=@arg00 ;
624a
625prepare stmt1 from ' select a FROM t1 where a=? ' ;
626execute stmt1 using @arg00 ;
627a
628set @arg00=4 ;
629select a FROM t1 where a=sqrt(@arg00) ;
630a
6312
632prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
633execute stmt1 using @arg00 ;
634a
6352
636set @arg00=NULL ;
637select a FROM t1 where a=sqrt(@arg00) ;
638a
639prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
640execute stmt1 using @arg00 ;
641a
642set @arg00=2 ;
643set @arg01=3 ;
644select a FROM t1 where a in (@arg00,@arg01) order by a;
645a
6462
6473
648prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
649execute stmt1 using @arg00, @arg01;
650a
6512
6523
653set @arg00= 'one' ;
654set @arg01= 'two' ;
655set @arg02= 'five' ;
656prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
657execute stmt1 using @arg00, @arg01, @arg02 ;
658b
659one
660two
661prepare stmt1 from ' select b FROM t1 where b like ? ';
662set @arg00='two' ;
663execute stmt1 using @arg00 ;
664b
665two
666set @arg00='tw%' ;
667execute stmt1 using @arg00 ;
668b
669two
670set @arg00='%wo' ;
671execute stmt1 using @arg00 ;
672b
673two
674set @arg00=null ;
675insert into t9 set c1= 0, c5 = NULL ;
676select c5 from t9 where c5 > NULL ;
677c5
678prepare stmt1 from ' select c5 from t9 where c5 > ? ';
679execute stmt1 using @arg00 ;
680c5
681select c5 from t9 where c5 < NULL ;
682c5
683prepare stmt1 from ' select c5 from t9 where c5 < ? ';
684execute stmt1 using @arg00 ;
685c5
686select c5 from t9 where c5 = NULL ;
687c5
688prepare stmt1 from ' select c5 from t9 where c5 = ? ';
689execute stmt1 using @arg00 ;
690c5
691select c5 from t9 where c5 <=> NULL ;
692c5
693NULL
694prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
695execute stmt1 using @arg00 ;
696c5
697NULL
698delete from t9 where c1= 0 ;
699set @arg00='>' ;
700select a FROM t1 where a @arg00 1 ;
701ERROR 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
702prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
703ERROR 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
704set @arg00=1 ;
705select a,b FROM t1 where a is not NULL
706AND b is not NULL group by a - @arg00 ;
707a	b
7081	one
7092	two
7103	three
7114	four
712prepare stmt1 from ' select a,b FROM t1 where a is not NULL
713AND b is not NULL group by a - ? ' ;
714execute stmt1 using @arg00 ;
715a	b
7161	one
7172	two
7183	three
7194	four
720set @arg00='two' ;
721select a,b FROM t1 where a is not NULL
722AND b is not NULL having b <> @arg00 order by a ;
723a	b
7241	one
7253	three
7264	four
727prepare stmt1 from ' select a,b FROM t1 where a is not NULL
728AND b is not NULL having b <> ? order by a ' ;
729execute stmt1 using @arg00 ;
730a	b
7311	one
7323	three
7334	four
734set @arg00=1 ;
735select a,b FROM t1 where a is not NULL
736AND b is not NULL order by a - @arg00 ;
737a	b
7381	one
7392	two
7403	three
7414	four
742prepare stmt1 from ' select a,b FROM t1 where a is not NULL
743AND b is not NULL order by a - ? ' ;
744execute stmt1 using @arg00 ;
745a	b
7461	one
7472	two
7483	three
7494	four
750set @arg00=2 ;
751select a,b from t1 order by 2 ;
752a	b
7534	four
7541	one
7553	three
7562	two
757prepare stmt1 from ' select a,b from t1
758order by ? ';
759execute stmt1 using @arg00;
760a	b
7614	four
7621	one
7633	three
7642	two
765set @arg00=1 ;
766execute stmt1 using @arg00;
767a	b
7681	one
7692	two
7703	three
7714	four
772set @arg00=0 ;
773execute stmt1 using @arg00;
774ERROR 42S22: Unknown column '?' in 'order clause'
775set @arg00=1;
776prepare stmt1 from ' select a,b from t1 order by a
777limit 1 ';
778execute stmt1 ;
779a	b
7801	one
781prepare stmt1 from ' select a,b from t1 order by a limit ? ';
782execute stmt1 using @arg00;
783a	b
7841	one
785set @arg00='b' ;
786set @arg01=0 ;
787set @arg02=2 ;
788set @arg03=2 ;
789select sum(a), @arg00 from t1 where a > @arg01
790and b is not null group by substr(b,@arg02)
791having sum(a) <> @arg03 ;
792sum(a)	@arg00
7933	b
7941	b
7954	b
796prepare stmt1 from ' select sum(a), ? from t1 where a > ?
797and b is not null group by substr(b,?)
798having sum(a) <> ? ';
799execute stmt1 using @arg00, @arg01, @arg02, @arg03;
800sum(a)	?
8013	b
8021	b
8034	b
804test_sequence
805------ join tests ------
806select first.a as a1, second.a as a2
807from t1 first, t1 second
808where first.a = second.a order by a1 ;
809a1	a2
8101	1
8112	2
8123	3
8134	4
814prepare stmt1 from ' select first.a as a1, second.a as a2
815        from t1 first, t1 second
816        where first.a = second.a order by a1 ';
817execute stmt1 ;
818a1	a2
8191	1
8202	2
8213	3
8224	4
823set @arg00='ABC';
824set @arg01='two';
825set @arg02='one';
826select first.a, @arg00, second.a FROM t1 first, t1 second
827where @arg01 = first.b or first.a = second.a or second.b = @arg02
828order by second.a, first.a;
829a	@arg00	a
8301	ABC	1
8312	ABC	1
8323	ABC	1
8334	ABC	1
8342	ABC	2
8352	ABC	3
8363	ABC	3
8372	ABC	4
8384	ABC	4
839prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
840                    where ? = first.b or first.a = second.a or second.b = ?
841                    order by second.a, first.a';
842execute stmt1 using @arg00, @arg01, @arg02;
843a	?	a
8441	ABC	1
8452	ABC	1
8463	ABC	1
8474	ABC	1
8482	ABC	2
8492	ABC	3
8503	ABC	3
8512	ABC	4
8524	ABC	4
853drop table if exists t2 ;
854create table t2 as select * from t1 ;
855set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
856set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
857set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
858set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
859set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
860set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
861set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
862set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
863set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
864the join statement is:
865SELECT * FROM t2 right join t1 using(a) order by t2.a
866prepare stmt1 from @query9  ;
867execute stmt1 ;
868a	b	b
8691	one	one
8702	two	two
8713	three	three
8724	four	four
873execute stmt1 ;
874a	b	b
8751	one	one
8762	two	two
8773	three	three
8784	four	four
879execute stmt1 ;
880a	b	b
8811	one	one
8822	two	two
8833	three	three
8844	four	four
885the join statement is:
886SELECT * FROM t2 natural right join t1 order by t2.a
887prepare stmt1 from @query8 ;
888execute stmt1 ;
889a	b
8901	one
8912	two
8923	three
8934	four
894execute stmt1 ;
895a	b
8961	one
8972	two
8983	three
8994	four
900execute stmt1 ;
901a	b
9021	one
9032	two
9043	three
9054	four
906the join statement is:
907SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
908prepare stmt1 from @query7 ;
909execute stmt1 ;
910a	b	a	b
9111	one	1	one
9122	two	2	two
9133	three	3	three
9144	four	4	four
915execute stmt1 ;
916a	b	a	b
9171	one	1	one
9182	two	2	two
9193	three	3	three
9204	four	4	four
921execute stmt1 ;
922a	b	a	b
9231	one	1	one
9242	two	2	two
9253	three	3	three
9264	four	4	four
927the join statement is:
928SELECT * FROM t2 left join t1 using(a) order by t2.a
929prepare stmt1 from @query6 ;
930execute stmt1 ;
931a	b	b
9321	one	one
9332	two	two
9343	three	three
9354	four	four
936execute stmt1 ;
937a	b	b
9381	one	one
9392	two	two
9403	three	three
9414	four	four
942execute stmt1 ;
943a	b	b
9441	one	one
9452	two	two
9463	three	three
9474	four	four
948the join statement is:
949SELECT * FROM t2 natural left join t1 order by t2.a
950prepare stmt1 from @query5 ;
951execute stmt1 ;
952a	b
9531	one
9542	two
9553	three
9564	four
957execute stmt1 ;
958a	b
9591	one
9602	two
9613	three
9624	four
963execute stmt1 ;
964a	b
9651	one
9662	two
9673	three
9684	four
969the join statement is:
970SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
971prepare stmt1 from @query4 ;
972execute stmt1 ;
973a	b	a	b
9741	one	1	one
9752	two	2	two
9763	three	3	three
9774	four	4	four
978execute stmt1 ;
979a	b	a	b
9801	one	1	one
9812	two	2	two
9823	three	3	three
9834	four	4	four
984execute stmt1 ;
985a	b	a	b
9861	one	1	one
9872	two	2	two
9883	three	3	three
9894	four	4	four
990the join statement is:
991SELECT * FROM t2 join t1 using(a) order by t2.a
992prepare stmt1 from @query3 ;
993execute stmt1 ;
994a	b	b
9951	one	one
9962	two	two
9973	three	three
9984	four	four
999execute stmt1 ;
1000a	b	b
10011	one	one
10022	two	two
10033	three	three
10044	four	four
1005execute stmt1 ;
1006a	b	b
10071	one	one
10082	two	two
10093	three	three
10104	four	four
1011the join statement is:
1012SELECT * FROM t2 natural join t1 order by t2.a
1013prepare stmt1 from @query2 ;
1014execute stmt1 ;
1015a	b
10161	one
10172	two
10183	three
10194	four
1020execute stmt1 ;
1021a	b
10221	one
10232	two
10243	three
10254	four
1026execute stmt1 ;
1027a	b
10281	one
10292	two
10303	three
10314	four
1032the join statement is:
1033SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
1034prepare stmt1 from @query1 ;
1035execute stmt1 ;
1036a	b	a	b
10371	one	1	one
10382	two	2	two
10393	three	3	three
10404	four	4	four
1041execute stmt1 ;
1042a	b	a	b
10431	one	1	one
10442	two	2	two
10453	three	3	three
10464	four	4	four
1047execute stmt1 ;
1048a	b	a	b
10491	one	1	one
10502	two	2	two
10513	three	3	three
10524	four	4	four
1053drop table t2 ;
1054test_sequence
1055------ subquery tests ------
1056prepare stmt1 from ' select a, b FROM t1 outer_table where
1057   a = (select a from t1 where b = ''two'') ';
1058execute stmt1 ;
1059a	b
10602	two
1061set @arg00='two' ;
1062select a, b FROM t1 outer_table where
1063a = (select a from t1 where b = 'two' ) and b=@arg00 ;
1064a	b
10652	two
1066prepare stmt1 from ' select a, b FROM t1 outer_table where
1067   a = (select a from t1 where b = ''two'') and b=? ';
1068execute stmt1 using @arg00;
1069a	b
10702	two
1071set @arg00='two' ;
1072select a, b FROM t1 outer_table where
1073a = (select a from t1 where b = @arg00 ) and b='two' ;
1074a	b
10752	two
1076prepare stmt1 from ' select a, b FROM t1 outer_table where
1077   a = (select a from t1 where b = ? ) and b=''two'' ' ;
1078execute stmt1 using @arg00;
1079a	b
10802	two
1081set @arg00=3 ;
1082set @arg01='three' ;
1083select a,b FROM t1 where (a,b) in (select 3, 'three');
1084a	b
10853	three
1086select a FROM t1 where (a,b) in (select @arg00,@arg01);
1087a
10883
1089prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
1090execute stmt1 using @arg00, @arg01;
1091a
10923
1093set @arg00=1 ;
1094set @arg01='two' ;
1095set @arg02=2 ;
1096set @arg03='two' ;
1097select a, @arg00, b FROM t1 outer_table where
1098b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
1099a	@arg00	b
11002	1	two
1101prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
1102   b=? and a = (select ? from t1 where b = ? ) ' ;
1103execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
1104a	?	b
11052	1	two
1106prepare stmt1 from 'select c4 FROM t9 where
1107    c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
1108execute stmt1 using @arg01, @arg02;
1109c4
1110prepare stmt1 from ' select a, b FROM t1 outer_table where
1111   a = (select a from t1 where b = outer_table.b ) order by a ';
1112execute stmt1 ;
1113a	b
11141	one
11152	two
11163	three
11174	four
1118prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
1119                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
1120execute stmt1 ;
1121ccc
11221
1123deallocate prepare stmt1 ;
1124prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
1125                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
1126execute stmt1 ;
1127ccc
11281
1129deallocate prepare stmt1 ;
1130prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
1131                           (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
1132execute stmt1 ;
1133ccc
11341
1135deallocate prepare stmt1 ;
1136set @arg00='two' ;
1137select a, b FROM t1 outer_table where
1138a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
1139a	b
11402	two
1141prepare stmt1 from ' select a, b FROM t1 outer_table where
1142   a = (select a from t1 where b = outer_table.b) and b=? ';
1143execute stmt1 using @arg00;
1144a	b
11452	two
1146set @arg00=2 ;
1147select a, b FROM t1 outer_table where
1148a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
1149a	b
11502	two
1151prepare stmt1 from ' select a, b FROM t1 outer_table where
1152   a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
1153execute stmt1 using @arg00;
1154a	b
11552	two
1156set @arg00=2 ;
1157select a, b FROM t1 outer_table where
1158a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
1159a	b
11602	two
1161prepare stmt1 from ' select a, b FROM t1 outer_table where
1162   a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
1163execute stmt1 using @arg00;
1164a	b
11652	two
1166set @arg00=1 ;
1167set @arg01='two' ;
1168set @arg02=2 ;
1169set @arg03='two' ;
1170select a, @arg00, b FROM t1 outer_table where
1171b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
1172and outer_table.a=a ) ;
1173a	@arg00	b
11742	1	two
1175prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
1176   b=? and a = (select ? from t1 where outer_table.b = ?
1177                   and outer_table.a=a ) ' ;
1178execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
1179a	?	b
11802	1	two
1181set @arg00=1 ;
1182set @arg01=0 ;
1183select a, @arg00
1184from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
1185where a=@arg01;
1186a	@arg00
11870	1
1188prepare stmt1 from ' select a, ?
1189                    from ( select a - ? as a from t1 where a=? ) as t2
1190                    where a=? ';
1191execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
1192a	?
11930	1
1194drop table if exists t2 ;
1195create table t2 as select * from t1;
1196prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
1197execute stmt1 ;
1198a in (select a from t2)
11991
12001
12011
12021
1203drop table if exists t5, t6, t7 ;
1204create table t5 (a int , b int) ;
1205create table t6 like t5 ;
1206create table t7 like t5 ;
1207insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
1208(2, -1), (3, 10) ;
1209insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
1210insert into t7 values (3, 3), (2, 2), (1, 1) ;
1211prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
1212                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
1213                     group by t5.a order by sum limit 1) from t7 ' ;
1214execute stmt1 ;
1215a	(select count(distinct t5.b) as sum from t5, t6
1216                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
1217                     group by t5.a order by sum limit 1)
12183	1
12192	2
12201	2
1221execute stmt1 ;
1222a	(select count(distinct t5.b) as sum from t5, t6
1223                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
1224                     group by t5.a order by sum limit 1)
12253	1
12262	2
12271	2
1228execute stmt1 ;
1229a	(select count(distinct t5.b) as sum from t5, t6
1230                     where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
1231                     group by t5.a order by sum limit 1)
12323	1
12332	2
12341	2
1235drop table t5, t6, t7 ;
1236drop table if exists t2 ;
1237create table t2 as select * from t9;
1238set @stmt= ' SELECT
1239   (SELECT SUM(c1 + c12 + 0.0) FROM t2
1240    where (t9.c2 - 0e-3) = t2.c2
1241    GROUP BY t9.c15 LIMIT 1) as scalar_s,
1242   exists (select 1.0e+0 from t2
1243           where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
1244   c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
1245   (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
1246FROM t9,
1247(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
1248prepare stmt1 from @stmt ;
1249execute stmt1 ;
1250execute stmt1 ;
1251set @stmt= concat('explain ',@stmt);
1252prepare stmt1 from @stmt ;
1253execute stmt1 ;
1254execute stmt1 ;
1255set @stmt= ' SELECT
1256   (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
1257    GROUP BY t9.c15 LIMIT 1) as scalar_s,
1258   exists (select ? from t2
1259           where t2.c3*?=t9.c4) as exists_s,
1260   c5*? in (select c6+? from t2) as in_s,
1261   (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
1262FROM t9,
1263(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
1264set @arg00= 0.0 ;
1265set @arg01= 0e-3 ;
1266set @arg02= 1.0e+0 ;
1267set @arg03= 9.0000000000 ;
1268set @arg04= 4 ;
1269set @arg05= 0.3e+1 ;
1270set @arg06= 4 ;
1271set @arg07= 4 ;
1272set @arg08= 4.0 ;
1273set @arg09= 40e-1 ;
1274prepare stmt1 from @stmt ;
1275execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
1276@arg07, @arg08, @arg09 ;
1277execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
1278@arg07, @arg08, @arg09 ;
1279set @stmt= concat('explain ',@stmt);
1280prepare stmt1 from @stmt ;
1281execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
1282@arg07, @arg08, @arg09 ;
1283execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
1284@arg07, @arg08, @arg09 ;
1285drop table t2 ;
1286select 1 < (select a from t1) ;
1287ERROR 21000: Subquery returns more than 1 row
1288prepare stmt1 from ' select 1 < (select a from t1) ' ;
1289execute stmt1 ;
1290ERROR 21000: Subquery returns more than 1 row
1291select 1 as my_col ;
1292my_col
12931
1294test_sequence
1295------ union tests ------
1296prepare stmt1 from ' select a FROM t1 where a=1
1297                     union distinct
1298                     select a FROM t1 where a=1 ';
1299execute stmt1 ;
1300a
13011
1302execute stmt1 ;
1303a
13041
1305prepare stmt1 from ' select a FROM t1 where a=1
1306                     union all
1307                     select a FROM t1 where a=1 ';
1308execute stmt1 ;
1309a
13101
13111
1312prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
1313ERROR 21000: The used SELECT statements have a different number of columns
1314prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
1315ERROR 21000: The used SELECT statements have a different number of columns
1316prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
1317ERROR 21000: The used SELECT statements have a different number of columns
1318prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
1319ERROR 21000: The used SELECT statements have a different number of columns
1320set @arg00=1 ;
1321select @arg00 FROM t1 where a=1
1322union distinct
1323select 1 FROM t1 where a=1;
1324@arg00
13251
1326prepare stmt1 from ' select ? FROM t1 where a=1
1327                     union distinct
1328                     select 1 FROM t1 where a=1 ' ;
1329execute stmt1 using @arg00;
1330?
13311
1332set @arg00=1 ;
1333select 1 FROM t1 where a=1
1334union distinct
1335select @arg00 FROM t1 where a=1;
13361
13371
1338prepare stmt1 from ' select 1 FROM t1 where a=1
1339                     union distinct
1340                     select ? FROM t1 where a=1 ' ;
1341execute stmt1 using @arg00;
13421
13431
1344set @arg00='a' ;
1345select @arg00 FROM t1 where a=1
1346union distinct
1347select @arg00 FROM t1 where a=1;
1348@arg00
1349a
1350prepare stmt1 from ' select ? FROM t1 where a=1
1351                     union distinct
1352                     select ? FROM t1 where a=1 ';
1353execute stmt1 using @arg00, @arg00;
1354?
1355a
1356prepare stmt1 from ' select ?
1357                     union distinct
1358                     select ? ';
1359execute stmt1 using @arg00, @arg00;
1360?
1361a
1362set @arg00='a' ;
1363set @arg01=1 ;
1364set @arg02='a' ;
1365set @arg03=2 ;
1366select @arg00 FROM t1 where a=@arg01
1367union distinct
1368select @arg02 FROM t1 where a=@arg03;
1369@arg00
1370a
1371prepare stmt1 from ' select ? FROM t1 where a=?
1372                     union distinct
1373                     select ? FROM t1 where a=? ' ;
1374execute stmt1 using @arg00, @arg01, @arg02, @arg03;
1375?
1376a
1377set @arg00=1 ;
1378prepare stmt1 from ' select sum(a) + 200, ? from t1
1379union distinct
1380select sum(a) + 200, 1 from t1
1381group by b ' ;
1382execute stmt1 using @arg00;
1383sum(a) + 200	?
1384210	1
1385204	1
1386201	1
1387203	1
1388202	1
1389set @Oporto='Oporto' ;
1390set @Lisboa='Lisboa' ;
1391set @0=0 ;
1392set @1=1 ;
1393set @2=2 ;
1394set @3=3 ;
1395set @4=4 ;
1396select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
1397@Oporto	@Lisboa	@0	@1	@2	@3	@4
1398Oporto	Lisboa	0	1	2	3	4
1399select sum(a) + 200 as the_sum, @Oporto as the_town from t1
1400group by b
1401union distinct
1402select sum(a) + 200, @Lisboa from t1
1403group by b ;
1404the_sum	the_town
1405204	Oporto
1406201	Oporto
1407203	Oporto
1408202	Oporto
1409204	Lisboa
1410201	Lisboa
1411203	Lisboa
1412202	Lisboa
1413prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
1414                     group by b
1415                     union distinct
1416                     select sum(a) + 200, ? from t1
1417                     group by b ' ;
1418execute stmt1 using @Oporto, @Lisboa;
1419the_sum	the_town
1420204	Oporto
1421201	Oporto
1422203	Oporto
1423202	Oporto
1424204	Lisboa
1425201	Lisboa
1426203	Lisboa
1427202	Lisboa
1428select sum(a) + 200 as the_sum, @Oporto as the_town from t1
1429where a > @1
1430group by b
1431union distinct
1432select sum(a) + 200, @Lisboa from t1
1433where a > @2
1434group by b ;
1435the_sum	the_town
1436204	Oporto
1437203	Oporto
1438202	Oporto
1439204	Lisboa
1440203	Lisboa
1441prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
1442                     where a > ?
1443                     group by b
1444                     union distinct
1445                     select sum(a) + 200, ? from t1
1446                     where a > ?
1447                     group by b ' ;
1448execute stmt1 using @Oporto, @1, @Lisboa, @2;
1449the_sum	the_town
1450204	Oporto
1451203	Oporto
1452202	Oporto
1453204	Lisboa
1454203	Lisboa
1455select sum(a) + 200 as the_sum, @Oporto as the_town from t1
1456where a > @1
1457group by b
1458having avg(a) > @2
1459union distinct
1460select sum(a) + 200, @Lisboa from t1
1461where a > @2
1462group by b
1463having avg(a) > @3;
1464the_sum	the_town
1465204	Oporto
1466203	Oporto
1467204	Lisboa
1468prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
1469                     where a > ?
1470                     group by b
1471                     having avg(a) > ?
1472                     union distinct
1473                     select sum(a) + 200, ? from t1
1474                     where a > ?
1475                     group by b
1476                     having avg(a) > ? ';
1477execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
1478the_sum	the_town
1479204	Oporto
1480203	Oporto
1481204	Lisboa
1482test_sequence
1483------ delete tests ------
1484delete from t1 ;
1485insert into t1 values (1,'one');
1486insert into t1 values (2,'two');
1487insert into t1 values (3,'three');
1488insert into t1 values (4,'four');
1489commit ;
1490delete from t9 ;
1491insert into t9
1492set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
1493c10= 1, c11= 1, c12 = 1,
1494c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1495c16= '11:11:11', c17= '2004',
1496c18= 1, c19=true, c20= 'a', c21= '123456789a',
1497c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1498c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1499c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
1500insert into t9
1501set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
1502c10= 9, c11= 9, c12 = 9,
1503c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1504c16= '11:11:11', c17= '2004',
1505c18= 1, c19=false, c20= 'a', c21= '123456789a',
1506c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1507c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1508c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
1509commit ;
1510SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
1511Warnings:
1512Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
1513prepare stmt1 from 'delete from t1 where a=2' ;
1514execute stmt1;
1515select a,b from t1 where a=2;
1516a	b
1517execute stmt1;
1518insert into t1 values(0,NULL);
1519set @arg00=NULL;
1520prepare stmt1 from 'delete from t1 where b=?' ;
1521execute stmt1 using @arg00;
1522select a,b from t1 where b is NULL ;
1523a	b
15240	NULL
1525set @arg00='one';
1526execute stmt1 using @arg00;
1527select a,b from t1 where b=@arg00;
1528a	b
1529prepare stmt1 from 'truncate table t1' ;
1530test_sequence
1531------ update tests ------
1532delete from t1 ;
1533insert into t1 values (1,'one');
1534insert into t1 values (2,'two');
1535insert into t1 values (3,'three');
1536insert into t1 values (4,'four');
1537commit ;
1538delete from t9 ;
1539insert into t9
1540set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
1541c10= 1, c11= 1, c12 = 1,
1542c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1543c16= '11:11:11', c17= '2004',
1544c18= 1, c19=true, c20= 'a', c21= '123456789a',
1545c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1546c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1547c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
1548insert into t9
1549set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
1550c10= 9, c11= 9, c12 = 9,
1551c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1552c16= '11:11:11', c17= '2004',
1553c18= 1, c19=false, c20= 'a', c21= '123456789a',
1554c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1555c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1556c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
1557commit ;
1558prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
1559execute stmt1;
1560select a,b from t1 where a=2;
1561a	b
15622	a=two
1563execute stmt1;
1564select a,b from t1 where a=2;
1565a	b
15662	a=two
1567set @arg00=NULL;
1568prepare stmt1 from 'update t1 set b=? where a=2' ;
1569execute stmt1 using @arg00;
1570select a,b from t1 where a=2;
1571a	b
15722	NULL
1573set @arg00='two';
1574execute stmt1 using @arg00;
1575select a,b from t1 where a=2;
1576a	b
15772	two
1578set @arg00=2;
1579prepare stmt1 from 'update t1 set b=NULL where a=?' ;
1580execute stmt1 using @arg00;
1581select a,b from t1 where a=@arg00;
1582a	b
15832	NULL
1584update t1 set b='two' where a=@arg00;
1585set @arg00=2000;
1586execute stmt1 using @arg00;
1587select a,b from t1 where a=@arg00;
1588a	b
1589set @arg00=2;
1590set @arg01=22;
1591prepare stmt1 from 'update t1 set a=? where a=?' ;
1592execute stmt1 using @arg00, @arg00;
1593select a,b from t1 where a=@arg00;
1594a	b
15952	two
1596execute stmt1 using @arg01, @arg00;
1597select a,b from t1 where a=@arg01;
1598a	b
159922	two
1600execute stmt1 using @arg00, @arg01;
1601select a,b from t1 where a=@arg00;
1602a	b
16032	two
1604set @arg00=NULL;
1605set @arg01=2;
1606execute stmt1 using @arg00, @arg01;
1607Warnings:
1608Warning	1048	Column 'a' cannot be null
1609select a,b from t1 order by a;
1610a	b
16110	two
16121	one
16133	three
16144	four
1615set @arg00=0;
1616execute stmt1 using @arg01, @arg00;
1617select a,b from t1 order by a;
1618a	b
16191	one
16202	two
16213	three
16224	four
1623set @arg00=23;
1624set @arg01='two';
1625set @arg02=2;
1626set @arg03='two';
1627set @arg04=2;
1628drop table if exists t2;
1629create table t2 as select a,b from t1 ;
1630prepare stmt1 from 'update t1 set a=? where b=?
1631                    and a in (select ? from t2
1632                              where b = ? or a = ?)';
1633execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
1634affected rows: 1
1635info: Rows matched: 1  Changed: 1  Warnings: 0
1636select a,b from t1 where a = @arg00 ;
1637a	b
163823	two
1639prepare stmt1 from 'update t1 set a=? where b=?
1640                    and a not in (select ? from t2
1641                              where b = ? or a = ?)';
1642execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
1643affected rows: 1
1644info: Rows matched: 1  Changed: 1  Warnings: 0
1645select a,b from t1 order by a ;
1646a	b
16471	one
16482	two
16493	three
16504	four
1651drop table t2 ;
1652create table t2
1653(
1654a int, b varchar(30),
1655primary key(a)
1656) engine = 'MYISAM'  ;
1657insert into t2(a,b) select a, b from t1 ;
1658prepare stmt1 from 'update t1 set a=? where b=?
1659                    and a in (select ? from t2
1660                              where b = ? or a = ?)';
1661execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
1662affected rows: 1
1663info: Rows matched: 1  Changed: 1  Warnings: 0
1664select a,b from t1 where a = @arg00 ;
1665a	b
166623	two
1667prepare stmt1 from 'update t1 set a=? where b=?
1668                    and a not in (select ? from t2
1669                              where b = ? or a = ?)';
1670execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
1671affected rows: 1
1672info: Rows matched: 1  Changed: 1  Warnings: 0
1673select a,b from t1 order by a ;
1674a	b
16751	one
16762	two
16773	three
16784	four
1679drop table t2 ;
1680set @arg00=1;
1681prepare stmt1 from 'update t1 set b=''bla''
1682where a=2
1683limit 1';
1684execute stmt1 ;
1685select a,b from t1 where b = 'bla' ;
1686a	b
16872	bla
1688prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
1689execute stmt1 using @arg00;
1690test_sequence
1691------ insert tests ------
1692delete from t1 ;
1693insert into t1 values (1,'one');
1694insert into t1 values (2,'two');
1695insert into t1 values (3,'three');
1696insert into t1 values (4,'four');
1697commit ;
1698delete from t9 ;
1699insert into t9
1700set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
1701c10= 1, c11= 1, c12 = 1,
1702c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1703c16= '11:11:11', c17= '2004',
1704c18= 1, c19=true, c20= 'a', c21= '123456789a',
1705c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1706c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1707c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
1708insert into t9
1709set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
1710c10= 9, c11= 9, c12 = 9,
1711c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
1712c16= '11:11:11', c17= '2004',
1713c18= 1, c19=false, c20= 'a', c21= '123456789a',
1714c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
1715c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
1716c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
1717commit ;
1718prepare stmt1 from 'insert into t1 values(5, ''five'' )';
1719execute stmt1;
1720select a,b from t1 where a = 5;
1721a	b
17225	five
1723set @arg00='six' ;
1724prepare stmt1 from 'insert into t1 values(6, ? )';
1725execute stmt1 using @arg00;
1726select a,b from t1 where b = @arg00;
1727a	b
17286	six
1729execute stmt1 using @arg00;
1730ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
1731set @arg00=NULL ;
1732prepare stmt1 from 'insert into t1 values(0, ? )';
1733execute stmt1 using @arg00;
1734select a,b from t1 where b is NULL;
1735a	b
17360	NULL
1737set @arg00=8 ;
1738set @arg01='eight' ;
1739prepare stmt1 from 'insert into t1 values(?, ? )';
1740execute stmt1 using @arg00, @arg01 ;
1741select a,b from t1 where b = @arg01;
1742a	b
17438	eight
1744set @NULL= null ;
1745set @arg00= 'abc' ;
1746execute stmt1 using @NULL, @NULL ;
1747ERROR 23000: Column 'a' cannot be null
1748execute stmt1 using @NULL, @NULL ;
1749ERROR 23000: Column 'a' cannot be null
1750execute stmt1 using @NULL, @arg00 ;
1751ERROR 23000: Column 'a' cannot be null
1752execute stmt1 using @NULL, @arg00 ;
1753ERROR 23000: Column 'a' cannot be null
1754set @arg01= 10000 + 2 ;
1755execute stmt1 using @arg01, @arg00 ;
1756set @arg01= 10000 + 1 ;
1757execute stmt1 using @arg01, @arg00 ;
1758select * from t1 where a > 10000 order by a ;
1759a	b
176010001	abc
176110002	abc
1762delete from t1 where a > 10000 ;
1763set @arg01= 10000 + 2 ;
1764execute stmt1 using @arg01, @NULL ;
1765set @arg01= 10000 + 1 ;
1766execute stmt1 using @arg01, @NULL ;
1767select * from t1 where a > 10000 order by a ;
1768a	b
176910001	NULL
177010002	NULL
1771delete from t1 where a > 10000 ;
1772set @arg01= 10000 + 10 ;
1773execute stmt1 using @arg01, @arg01 ;
1774set @arg01= 10000 + 9 ;
1775execute stmt1 using @arg01, @arg01 ;
1776set @arg01= 10000 + 8 ;
1777execute stmt1 using @arg01, @arg01 ;
1778set @arg01= 10000 + 7 ;
1779execute stmt1 using @arg01, @arg01 ;
1780set @arg01= 10000 + 6 ;
1781execute stmt1 using @arg01, @arg01 ;
1782set @arg01= 10000 + 5 ;
1783execute stmt1 using @arg01, @arg01 ;
1784set @arg01= 10000 + 4 ;
1785execute stmt1 using @arg01, @arg01 ;
1786set @arg01= 10000 + 3 ;
1787execute stmt1 using @arg01, @arg01 ;
1788set @arg01= 10000 + 2 ;
1789execute stmt1 using @arg01, @arg01 ;
1790set @arg01= 10000 + 1 ;
1791execute stmt1 using @arg01, @arg01 ;
1792select * from t1 where a > 10000 order by a ;
1793a	b
179410001	10001
179510002	10002
179610003	10003
179710004	10004
179810005	10005
179910006	10006
180010007	10007
180110008	10008
180210009	10009
180310010	10010
1804delete from t1 where a > 10000 ;
1805set @arg00=81 ;
1806set @arg01='8-1' ;
1807set @arg02=82 ;
1808set @arg03='8-2' ;
1809prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
1810execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
1811select a,b from t1 where a in (@arg00,@arg02) ;
1812a	b
181381	8-1
181482	8-2
1815set @arg00=9 ;
1816set @arg01='nine' ;
1817prepare stmt1 from 'insert into t1 set a=?, b=? ';
1818execute stmt1 using @arg00, @arg01 ;
1819select a,b from t1 where a = @arg00 ;
1820a	b
18219	nine
1822set @arg00=6 ;
1823set @arg01=1 ;
1824prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
1825                    on duplicate key update a=a + ?, b=concat(b,''modified'') ';
1826execute stmt1 using @arg00, @arg01;
1827select * from t1 order by a;
1828a	b
18290	NULL
18301	one
18312	two
18323	three
18334	four
18345	five
18357	sixmodified
18368	eight
18379	nine
183881	8-1
183982	8-2
1840set @arg00=81 ;
1841set @arg01=1 ;
1842execute stmt1 using @arg00, @arg01;
1843ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
1844drop table if exists t2 ;
1845create table t2 (id int auto_increment primary key)
1846ENGINE= 'MYISAM'  ;
1847prepare stmt1 from ' select last_insert_id() ' ;
1848insert into t2 values (NULL) ;
1849execute stmt1 ;
1850last_insert_id()
18511
1852insert into t2 values (NULL) ;
1853execute stmt1 ;
1854last_insert_id()
18552
1856drop table t2 ;
1857set @1000=1000 ;
1858set @x1000_2="x1000_2" ;
1859set @x1000_3="x1000_3" ;
1860set @x1000="x1000" ;
1861set @1100=1100 ;
1862set @x1100="x1100" ;
1863set @100=100 ;
1864set @updated="updated" ;
1865insert into t1 values(1000,'x1000_1') ;
1866insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
1867on duplicate key update a = a + @100, b = concat(b,@updated) ;
1868select a,b from t1 where a >= 1000 order by a ;
1869a	b
18701000	x1000_3
18711100	x1000_1updated
1872delete from t1 where a >= 1000 ;
1873insert into t1 values(1000,'x1000_1') ;
1874prepare stmt1 from ' insert into t1 values(?,?),(?,?)
1875               on duplicate key update a = a + ?, b = concat(b,?) ';
1876execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
1877select a,b from t1 where a >= 1000 order by a ;
1878a	b
18791000	x1000_3
18801100	x1000_1updated
1881delete from t1 where a >= 1000 ;
1882insert into t1 values(1000,'x1000_1') ;
1883execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
1884select a,b from t1 where a >= 1000 order by a ;
1885a	b
18861200	x1000_1updatedupdated
1887delete from t1 where a >= 1000 ;
1888prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
1889execute stmt1;
1890execute stmt1;
1891execute stmt1;
1892test_sequence
1893------ multi table tests ------
1894delete from t1 ;
1895delete from t9 ;
1896insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
1897insert into t9 (c1,c21)
1898values (1, 'one'), (2, 'two'), (3, 'three') ;
1899prepare stmt_delete from " delete t1, t9
1900  from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
1901prepare stmt_update from " update t1, t9
1902  set t1.b='updated', t9.c21='updated'
1903  where t1.a=t9.c1 and t1.a=? ";
1904prepare stmt_select1 from " select a, b from t1 order by a" ;
1905prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
1906set @arg00= 1 ;
1907execute stmt_update using @arg00 ;
1908execute stmt_delete ;
1909execute stmt_select1 ;
1910a	b
19112	two
19123	three
1913execute stmt_select2 ;
1914c1	c21
19152	two
19163	three
1917set @arg00= @arg00 + 1 ;
1918execute stmt_update using @arg00 ;
1919execute stmt_delete ;
1920execute stmt_select1 ;
1921a	b
19223	three
1923execute stmt_select2 ;
1924c1	c21
19253	three
1926set @arg00= @arg00 + 1 ;
1927execute stmt_update using @arg00 ;
1928execute stmt_delete ;
1929execute stmt_select1 ;
1930a	b
1931execute stmt_select2 ;
1932c1	c21
1933set @arg00= @arg00 + 1 ;
1934SET sql_mode = default;
1935SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
1936Warnings:
1937Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
1938drop table if exists t5 ;
1939set @arg01= 8;
1940set @arg02= 8.0;
1941set @arg03= 80.00000000000e-1;
1942set @arg04= 'abc' ;
1943set @arg05= CAST('abc' as binary) ;
1944set @arg06= '1991-08-05' ;
1945set @arg07= CAST('1991-08-05' as date);
1946set @arg08= '1991-08-05 01:01:01' ;
1947set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
1948set @arg10= unix_timestamp('1991-01-01 01:01:01');
1949set @arg11= YEAR('1991-01-01 01:01:01');
1950set @arg12= 8 ;
1951set @arg12= NULL ;
1952set @arg13= 8.0 ;
1953set @arg13= NULL ;
1954set @arg14= 'abc';
1955set @arg14= NULL ;
1956set @arg15= CAST('abc' as binary) ;
1957set @arg15= NULL ;
1958create table t5 as select
19598                           as const01, @arg01 as param01,
19608.0                         as const02, @arg02 as param02,
196180.00000000000e-1           as const03, @arg03 as param03,
1962'abc'                       as const04, @arg04 as param04,
1963CAST('abc' as binary)       as const05, @arg05 as param05,
1964'1991-08-05'                as const06, @arg06 as param06,
1965CAST('1991-08-05' as date)  as const07, @arg07 as param07,
1966'1991-08-05 01:01:01'       as const08, @arg08 as param08,
1967CAST('1991-08-05 01:01:01'  as datetime) as const09, @arg09 as param09,
1968unix_timestamp('1991-01-01 01:01:01')    as const10, @arg10 as param10,
1969YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
1970NULL                        as const12, @arg12 as param12,
1971@arg13 as param13,
1972@arg14 as param14,
1973@arg15 as param15;
1974show create table t5 ;
1975Table	Create Table
1976t5	CREATE TABLE `t5` (
1977  `const01` int(1) NOT NULL DEFAULT '0',
1978  `param01` bigint(20) DEFAULT NULL,
1979  `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
1980  `param02` decimal(65,30) DEFAULT NULL,
1981  `const03` double NOT NULL DEFAULT '0',
1982  `param03` double DEFAULT NULL,
1983  `const04` varchar(3) NOT NULL DEFAULT '',
1984  `param04` longtext,
1985  `const05` varbinary(3) NOT NULL DEFAULT '',
1986  `param05` longblob,
1987  `const06` varchar(10) NOT NULL DEFAULT '',
1988  `param06` longtext,
1989  `const07` date DEFAULT NULL,
1990  `param07` longtext,
1991  `const08` varchar(19) NOT NULL DEFAULT '',
1992  `param08` longtext,
1993  `const09` datetime DEFAULT NULL,
1994  `param09` longtext,
1995  `const10` int(11) NOT NULL DEFAULT '0',
1996  `param10` bigint(20) DEFAULT NULL,
1997  `const11` int(4) DEFAULT NULL,
1998  `param11` bigint(20) DEFAULT NULL,
1999  `const12` binary(0) DEFAULT NULL,
2000  `param12` bigint(20) DEFAULT NULL,
2001  `param13` decimal(65,30) DEFAULT NULL,
2002  `param14` longtext,
2003  `param15` longblob
2004) ENGINE=ENGINE DEFAULT CHARSET=latin1
2005select * from t5 ;
2006Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2007def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
2008def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
2009def	test	t5	t5	const02	const02	246	4	3	N	32769	1	63
2010def	test	t5	t5	param02	param02	246	67	32	Y	32768	30	63
2011def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
2012def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
2013def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
2014def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
2015def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
2016def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
2017def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
2018def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
2019def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
2020def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
2021def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
2022def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
2023def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
2024def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
2025def	test	t5	t5	const10	const10	3	11	9	N	32769	0	63
2026def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
2027def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
2028def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
2029def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
2030def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
2031def	test	t5	t5	param13	param13	246	67	0	Y	32768	30	63
2032def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
2033def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
2034const01	8
2035param01	8
2036const02	8.0
2037param02	8.000000000000000000000000000000
2038const03	8
2039param03	8
2040const04	abc
2041param04	abc
2042const05	abc
2043param05	abc
2044const06	1991-08-05
2045param06	1991-08-05
2046const07	1991-08-05
2047param07	1991-08-05
2048const08	1991-08-05 01:01:01
2049param08	1991-08-05 01:01:01
2050const09	1991-08-05 01:01:01
2051param09	1991-08-05 01:01:01
2052const10	662680861
2053param10	662680861
2054const11	1991
2055param11	1991
2056const12	NULL
2057param12	NULL
2058param13	NULL
2059param14	NULL
2060param15	NULL
2061drop table t5 ;
2062test_sequence
2063------ data type conversion tests ------
2064delete from t1 ;
2065insert into t1 values (1,'one');
2066insert into t1 values (2,'two');
2067insert into t1 values (3,'three');
2068insert into t1 values (4,'four');
2069commit ;
2070delete from t9 ;
2071insert into t9
2072set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
2073c10= 1, c11= 1, c12 = 1,
2074c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
2075c16= '11:11:11', c17= '2004',
2076c18= 1, c19=true, c20= 'a', c21= '123456789a',
2077c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
2078c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
2079c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
2080insert into t9
2081set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
2082c10= 9, c11= 9, c12 = 9,
2083c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
2084c16= '11:11:11', c17= '2004',
2085c18= 1, c19=false, c20= 'a', c21= '123456789a',
2086c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
2087c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
2088c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
2089commit ;
2090insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
2091select * from t9 order by c1 ;
2092c1	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
20930	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
20941	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
20959	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
2096test_sequence
2097------ select @parameter:= column ------
2098prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
2099       @arg05, @arg06, @arg07, @arg08,
2100       @arg09, @arg10, @arg11, @arg12,
2101       @arg13, @arg14, @arg15, @arg16,
2102       @arg17, @arg18, @arg19, @arg20,
2103       @arg21, @arg22, @arg23, @arg24,
2104       @arg25, @arg26, @arg27, @arg28,
2105       @arg29, @arg30, @arg31, @arg32" ;
2106select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
2107@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
2108@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
2109@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
2110@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
2111@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
2112@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
2113@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
2114from t9 where c1= 1 ;
2115@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
21161	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
2117execute full_info ;
2118Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2119def					@arg01	8	20	1	Y	32896	0	63
2120def					@arg02	8	20	1	Y	32896	0	63
2121def					@arg03	8	20	1	Y	32896	0	63
2122def					@arg04	8	20	1	Y	32896	0	63
2123def					@arg05	8	20	1	Y	32896	0	63
2124def					@arg06	8	20	1	Y	32896	0	63
2125def					@arg07	5	23	1	Y	32896	31	63
2126def					@arg08	5	23	1	Y	32896	31	63
2127def					@arg09	5	23	1	Y	32896	31	63
2128def					@arg10	5	23	1	Y	32896	31	63
2129def					@arg11	246	83	6	Y	32896	30	63
2130def					@arg12	246	83	6	Y	32896	30	63
2131def					@arg13	250	16777215	10	Y	0	31	8
2132def					@arg14	250	16777215	19	Y	0	31	8
2133def					@arg15	250	16777215	19	Y	0	31	8
2134def					@arg16	250	16777215	8	Y	0	31	8
2135def					@arg17	8	20	4	Y	32928	0	63
2136def					@arg18	8	20	1	Y	32896	0	63
2137def					@arg19	8	20	1	Y	32896	0	63
2138def					@arg20	250	16777215	1	Y	0	31	8
2139def					@arg21	250	16777215	10	Y	0	31	8
2140def					@arg22	250	16777215	30	Y	0	31	8
2141def					@arg23	250	16777215	8	Y	128	31	63
2142def					@arg24	250	16777215	8	Y	0	31	8
2143def					@arg25	250	16777215	4	Y	128	31	63
2144def					@arg26	250	16777215	4	Y	0	31	8
2145def					@arg27	250	16777215	10	Y	128	31	63
2146def					@arg28	250	16777215	10	Y	0	31	8
2147def					@arg29	250	16777215	8	Y	128	31	63
2148def					@arg30	250	16777215	8	Y	0	31	8
2149def					@arg31	250	16777215	3	Y	0	31	8
2150def					@arg32	250	16777215	6	Y	0	31	8
2151@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
21521	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
2153select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
2154@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
2155@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
2156@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
2157@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
2158@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
2159@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
2160@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
2161from t9 where c1= 0 ;
2162@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
21630	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
2164execute full_info ;
2165Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2166def					@arg01	8	20	1	Y	32896	0	63
2167def					@arg02	8	20	0	Y	32896	0	63
2168def					@arg03	8	20	0	Y	32896	0	63
2169def					@arg04	8	20	0	Y	32896	0	63
2170def					@arg05	8	20	0	Y	32896	0	63
2171def					@arg06	8	20	0	Y	32896	0	63
2172def					@arg07	5	23	0	Y	32896	31	63
2173def					@arg08	5	23	0	Y	32896	31	63
2174def					@arg09	5	23	0	Y	32896	31	63
2175def					@arg10	5	23	0	Y	32896	31	63
2176def					@arg11	246	83	0	Y	32896	30	63
2177def					@arg12	246	83	0	Y	32896	30	63
2178def					@arg13	250	16777215	0	Y	0	31	8
2179def					@arg14	250	16777215	0	Y	0	31	8
2180def					@arg15	250	16777215	19	Y	0	31	8
2181def					@arg16	250	16777215	0	Y	0	31	8
2182def					@arg17	8	20	0	Y	32928	0	63
2183def					@arg18	8	20	0	Y	32896	0	63
2184def					@arg19	8	20	0	Y	32896	0	63
2185def					@arg20	250	16777215	0	Y	0	31	8
2186def					@arg21	250	16777215	0	Y	0	31	8
2187def					@arg22	250	16777215	0	Y	0	31	8
2188def					@arg23	250	16777215	0	Y	128	31	63
2189def					@arg24	250	16777215	0	Y	0	31	8
2190def					@arg25	250	16777215	0	Y	128	31	63
2191def					@arg26	250	16777215	0	Y	0	31	8
2192def					@arg27	250	16777215	0	Y	128	31	63
2193def					@arg28	250	16777215	0	Y	0	31	8
2194def					@arg29	250	16777215	0	Y	128	31	63
2195def					@arg30	250	16777215	0	Y	0	31	8
2196def					@arg31	250	16777215	0	Y	0	31	8
2197def					@arg32	250	16777215	0	Y	0	31	8
2198@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
21990	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
2200prepare stmt1 from "select
2201       @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
2202       @arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
2203       @arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
2204       @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
2205       @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
2206       @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
2207       @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
2208       @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
2209from t9 where c1= ?" ;
2210set @my_key= 1 ;
2211execute stmt1 using @my_key ;
2212@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
22131	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
2214execute full_info ;
2215Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2216def					@arg01	8	20	1	Y	32896	0	63
2217def					@arg02	8	20	1	Y	32896	0	63
2218def					@arg03	8	20	1	Y	32896	0	63
2219def					@arg04	8	20	1	Y	32896	0	63
2220def					@arg05	8	20	1	Y	32896	0	63
2221def					@arg06	8	20	1	Y	32896	0	63
2222def					@arg07	5	23	1	Y	32896	31	63
2223def					@arg08	5	23	1	Y	32896	31	63
2224def					@arg09	5	23	1	Y	32896	31	63
2225def					@arg10	5	23	1	Y	32896	31	63
2226def					@arg11	246	83	6	Y	32896	30	63
2227def					@arg12	246	83	6	Y	32896	30	63
2228def					@arg13	250	16777215	10	Y	0	31	8
2229def					@arg14	250	16777215	19	Y	0	31	8
2230def					@arg15	250	16777215	19	Y	0	31	8
2231def					@arg16	250	16777215	8	Y	0	31	8
2232def					@arg17	8	20	4	Y	32928	0	63
2233def					@arg18	8	20	1	Y	32896	0	63
2234def					@arg19	8	20	1	Y	32896	0	63
2235def					@arg20	250	16777215	1	Y	0	31	8
2236def					@arg21	250	16777215	10	Y	0	31	8
2237def					@arg22	250	16777215	30	Y	0	31	8
2238def					@arg23	250	16777215	8	Y	128	31	63
2239def					@arg24	250	16777215	8	Y	0	31	8
2240def					@arg25	250	16777215	4	Y	128	31	63
2241def					@arg26	250	16777215	4	Y	0	31	8
2242def					@arg27	250	16777215	10	Y	128	31	63
2243def					@arg28	250	16777215	10	Y	0	31	8
2244def					@arg29	250	16777215	8	Y	128	31	63
2245def					@arg30	250	16777215	8	Y	0	31	8
2246def					@arg31	250	16777215	3	Y	0	31	8
2247def					@arg32	250	16777215	6	Y	0	31	8
2248@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
22491	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
2250set @my_key= 0 ;
2251execute stmt1 using @my_key ;
2252@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
22530	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
2254execute full_info ;
2255Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2256def					@arg01	8	20	1	Y	32896	0	63
2257def					@arg02	8	20	0	Y	32896	0	63
2258def					@arg03	8	20	0	Y	32896	0	63
2259def					@arg04	8	20	0	Y	32896	0	63
2260def					@arg05	8	20	0	Y	32896	0	63
2261def					@arg06	8	20	0	Y	32896	0	63
2262def					@arg07	5	23	0	Y	32896	31	63
2263def					@arg08	5	23	0	Y	32896	31	63
2264def					@arg09	5	23	0	Y	32896	31	63
2265def					@arg10	5	23	0	Y	32896	31	63
2266def					@arg11	246	83	0	Y	32896	30	63
2267def					@arg12	246	83	0	Y	32896	30	63
2268def					@arg13	250	16777215	0	Y	0	31	8
2269def					@arg14	250	16777215	0	Y	0	31	8
2270def					@arg15	250	16777215	19	Y	0	31	8
2271def					@arg16	250	16777215	0	Y	0	31	8
2272def					@arg17	8	20	0	Y	32928	0	63
2273def					@arg18	8	20	0	Y	32896	0	63
2274def					@arg19	8	20	0	Y	32896	0	63
2275def					@arg20	250	16777215	0	Y	0	31	8
2276def					@arg21	250	16777215	0	Y	0	31	8
2277def					@arg22	250	16777215	0	Y	0	31	8
2278def					@arg23	250	16777215	0	Y	128	31	63
2279def					@arg24	250	16777215	0	Y	0	31	8
2280def					@arg25	250	16777215	0	Y	128	31	63
2281def					@arg26	250	16777215	0	Y	0	31	8
2282def					@arg27	250	16777215	0	Y	128	31	63
2283def					@arg28	250	16777215	0	Y	0	31	8
2284def					@arg29	250	16777215	0	Y	128	31	63
2285def					@arg30	250	16777215	0	Y	0	31	8
2286def					@arg31	250	16777215	0	Y	0	31	8
2287def					@arg32	250	16777215	0	Y	0	31	8
2288@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
22890	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
2290prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
2291ERROR 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
2292test_sequence
2293------ select column, .. into @parm,.. ------
2294select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
2295c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
2296c25, c26, c27, c28, c29, c30, c31, c32
2297into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
2298@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
2299@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
2300@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
2301from t9 where c1= 1 ;
2302execute full_info ;
2303Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2304def					@arg01	8	20	1	Y	32896	0	63
2305def					@arg02	8	20	1	Y	32896	0	63
2306def					@arg03	8	20	1	Y	32896	0	63
2307def					@arg04	8	20	1	Y	32896	0	63
2308def					@arg05	8	20	1	Y	32896	0	63
2309def					@arg06	8	20	1	Y	32896	0	63
2310def					@arg07	5	23	1	Y	32896	31	63
2311def					@arg08	5	23	1	Y	32896	31	63
2312def					@arg09	5	23	1	Y	32896	31	63
2313def					@arg10	5	23	1	Y	32896	31	63
2314def					@arg11	246	83	6	Y	32896	30	63
2315def					@arg12	246	83	6	Y	32896	30	63
2316def					@arg13	250	16777215	10	Y	0	31	8
2317def					@arg14	250	16777215	19	Y	0	31	8
2318def					@arg15	250	16777215	19	Y	0	31	8
2319def					@arg16	250	16777215	8	Y	0	31	8
2320def					@arg17	8	20	4	Y	32928	0	63
2321def					@arg18	8	20	1	Y	32896	0	63
2322def					@arg19	8	20	1	Y	32896	0	63
2323def					@arg20	250	16777215	1	Y	0	31	8
2324def					@arg21	250	16777215	10	Y	0	31	8
2325def					@arg22	250	16777215	30	Y	0	31	8
2326def					@arg23	250	16777215	8	Y	128	31	63
2327def					@arg24	250	16777215	8	Y	0	31	8
2328def					@arg25	250	16777215	4	Y	128	31	63
2329def					@arg26	250	16777215	4	Y	0	31	8
2330def					@arg27	250	16777215	10	Y	128	31	63
2331def					@arg28	250	16777215	10	Y	0	31	8
2332def					@arg29	250	16777215	8	Y	128	31	63
2333def					@arg30	250	16777215	8	Y	0	31	8
2334def					@arg31	250	16777215	3	Y	0	31	8
2335def					@arg32	250	16777215	6	Y	0	31	8
2336@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
23371	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
2338select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
2339c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
2340c25, c26, c27, c28, c29, c30, c31, c32
2341into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
2342@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
2343@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
2344@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
2345from t9 where c1= 0 ;
2346execute full_info ;
2347Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2348def					@arg01	8	20	1	Y	32896	0	63
2349def					@arg02	8	20	0	Y	32896	0	63
2350def					@arg03	8	20	0	Y	32896	0	63
2351def					@arg04	8	20	0	Y	32896	0	63
2352def					@arg05	8	20	0	Y	32896	0	63
2353def					@arg06	8	20	0	Y	32896	0	63
2354def					@arg07	5	23	0	Y	32896	31	63
2355def					@arg08	5	23	0	Y	32896	31	63
2356def					@arg09	5	23	0	Y	32896	31	63
2357def					@arg10	5	23	0	Y	32896	31	63
2358def					@arg11	246	83	0	Y	32896	30	63
2359def					@arg12	246	83	0	Y	32896	30	63
2360def					@arg13	250	16777215	0	Y	0	31	8
2361def					@arg14	250	16777215	0	Y	0	31	8
2362def					@arg15	250	16777215	19	Y	0	31	8
2363def					@arg16	250	16777215	0	Y	0	31	8
2364def					@arg17	8	20	0	Y	32928	0	63
2365def					@arg18	8	20	0	Y	32896	0	63
2366def					@arg19	8	20	0	Y	32896	0	63
2367def					@arg20	250	16777215	0	Y	0	31	8
2368def					@arg21	250	16777215	0	Y	0	31	8
2369def					@arg22	250	16777215	0	Y	0	31	8
2370def					@arg23	250	16777215	0	Y	128	31	63
2371def					@arg24	250	16777215	0	Y	0	31	8
2372def					@arg25	250	16777215	0	Y	128	31	63
2373def					@arg26	250	16777215	0	Y	0	31	8
2374def					@arg27	250	16777215	0	Y	128	31	63
2375def					@arg28	250	16777215	0	Y	0	31	8
2376def					@arg29	250	16777215	0	Y	128	31	63
2377def					@arg30	250	16777215	0	Y	0	31	8
2378def					@arg31	250	16777215	0	Y	0	31	8
2379def					@arg32	250	16777215	0	Y	0	31	8
2380@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
23810	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
2382prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
2383       c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
2384       c25, c26, c27, c28, c29, c30, c31, c32
2385into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
2386     @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
2387     @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
2388     @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
2389from t9 where c1= ?" ;
2390set @my_key= 1 ;
2391execute stmt1 using @my_key ;
2392execute full_info ;
2393Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2394def					@arg01	8	20	1	Y	32896	0	63
2395def					@arg02	8	20	1	Y	32896	0	63
2396def					@arg03	8	20	1	Y	32896	0	63
2397def					@arg04	8	20	1	Y	32896	0	63
2398def					@arg05	8	20	1	Y	32896	0	63
2399def					@arg06	8	20	1	Y	32896	0	63
2400def					@arg07	5	23	1	Y	32896	31	63
2401def					@arg08	5	23	1	Y	32896	31	63
2402def					@arg09	5	23	1	Y	32896	31	63
2403def					@arg10	5	23	1	Y	32896	31	63
2404def					@arg11	246	83	6	Y	32896	30	63
2405def					@arg12	246	83	6	Y	32896	30	63
2406def					@arg13	250	16777215	10	Y	0	31	8
2407def					@arg14	250	16777215	19	Y	0	31	8
2408def					@arg15	250	16777215	19	Y	0	31	8
2409def					@arg16	250	16777215	8	Y	0	31	8
2410def					@arg17	8	20	4	Y	32928	0	63
2411def					@arg18	8	20	1	Y	32896	0	63
2412def					@arg19	8	20	1	Y	32896	0	63
2413def					@arg20	250	16777215	1	Y	0	31	8
2414def					@arg21	250	16777215	10	Y	0	31	8
2415def					@arg22	250	16777215	30	Y	0	31	8
2416def					@arg23	250	16777215	8	Y	128	31	63
2417def					@arg24	250	16777215	8	Y	0	31	8
2418def					@arg25	250	16777215	4	Y	128	31	63
2419def					@arg26	250	16777215	4	Y	0	31	8
2420def					@arg27	250	16777215	10	Y	128	31	63
2421def					@arg28	250	16777215	10	Y	0	31	8
2422def					@arg29	250	16777215	8	Y	128	31	63
2423def					@arg30	250	16777215	8	Y	0	31	8
2424def					@arg31	250	16777215	3	Y	0	31	8
2425def					@arg32	250	16777215	6	Y	0	31	8
2426@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
24271	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
2428set @my_key= 0 ;
2429execute stmt1 using @my_key ;
2430execute full_info ;
2431Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
2432def					@arg01	8	20	1	Y	32896	0	63
2433def					@arg02	8	20	0	Y	32896	0	63
2434def					@arg03	8	20	0	Y	32896	0	63
2435def					@arg04	8	20	0	Y	32896	0	63
2436def					@arg05	8	20	0	Y	32896	0	63
2437def					@arg06	8	20	0	Y	32896	0	63
2438def					@arg07	5	23	0	Y	32896	31	63
2439def					@arg08	5	23	0	Y	32896	31	63
2440def					@arg09	5	23	0	Y	32896	31	63
2441def					@arg10	5	23	0	Y	32896	31	63
2442def					@arg11	246	83	0	Y	32896	30	63
2443def					@arg12	246	83	0	Y	32896	30	63
2444def					@arg13	250	16777215	0	Y	0	31	8
2445def					@arg14	250	16777215	0	Y	0	31	8
2446def					@arg15	250	16777215	19	Y	0	31	8
2447def					@arg16	250	16777215	0	Y	0	31	8
2448def					@arg17	8	20	0	Y	32928	0	63
2449def					@arg18	8	20	0	Y	32896	0	63
2450def					@arg19	8	20	0	Y	32896	0	63
2451def					@arg20	250	16777215	0	Y	0	31	8
2452def					@arg21	250	16777215	0	Y	0	31	8
2453def					@arg22	250	16777215	0	Y	0	31	8
2454def					@arg23	250	16777215	0	Y	128	31	63
2455def					@arg24	250	16777215	0	Y	0	31	8
2456def					@arg25	250	16777215	0	Y	128	31	63
2457def					@arg26	250	16777215	0	Y	0	31	8
2458def					@arg27	250	16777215	0	Y	128	31	63
2459def					@arg28	250	16777215	0	Y	0	31	8
2460def					@arg29	250	16777215	0	Y	128	31	63
2461def					@arg30	250	16777215	0	Y	0	31	8
2462def					@arg31	250	16777215	0	Y	0	31	8
2463def					@arg32	250	16777215	0	Y	0	31	8
2464@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
24650	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
2466prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
2467ERROR 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
2468test_sequence
2469-- insert into numeric columns --
2470insert into t9
2471( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2472values
2473( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
2474set @arg00= 21 ;
2475insert into t9
2476( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2477values
2478( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2479@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2480prepare stmt1 from "insert into t9
2481  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2482values
2483  ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
2484execute stmt1 ;
2485set @arg00= 23;
2486prepare stmt2 from "insert into t9
2487  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2488values
2489  (  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2490execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2491@arg00, @arg00, @arg00, @arg00 ;
2492insert into t9
2493( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2494values
2495( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
249630.0, 30.0, 30.0 ) ;
2497set @arg00= 31.0 ;
2498insert into t9
2499( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2500values
2501( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2502@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2503prepare stmt1 from "insert into t9
2504  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2505values
2506  ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
2507    32.0, 32.0, 32.0 )" ;
2508execute stmt1 ;
2509set @arg00= 33.0;
2510prepare stmt2 from "insert into t9
2511  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2512values
2513  (  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
2514execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2515@arg00, @arg00, @arg00, @arg00 ;
2516insert into t9
2517( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2518values
2519( '40', '40', '40', '40', '40', '40', '40', '40',
2520'40', '40', '40' ) ;
2521set @arg00= '41' ;
2522insert into t9
2523( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2524values
2525( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2526@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2527prepare stmt1 from "insert into t9
2528  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2529values
2530  ( '42', '42', '42', '42', '42', '42', '42', '42',
2531    '42', '42', '42' )" ;
2532execute stmt1 ;
2533set @arg00= '43';
2534prepare stmt2 from "insert into t9
2535  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2536values
2537  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2538execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2539@arg00, @arg00, @arg00, @arg00 ;
2540insert into t9
2541( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2542values
2543( CAST('50' as binary), CAST('50' as binary),
2544CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
2545CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
2546CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
2547set @arg00= CAST('51' as binary) ;
2548insert into t9
2549( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2550values
2551( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2552@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2553prepare stmt1 from "insert into t9
2554  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2555values
2556  ( CAST('52' as binary), CAST('52' as binary),
2557  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
2558  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
2559  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
2560execute stmt1 ;
2561set @arg00= CAST('53' as binary) ;
2562prepare stmt2 from "insert into t9
2563  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2564values
2565  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2566execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2567@arg00, @arg00, @arg00, @arg00 ;
2568set @arg00= 2 ;
2569set @arg00= NULL ;
2570insert into t9
2571( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2572values
2573( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2574NULL, NULL, NULL ) ;
2575insert into t9
2576( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2577values
2578( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
2579@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2580prepare stmt1 from "insert into t9
2581  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2582values
2583  ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2584    NULL, NULL, NULL )" ;
2585execute stmt1 ;
2586prepare stmt2 from "insert into t9
2587  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2588values
2589  ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2590execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2591@arg00, @arg00, @arg00, @arg00 ;
2592set @arg00= 8.0 ;
2593set @arg00= NULL ;
2594insert into t9
2595( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2596values
2597( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
2598@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2599prepare stmt2 from "insert into t9
2600  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2601values
2602  ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2603execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2604@arg00, @arg00, @arg00, @arg00 ;
2605set @arg00= 'abc' ;
2606set @arg00= NULL ;
2607insert into t9
2608( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2609values
2610( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
2611@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
2612prepare stmt2 from "insert into t9
2613  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2614values
2615  ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
2616execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2617@arg00, @arg00, @arg00, @arg00 ;
2618select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
2619from t9 where c1 >= 20
2620order by c1 ;
2621c1	c2	c3	c4	c5	c6	c7	c8	c9	c10	c12
262220	20	20	20	20	20	20	20	20	20	20.0000
262321	21	21	21	21	21	21	21	21	21	21.0000
262422	22	22	22	22	22	22	22	22	22	22.0000
262523	23	23	23	23	23	23	23	23	23	23.0000
262630	30	30	30	30	30	30	30	30	30	30.0000
262731	31	31	31	31	31	31	31	31	31	31.0000
262832	32	32	32	32	32	32	32	32	32	32.0000
262933	33	33	33	33	33	33	33	33	33	33.0000
263040	40	40	40	40	40	40	40	40	40	40.0000
263141	41	41	41	41	41	41	41	41	41	41.0000
263242	42	42	42	42	42	42	42	42	42	42.0000
263343	43	43	43	43	43	43	43	43	43	43.0000
263450	50	50	50	50	50	50	50	50	50	50.0000
263551	51	51	51	51	51	51	51	51	51	51.0000
263652	52	52	52	52	52	52	52	52	52	52.0000
263753	53	53	53	53	53	53	53	53	53	53.0000
263860	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
263961	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264062	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264163	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264271	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264373	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264481	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
264583	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
2646test_sequence
2647-- select .. where numeric column = .. --
2648set @arg00= 20;
2649select 'true' as found from t9
2650where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
2651and c8= 20 and c9= 20 and c10= 20 and c12= 20;
2652found
2653true
2654select 'true' as found from t9
2655where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
2656and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
2657and c12= @arg00;
2658found
2659true
2660prepare stmt1 from "select 'true' as found from t9
2661where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
2662  and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
2663execute stmt1 ;
2664found
2665true
2666prepare stmt1 from "select 'true' as found from t9
2667where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
2668  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
2669  and c12= ? ";
2670execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2671@arg00, @arg00, @arg00, @arg00 ;
2672found
2673true
2674set @arg00= 20.0;
2675select 'true' as found from t9
2676where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
2677and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
2678found
2679true
2680select 'true' as found from t9
2681where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
2682and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
2683and c12= @arg00;
2684found
2685true
2686prepare stmt1 from "select 'true' as found from t9
2687where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
2688  and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
2689execute stmt1 ;
2690found
2691true
2692prepare stmt1 from "select 'true' as found from t9
2693where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
2694  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
2695  and c12= ? ";
2696execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2697@arg00, @arg00, @arg00, @arg00 ;
2698found
2699true
2700select 'true' as found from t9
2701where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
2702  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
2703found
2704true
2705prepare stmt1 from "select 'true' as found from t9
2706where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
2707  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
2708execute stmt1 ;
2709found
2710true
2711set @arg00= '20';
2712select 'true' as found from t9
2713where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
2714and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
2715and c12= @arg00;
2716found
2717true
2718prepare stmt1 from "select 'true' as found from t9
2719where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
2720  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
2721  and c12= ? ";
2722execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2723@arg00, @arg00, @arg00, @arg00 ;
2724found
2725true
2726select 'true' as found from t9
2727where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
2728c3= CAST('20' as binary) and c4= CAST('20' as binary) and
2729c5= CAST('20' as binary) and c6= CAST('20' as binary) and
2730c7= CAST('20' as binary) and c8= CAST('20' as binary) and
2731c9= CAST('20' as binary) and c10= CAST('20' as binary) and
2732c12= CAST('20' as binary);
2733found
2734true
2735prepare stmt1 from "select 'true' as found from t9
2736where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
2737      c3= CAST('20' as binary) and c4= CAST('20' as binary) and
2738      c5= CAST('20' as binary) and c6= CAST('20' as binary) and
2739      c7= CAST('20' as binary) and c8= CAST('20' as binary) and
2740      c9= CAST('20' as binary) and c10= CAST('20' as binary) and
2741      c12= CAST('20' as binary) ";
2742execute stmt1 ;
2743found
2744true
2745set @arg00= CAST('20' as binary) ;
2746select 'true' as found from t9
2747where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
2748and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
2749and c12= @arg00;
2750found
2751true
2752prepare stmt1 from "select 'true' as found from t9
2753where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
2754  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
2755  and c12= ? ";
2756execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2757@arg00, @arg00, @arg00, @arg00 ;
2758found
2759true
2760delete from t9 ;
2761test_sequence
2762-- some numeric overflow experiments --
2763prepare my_insert from "insert into t9
2764   ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
2765values
2766   ( 'O',  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
2767prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
2768from t9 where c21 = 'O' ";
2769prepare my_delete from "delete from t9 where c21 = 'O' ";
2770set @arg00= 9223372036854775807 ;
2771execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2772@arg00, @arg00, @arg00, @arg00, @arg00 ;
2773Warnings:
2774Warning	1264	Out of range value for column 'c1' at row 1
2775Warning	1264	Out of range value for column 'c2' at row 1
2776Warning	1264	Out of range value for column 'c3' at row 1
2777Warning	1264	Out of range value for column 'c4' at row 1
2778Warning	1264	Out of range value for column 'c5' at row 1
2779Warning	1264	Out of range value for column 'c12' at row 1
2780execute my_select ;
2781c1	127
2782c2	32767
2783c3	8388607
2784c4	2147483647
2785c5	2147483647
2786c6	9223372036854775807
2787c7	9.22337e18
2788c8	9.223372036854776e18
2789c9	9.223372036854776e18
2790c10	9.223372036854776e18
2791c12	9999.9999
2792execute my_delete ;
2793set @arg00= '9223372036854775807' ;
2794execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2795@arg00, @arg00, @arg00, @arg00, @arg00 ;
2796Warnings:
2797Warning	1264	Out of range value for column 'c1' at row 1
2798Warning	1264	Out of range value for column 'c2' at row 1
2799Warning	1264	Out of range value for column 'c3' at row 1
2800Warning	1264	Out of range value for column 'c4' at row 1
2801Warning	1264	Out of range value for column 'c5' at row 1
2802Warning	1264	Out of range value for column 'c12' at row 1
2803execute my_select ;
2804c1	127
2805c2	32767
2806c3	8388607
2807c4	2147483647
2808c5	2147483647
2809c6	9223372036854775807
2810c7	9.22337e18
2811c8	9.223372036854776e18
2812c9	9.223372036854776e18
2813c10	9.223372036854776e18
2814c12	9999.9999
2815execute my_delete ;
2816set @arg00= -9223372036854775808 ;
2817execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2818@arg00, @arg00, @arg00, @arg00, @arg00 ;
2819Warnings:
2820Warning	1264	Out of range value for column 'c1' at row 1
2821Warning	1264	Out of range value for column 'c2' at row 1
2822Warning	1264	Out of range value for column 'c3' at row 1
2823Warning	1264	Out of range value for column 'c4' at row 1
2824Warning	1264	Out of range value for column 'c5' at row 1
2825Warning	1264	Out of range value for column 'c12' at row 1
2826execute my_select ;
2827c1	-128
2828c2	-32768
2829c3	-8388608
2830c4	-2147483648
2831c5	-2147483648
2832c6	-9223372036854775808
2833c7	-9.22337e18
2834c8	-9.223372036854776e18
2835c9	-9.223372036854776e18
2836c10	-9.223372036854776e18
2837c12	-9999.9999
2838execute my_delete ;
2839set @arg00= '-9223372036854775808' ;
2840execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2841@arg00, @arg00, @arg00, @arg00, @arg00 ;
2842Warnings:
2843Warning	1264	Out of range value for column 'c1' at row 1
2844Warning	1264	Out of range value for column 'c2' at row 1
2845Warning	1264	Out of range value for column 'c3' at row 1
2846Warning	1264	Out of range value for column 'c4' at row 1
2847Warning	1264	Out of range value for column 'c5' at row 1
2848Warning	1264	Out of range value for column 'c12' at row 1
2849execute my_select ;
2850c1	-128
2851c2	-32768
2852c3	-8388608
2853c4	-2147483648
2854c5	-2147483648
2855c6	-9223372036854775808
2856c7	-9.22337e18
2857c8	-9.223372036854776e18
2858c9	-9.223372036854776e18
2859c10	-9.223372036854776e18
2860c12	-9999.9999
2861execute my_delete ;
2862set @arg00= 1.11111111111111111111e+50 ;
2863execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2864@arg00, @arg00, @arg00, @arg00, @arg00 ;
2865Warnings:
2866Warning	1264	Out of range value for column 'c1' at row 1
2867Warning	1264	Out of range value for column 'c2' at row 1
2868Warning	1264	Out of range value for column 'c3' at row 1
2869Warning	1264	Out of range value for column 'c4' at row 1
2870Warning	1264	Out of range value for column 'c5' at row 1
2871Warning	1264	Out of range value for column 'c6' at row 1
2872Warning	1264	Out of range value for column 'c7' at row 1
2873Warning	1264	Out of range value for column 'c12' at row 1
2874execute my_select ;
2875c1	127
2876c2	32767
2877c3	8388607
2878c4	2147483647
2879c5	2147483647
2880c6	9223372036854775807
2881c7	3.40282e38
2882c8	1.111111111111111e50
2883c9	1.111111111111111e50
2884c10	1.111111111111111e50
2885c12	9999.9999
2886execute my_delete ;
2887set @arg00= '1.11111111111111111111e+50' ;
2888execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2889@arg00, @arg00, @arg00, @arg00, @arg00 ;
2890Warnings:
2891Warning	1264	Out of range value for column 'c1' at row 1
2892Warning	1264	Out of range value for column 'c2' at row 1
2893Warning	1264	Out of range value for column 'c3' at row 1
2894Warning	1264	Out of range value for column 'c4' at row 1
2895Warning	1264	Out of range value for column 'c5' at row 1
2896Warning	1264	Out of range value for column 'c6' at row 1
2897Warning	1264	Out of range value for column 'c7' at row 1
2898Warning	1264	Out of range value for column 'c12' at row 1
2899execute my_select ;
2900c1	127
2901c2	32767
2902c3	8388607
2903c4	2147483647
2904c5	2147483647
2905c6	9223372036854775807
2906c7	3.40282e38
2907c8	1.111111111111111e50
2908c9	1.111111111111111e50
2909c10	1.111111111111111e50
2910c12	9999.9999
2911execute my_delete ;
2912set @arg00= -1.11111111111111111111e+50 ;
2913execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2914@arg00, @arg00, @arg00, @arg00, @arg00 ;
2915Warnings:
2916Warning	1264	Out of range value for column 'c1' at row 1
2917Warning	1264	Out of range value for column 'c2' at row 1
2918Warning	1264	Out of range value for column 'c3' at row 1
2919Warning	1264	Out of range value for column 'c4' at row 1
2920Warning	1264	Out of range value for column 'c5' at row 1
2921Warning	1264	Out of range value for column 'c6' at row 1
2922Warning	1264	Out of range value for column 'c7' at row 1
2923Warning	1264	Out of range value for column 'c12' at row 1
2924execute my_select ;
2925c1	-128
2926c2	-32768
2927c3	-8388608
2928c4	-2147483648
2929c5	-2147483648
2930c6	-9223372036854775808
2931c7	-3.40282e38
2932c8	-1.111111111111111e50
2933c9	-1.111111111111111e50
2934c10	-1.111111111111111e50
2935c12	-9999.9999
2936execute my_delete ;
2937set @arg00= '-1.11111111111111111111e+50' ;
2938execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
2939@arg00, @arg00, @arg00, @arg00, @arg00 ;
2940Warnings:
2941Warning	1264	Out of range value for column 'c1' at row 1
2942Warning	1264	Out of range value for column 'c2' at row 1
2943Warning	1264	Out of range value for column 'c3' at row 1
2944Warning	1264	Out of range value for column 'c4' at row 1
2945Warning	1264	Out of range value for column 'c5' at row 1
2946Warning	1264	Out of range value for column 'c6' at row 1
2947Warning	1264	Out of range value for column 'c7' at row 1
2948Warning	1264	Out of range value for column 'c12' at row 1
2949execute my_select ;
2950c1	-128
2951c2	-32768
2952c3	-8388608
2953c4	-2147483648
2954c5	-2147483648
2955c6	-9223372036854775808
2956c7	-3.40282e38
2957c8	-1.111111111111111e50
2958c9	-1.111111111111111e50
2959c10	-1.111111111111111e50
2960c12	-9999.9999
2961execute my_delete ;
2962test_sequence
2963-- insert into string columns --
2964Warnings:
2965Warning	1265	Data truncated for column 'c20' at row 1
2966Warnings:
2967Warning	1265	Data truncated for column 'c20' at row 1
2968Warnings:
2969Warning	1265	Data truncated for column 'c20' at row 1
2970Warnings:
2971Warning	1265	Data truncated for column 'c20' at row 1
2972Warnings:
2973Warning	1265	Data truncated for column 'c20' at row 1
2974Warnings:
2975Warning	1265	Data truncated for column 'c20' at row 1
2976Warnings:
2977Warning	1265	Data truncated for column 'c20' at row 1
2978Warnings:
2979Warning	1265	Data truncated for column 'c20' at row 1
2980Warnings:
2981Warning	1265	Data truncated for column 'c20' at row 1
2982Warnings:
2983Warning	1265	Data truncated for column 'c20' at row 1
2984Warnings:
2985Warning	1265	Data truncated for column 'c20' at row 1
2986Warnings:
2987Warning	1265	Data truncated for column 'c20' at row 1
2988Warnings:
2989Warning	1265	Data truncated for column 'c20' at row 1
2990Warnings:
2991Warning	1265	Data truncated for column 'c20' at row 1
2992Warnings:
2993Warning	1265	Data truncated for column 'c20' at row 1
2994Warnings:
2995Warning	1265	Data truncated for column 'c20' at row 1
2996Warnings:
2997Warning	1265	Data truncated for column 'c20' at row 1
2998Warnings:
2999Warning	1265	Data truncated for column 'c20' at row 1
3000Warnings:
3001Warning	1265	Data truncated for column 'c20' at row 1
3002Warnings:
3003Warning	1265	Data truncated for column 'c20' at row 1
3004select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
3005from t9 where c1 >= 20
3006order by c1 ;
3007c1	c20	c21	c22	c23	c24	c25	c26	c27	c28	c29	c30
300820	2	20	20	20	20	20	20	20	20	20	20
300921	2	21	21	21	21	21	21	21	21	21	21
301022	2	22	22	22	22	22	22	22	22	22	22
301123	2	23	23	23	23	23	23	23	23	23	23
301230	3	30	30	30	30	30	30	30	30	30	30
301331	3	31	31	31	31	31	31	31	31	31	31
301432	3	32	32	32	32	32	32	32	32	32	32
301533	3	33	33	33	33	33	33	33	33	33	33
301640	4	40	40	40	40	40	40	40	40	40	40
301741	4	41	41	41	41	41	41	41	41	41	41
301842	4	42	42	42	42	42	42	42	42	42	42
301943	4	43	43	43	43	43	43	43	43	43	43
302050	5	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0
302151	5	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0
302252	5	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0
302353	5	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0
302454	5	54	54	54	54	54	54	54	54	54	54
302555	6	55	55	55	55	55	55	55	55	55	55
302656	6	56	56	56	56	56	56	56	56	56	56
302757	6	57	57	57	57	57	57	57	57	57	57
302860	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
302961	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303062	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303163	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303271	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303373	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303481	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
303583	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
3036test_sequence
3037-- select .. where string column = .. --
3038set @arg00= '20';
3039select 'true' as found from t9
3040where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
3041c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
3042c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
3043found
3044true
3045select 'true' as found from t9
3046where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
3047c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
3048c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
3049found
3050true
3051prepare stmt1 from "select 'true' as found from t9
3052where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
3053  c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
3054  c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
3055execute stmt1 ;
3056found
3057true
3058prepare stmt1 from "select 'true' as found from t9
3059where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
3060  c21= ? and c22= ? and c23= ? and c25= ? and
3061  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
3062execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
3063@arg00, @arg00, @arg00, @arg00, @arg00 ;
3064found
3065true
3066set @arg00= CAST('20' as binary);
3067select 'true' as found from t9
3068where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
3069= CAST('20' as binary) and c21= CAST('20' as binary)
3070and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
3071c24= CAST('20' as binary) and c25= CAST('20' as binary) and
3072c26= CAST('20' as binary) and c27= CAST('20' as binary) and
3073c28= CAST('20' as binary) and c29= CAST('20' as binary) and
3074c30= CAST('20' as binary) ;
3075found
3076true
3077select 'true' as found from t9
3078where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
3079c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
3080c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
3081c30= @arg00;
3082found
3083true
3084prepare stmt1 from "select 'true' as found from t9
3085where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
3086                 = CAST('20' as binary) and c21= CAST('20' as binary)
3087  and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
3088  c24= CAST('20' as binary) and c25= CAST('20' as binary) and
3089  c26= CAST('20' as binary) and c27= CAST('20' as binary) and
3090  c28= CAST('20' as binary) and c29= CAST('20' as binary) and
3091  c30= CAST('20' as binary)" ;
3092execute stmt1 ;
3093found
3094true
3095prepare stmt1 from "select 'true' as found from t9
3096where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
3097  c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
3098  c29= ? and c30= ?";
3099execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
3100@arg00, @arg00, @arg00, @arg00, @arg00 ;
3101found
3102true
3103set @arg00= 20;
3104select 'true' as found from t9
3105where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
3106c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
3107c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
3108found
3109true
3110select 'true' as found from t9
3111where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
3112c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
3113c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
3114found
3115true
3116prepare stmt1 from "select 'true' as found from t9
3117where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
3118  c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
3119  c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
3120execute stmt1 ;
3121found
3122true
3123prepare stmt1 from "select 'true' as found from t9
3124where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
3125  c21= ? and c22= ? and c23= ? and c25= ? and
3126  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
3127execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
3128@arg00, @arg00, @arg00, @arg00, @arg00 ;
3129found
3130true
3131set @arg00= 20.0;
3132select 'true' as found from t9
3133where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
3134c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
3135c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
3136found
3137true
3138select 'true' as found from t9
3139where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
3140c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
3141c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
3142found
3143true
3144prepare stmt1 from "select 'true' as found from t9
3145where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
3146  c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
3147  c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
3148execute stmt1 ;
3149found
3150true
3151prepare stmt1 from "select 'true' as found from t9
3152where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
3153  c21= ? and c22= ? and c23= ? and c25= ? and
3154  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
3155execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
3156@arg00, @arg00, @arg00, @arg00, @arg00 ;
3157found
3158true
3159delete from t9 ;
3160test_sequence
3161-- insert into date/time columns --
3162Warnings:
3163Note	1265	Data truncated for column 'c13' at row 1
3164Note	1265	Data truncated for column 'c16' at row 1
3165Warning	1265	Data truncated for column 'c17' at row 1
3166Warnings:
3167Note	1265	Data truncated for column 'c13' at row 1
3168Note	1265	Data truncated for column 'c16' at row 1
3169Warning	1265	Data truncated for column 'c17' at row 1
3170Warnings:
3171Note	1265	Data truncated for column 'c13' at row 1
3172Note	1265	Data truncated for column 'c16' at row 1
3173Warning	1265	Data truncated for column 'c17' at row 1
3174Warnings:
3175Note	1265	Data truncated for column 'c13' at row 1
3176Note	1265	Data truncated for column 'c16' at row 1
3177Warning	1265	Data truncated for column 'c17' at row 1
3178Warnings:
3179Note	1265	Data truncated for column 'c13' at row 1
3180Warnings:
3181Note	1265	Data truncated for column 'c13' at row 1
3182Note	1265	Data truncated for column 'c16' at row 1
3183Warning	1265	Data truncated for column 'c17' at row 1
3184Warnings:
3185Note	1265	Data truncated for column 'c13' at row 1
3186Warnings:
3187Note	1265	Data truncated for column 'c13' at row 1
3188Note	1265	Data truncated for column 'c16' at row 1
3189Warning	1265	Data truncated for column 'c17' at row 1
3190Warnings:
3191Warning	1265	Data truncated for column 'c13' at row 1
3192Warning	1265	Data truncated for column 'c14' at row 1
3193Warning	1265	Data truncated for column 'c15' at row 1
3194Warning	1264	Out of range value for column 'c16' at row 1
3195Warning	1264	Out of range value for column 'c17' at row 1
3196Warnings:
3197Warning	1265	Data truncated for column 'c13' at row 1
3198Warning	1265	Data truncated for column 'c14' at row 1
3199Warning	1265	Data truncated for column 'c15' at row 1
3200Warning	1264	Out of range value for column 'c16' at row 1
3201Warning	1264	Out of range value for column 'c17' at row 1
3202Warnings:
3203Warning	1265	Data truncated for column 'c13' at row 1
3204Warning	1265	Data truncated for column 'c14' at row 1
3205Warning	1265	Data truncated for column 'c15' at row 1
3206Warning	1264	Out of range value for column 'c16' at row 1
3207Warning	1264	Out of range value for column 'c17' at row 1
3208Warnings:
3209Warning	1265	Data truncated for column 'c13' at row 1
3210Warning	1265	Data truncated for column 'c14' at row 1
3211Warning	1265	Data truncated for column 'c15' at row 1
3212Warning	1264	Out of range value for column 'c16' at row 1
3213Warning	1264	Out of range value for column 'c17' at row 1
3214Warnings:
3215Warning	1265	Data truncated for column 'c15' at row 1
3216Warning	1264	Out of range value for column 'c16' at row 1
3217Warning	1264	Out of range value for column 'c17' at row 1
3218Warnings:
3219Warning	1265	Data truncated for column 'c15' at row 1
3220Warning	1264	Out of range value for column 'c16' at row 1
3221Warning	1264	Out of range value for column 'c17' at row 1
3222Warnings:
3223Warning	1265	Data truncated for column 'c15' at row 1
3224Warning	1264	Out of range value for column 'c16' at row 1
3225Warning	1264	Out of range value for column 'c17' at row 1
3226Warnings:
3227Warning	1265	Data truncated for column 'c15' at row 1
3228Warning	1264	Out of range value for column 'c16' at row 1
3229Warning	1264	Out of range value for column 'c17' at row 1
3230select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
3231c1	c13	c14	c15	c16	c17
323220	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323321	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323422	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323523	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323630	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323731	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323832	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
323933	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
324040	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324141	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324242	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324343	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324450	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324551	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324652	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324753	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
324860	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
324961	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325062	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325163	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325271	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325373	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325481	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
325583	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
3256test_sequence
3257-- select .. where date/time column = .. --
3258set @arg00= '1991-01-01 01:01:01' ;
3259select 'true' as found from t9
3260where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
3261c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
3262c17= '1991-01-01 01:01:01' ;
3263found
3264true
3265select 'true' as found from t9
3266where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
3267and c17= @arg00 ;
3268found
3269true
3270prepare stmt1 from "select 'true' as found from t9
3271where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
3272  c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
3273  c17= '1991-01-01 01:01:01'" ;
3274execute stmt1 ;
3275found
3276true
3277prepare stmt1 from "select 'true' as found from t9
3278where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
3279execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
3280found
3281true
3282set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
3283select 'true' as found from t9
3284where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
3285c14= CAST('1991-01-01 01:01:01' as datetime) and
3286c15= CAST('1991-01-01 01:01:01' as datetime) and
3287c16= CAST('1991-01-01 01:01:01' as datetime) and
3288c17= CAST('1991-01-01 01:01:01' as datetime) ;
3289found
3290true
3291select 'true' as found from t9
3292where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
3293and c17= @arg00 ;
3294found
3295true
3296prepare stmt1 from "select 'true' as found from t9
3297where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
3298  c14= CAST('1991-01-01 01:01:01' as datetime) and
3299  c15= CAST('1991-01-01 01:01:01' as datetime) and
3300  c16= CAST('1991-01-01 01:01:01' as datetime) and
3301  c17= CAST('1991-01-01 01:01:01' as datetime)" ;
3302execute stmt1 ;
3303found
3304true
3305prepare stmt1 from "select 'true' as found from t9
3306where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
3307execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
3308found
3309true
3310set @arg00= 1991 ;
3311select 'true' as found from t9
3312where c1= 20 and c17= 1991 ;
3313found
3314true
3315select 'true' as found from t9
3316where c1= 20 and c17= @arg00 ;
3317found
3318true
3319prepare stmt1 from "select 'true' as found from t9
3320where c1= 20 and c17= 1991" ;
3321execute stmt1 ;
3322found
3323true
3324prepare stmt1 from "select 'true' as found from t9
3325where c1= 20 and c17= ?" ;
3326execute stmt1 using @arg00 ;
3327found
3328true
3329set @arg00= 1.991e+3 ;
3330select 'true' as found from t9
3331where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
3332found
3333true
3334select 'true' as found from t9
3335where c1= 20 and abs(c17 - @arg00) < 0.01 ;
3336found
3337true
3338prepare stmt1 from "select 'true' as found from t9
3339where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
3340execute stmt1 ;
3341found
3342true
3343prepare stmt1 from "select 'true' as found from t9
3344where c1= 20 and abs(c17 - ?) < 0.01" ;
3345execute stmt1 using @arg00 ;
3346found
3347true
3348SET sql_mode = default;
3349DROP TABLE t1, t9 ;
3350CREATE TABLE t1
3351(
3352a int, b varchar(30),
3353primary key(a)
3354) ENGINE = MERGE UNION=(t1_1,t1_2)
3355INSERT_METHOD=LAST;
3356CREATE TABLE t9
3357(
3358c1  TINYINT, c2  SMALLINT, c3  MEDIUMINT, c4  INT,
3359c5  INTEGER, c6  BIGINT, c7  FLOAT, c8  DOUBLE,
3360c9  DOUBLE PRECISION, c10 REAL, c11 DECIMAL(7, 4), c12 NUMERIC(8, 4),
3361c13 DATE, c14 DATETIME, c15 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 TIME,
3362c17 YEAR, c18 TINYINT, c19 BOOL, c20 CHAR,
3363c21 CHAR(10), c22 VARCHAR(30), c23 TINYBLOB, c24 TINYTEXT,
3364c25 BLOB, c26 TEXT, c27 MEDIUMBLOB, c28 MEDIUMTEXT,
3365c29 LONGBLOB, c30 LONGTEXT, c31 ENUM('one', 'two', 'three'),
3366c32 SET('monday', 'tuesday', 'wednesday'),
3367PRIMARY KEY(c1)
3368)  ENGINE = MERGE UNION=(t9_1,t9_2)
3369INSERT_METHOD=LAST;
3370delete from t1 ;
3371insert into t1 values (1,'one');
3372insert into t1 values (2,'two');
3373insert into t1 values (3,'three');
3374insert into t1 values (4,'four');
3375commit ;
3376delete from t9 ;
3377insert into t9
3378set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
3379c10= 1, c11= 1, c12 = 1,
3380c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3381c16= '11:11:11', c17= '2004',
3382c18= 1, c19=true, c20= 'a', c21= '123456789a',
3383c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3384c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3385c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
3386insert into t9
3387set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
3388c10= 9, c11= 9, c12 = 9,
3389c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3390c16= '11:11:11', c17= '2004',
3391c18= 1, c19=false, c20= 'a', c21= '123456789a',
3392c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3393c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3394c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
3395commit ;
3396test_sequence
3397------ explain select tests ------
3398prepare stmt1 from ' explain select * from t9 ' ;
3399execute stmt1;
3400Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
3401def					id	8	3	1	N	32929	0	63
3402def					select_type	253	19	6	N	1	31	8
3403def					table	253	64	2	Y	0	31	8
3404def					partitions	250	6316032	0	Y	0	31	8
3405def					type	253	10	3	Y	0	31	8
3406def					possible_keys	253	4096	0	Y	0	31	8
3407def					key	253	64	0	Y	0	31	8
3408def					key_len	253	4096	0	Y	0	31	8
3409def					ref	253	1024	0	Y	0	31	8
3410def					rows	8	10	1	Y	32928	0	63
3411def					filtered	5	4	6	Y	32896	2	63
3412def					Extra	253	255	0	N	1	31	8
3413id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
34141	SIMPLE	t9	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
3415Warnings:
3416Note	1003	/* select#1 */ select `test`.`t9`.`c1` AS `c1`,`test`.`t9`.`c2` AS `c2`,`test`.`t9`.`c3` AS `c3`,`test`.`t9`.`c4` AS `c4`,`test`.`t9`.`c5` AS `c5`,`test`.`t9`.`c6` AS `c6`,`test`.`t9`.`c7` AS `c7`,`test`.`t9`.`c8` AS `c8`,`test`.`t9`.`c9` AS `c9`,`test`.`t9`.`c10` AS `c10`,`test`.`t9`.`c11` AS `c11`,`test`.`t9`.`c12` AS `c12`,`test`.`t9`.`c13` AS `c13`,`test`.`t9`.`c14` AS `c14`,`test`.`t9`.`c15` AS `c15`,`test`.`t9`.`c16` AS `c16`,`test`.`t9`.`c17` AS `c17`,`test`.`t9`.`c18` AS `c18`,`test`.`t9`.`c19` AS `c19`,`test`.`t9`.`c20` AS `c20`,`test`.`t9`.`c21` AS `c21`,`test`.`t9`.`c22` AS `c22`,`test`.`t9`.`c23` AS `c23`,`test`.`t9`.`c24` AS `c24`,`test`.`t9`.`c25` AS `c25`,`test`.`t9`.`c26` AS `c26`,`test`.`t9`.`c27` AS `c27`,`test`.`t9`.`c28` AS `c28`,`test`.`t9`.`c29` AS `c29`,`test`.`t9`.`c30` AS `c30`,`test`.`t9`.`c31` AS `c31`,`test`.`t9`.`c32` AS `c32` from `test`.`t9`
3417test_sequence
3418------ delete tests ------
3419delete from t1 ;
3420insert into t1 values (1,'one');
3421insert into t1 values (2,'two');
3422insert into t1 values (3,'three');
3423insert into t1 values (4,'four');
3424commit ;
3425delete from t9 ;
3426insert into t9
3427set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
3428c10= 1, c11= 1, c12 = 1,
3429c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3430c16= '11:11:11', c17= '2004',
3431c18= 1, c19=true, c20= 'a', c21= '123456789a',
3432c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3433c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3434c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
3435insert into t9
3436set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
3437c10= 9, c11= 9, c12 = 9,
3438c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3439c16= '11:11:11', c17= '2004',
3440c18= 1, c19=false, c20= 'a', c21= '123456789a',
3441c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3442c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3443c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
3444commit ;
3445SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
3446Warnings:
3447Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
3448prepare stmt1 from 'delete from t1 where a=2' ;
3449execute stmt1;
3450select a,b from t1 where a=2;
3451a	b
3452execute stmt1;
3453insert into t1 values(0,NULL);
3454set @arg00=NULL;
3455prepare stmt1 from 'delete from t1 where b=?' ;
3456execute stmt1 using @arg00;
3457select a,b from t1 where b is NULL ;
3458a	b
34590	NULL
3460set @arg00='one';
3461execute stmt1 using @arg00;
3462select a,b from t1 where b=@arg00;
3463a	b
3464prepare stmt1 from 'truncate table t1' ;
3465test_sequence
3466------ update tests ------
3467delete from t1 ;
3468insert into t1 values (1,'one');
3469insert into t1 values (2,'two');
3470insert into t1 values (3,'three');
3471insert into t1 values (4,'four');
3472commit ;
3473delete from t9 ;
3474insert into t9
3475set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
3476c10= 1, c11= 1, c12 = 1,
3477c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3478c16= '11:11:11', c17= '2004',
3479c18= 1, c19=true, c20= 'a', c21= '123456789a',
3480c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3481c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3482c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
3483insert into t9
3484set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
3485c10= 9, c11= 9, c12 = 9,
3486c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3487c16= '11:11:11', c17= '2004',
3488c18= 1, c19=false, c20= 'a', c21= '123456789a',
3489c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3490c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3491c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
3492commit ;
3493prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
3494execute stmt1;
3495select a,b from t1 where a=2;
3496a	b
34972	a=two
3498execute stmt1;
3499select a,b from t1 where a=2;
3500a	b
35012	a=two
3502set @arg00=NULL;
3503prepare stmt1 from 'update t1 set b=? where a=2' ;
3504execute stmt1 using @arg00;
3505select a,b from t1 where a=2;
3506a	b
35072	NULL
3508set @arg00='two';
3509execute stmt1 using @arg00;
3510select a,b from t1 where a=2;
3511a	b
35122	two
3513set @arg00=2;
3514prepare stmt1 from 'update t1 set b=NULL where a=?' ;
3515execute stmt1 using @arg00;
3516select a,b from t1 where a=@arg00;
3517a	b
35182	NULL
3519update t1 set b='two' where a=@arg00;
3520set @arg00=2000;
3521execute stmt1 using @arg00;
3522select a,b from t1 where a=@arg00;
3523a	b
3524set @arg00=2;
3525set @arg01=22;
3526prepare stmt1 from 'update t1 set a=? where a=?' ;
3527execute stmt1 using @arg00, @arg00;
3528select a,b from t1 where a=@arg00;
3529a	b
35302	two
3531execute stmt1 using @arg01, @arg00;
3532select a,b from t1 where a=@arg01;
3533a	b
353422	two
3535execute stmt1 using @arg00, @arg01;
3536select a,b from t1 where a=@arg00;
3537a	b
35382	two
3539set @arg00=NULL;
3540set @arg01=2;
3541execute stmt1 using @arg00, @arg01;
3542Warnings:
3543Warning	1048	Column 'a' cannot be null
3544select a,b from t1 order by a;
3545a	b
35460	two
35471	one
35483	three
35494	four
3550set @arg00=0;
3551execute stmt1 using @arg01, @arg00;
3552select a,b from t1 order by a;
3553a	b
35541	one
35552	two
35563	three
35574	four
3558set @arg00=23;
3559set @arg01='two';
3560set @arg02=2;
3561set @arg03='two';
3562set @arg04=2;
3563drop table if exists t2;
3564create table t2 as select a,b from t1 ;
3565prepare stmt1 from 'update t1 set a=? where b=?
3566                    and a in (select ? from t2
3567                              where b = ? or a = ?)';
3568execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
3569affected rows: 1
3570info: Rows matched: 1  Changed: 1  Warnings: 0
3571select a,b from t1 where a = @arg00 ;
3572a	b
357323	two
3574prepare stmt1 from 'update t1 set a=? where b=?
3575                    and a not in (select ? from t2
3576                              where b = ? or a = ?)';
3577execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
3578affected rows: 1
3579info: Rows matched: 1  Changed: 1  Warnings: 0
3580select a,b from t1 order by a ;
3581a	b
35821	one
35832	two
35843	three
35854	four
3586drop table t2 ;
3587create table t2
3588(
3589a int, b varchar(30),
3590primary key(a)
3591) engine = 'MYISAM'  ;
3592insert into t2(a,b) select a, b from t1 ;
3593prepare stmt1 from 'update t1 set a=? where b=?
3594                    and a in (select ? from t2
3595                              where b = ? or a = ?)';
3596execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
3597affected rows: 1
3598info: Rows matched: 1  Changed: 1  Warnings: 0
3599select a,b from t1 where a = @arg00 ;
3600a	b
360123	two
3602prepare stmt1 from 'update t1 set a=? where b=?
3603                    and a not in (select ? from t2
3604                              where b = ? or a = ?)';
3605execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
3606affected rows: 1
3607info: Rows matched: 1  Changed: 1  Warnings: 0
3608select a,b from t1 order by a ;
3609a	b
36101	one
36112	two
36123	three
36134	four
3614drop table t2 ;
3615set @arg00=1;
3616prepare stmt1 from 'update t1 set b=''bla''
3617where a=2
3618limit 1';
3619execute stmt1 ;
3620select a,b from t1 where b = 'bla' ;
3621a	b
36222	bla
3623prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
3624execute stmt1 using @arg00;
3625test_sequence
3626------ insert tests ------
3627delete from t1 ;
3628insert into t1 values (1,'one');
3629insert into t1 values (2,'two');
3630insert into t1 values (3,'three');
3631insert into t1 values (4,'four');
3632commit ;
3633delete from t9 ;
3634insert into t9
3635set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
3636c10= 1, c11= 1, c12 = 1,
3637c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3638c16= '11:11:11', c17= '2004',
3639c18= 1, c19=true, c20= 'a', c21= '123456789a',
3640c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3641c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3642c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
3643insert into t9
3644set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
3645c10= 9, c11= 9, c12 = 9,
3646c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
3647c16= '11:11:11', c17= '2004',
3648c18= 1, c19=false, c20= 'a', c21= '123456789a',
3649c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
3650c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
3651c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
3652commit ;
3653prepare stmt1 from 'insert into t1 values(5, ''five'' )';
3654execute stmt1;
3655select a,b from t1 where a = 5;
3656a	b
36575	five
3658set @arg00='six' ;
3659prepare stmt1 from 'insert into t1 values(6, ? )';
3660execute stmt1 using @arg00;
3661select a,b from t1 where b = @arg00;
3662a	b
36636	six
3664execute stmt1 using @arg00;
3665ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
3666set @arg00=NULL ;
3667prepare stmt1 from 'insert into t1 values(0, ? )';
3668execute stmt1 using @arg00;
3669select a,b from t1 where b is NULL;
3670a	b
36710	NULL
3672set @arg00=8 ;
3673set @arg01='eight' ;
3674prepare stmt1 from 'insert into t1 values(?, ? )';
3675execute stmt1 using @arg00, @arg01 ;
3676select a,b from t1 where b = @arg01;
3677a	b
36788	eight
3679set @NULL= null ;
3680set @arg00= 'abc' ;
3681execute stmt1 using @NULL, @NULL ;
3682ERROR 23000: Column 'a' cannot be null
3683execute stmt1 using @NULL, @NULL ;
3684ERROR 23000: Column 'a' cannot be null
3685execute stmt1 using @NULL, @arg00 ;
3686ERROR 23000: Column 'a' cannot be null
3687execute stmt1 using @NULL, @arg00 ;
3688ERROR 23000: Column 'a' cannot be null
3689set @arg01= 10000 + 2 ;
3690execute stmt1 using @arg01, @arg00 ;
3691set @arg01= 10000 + 1 ;
3692execute stmt1 using @arg01, @arg00 ;
3693select * from t1 where a > 10000 order by a ;
3694a	b
369510001	abc
369610002	abc
3697delete from t1 where a > 10000 ;
3698set @arg01= 10000 + 2 ;
3699execute stmt1 using @arg01, @NULL ;
3700set @arg01= 10000 + 1 ;
3701execute stmt1 using @arg01, @NULL ;
3702select * from t1 where a > 10000 order by a ;
3703a	b
370410001	NULL
370510002	NULL
3706delete from t1 where a > 10000 ;
3707set @arg01= 10000 + 10 ;
3708execute stmt1 using @arg01, @arg01 ;
3709set @arg01= 10000 + 9 ;
3710execute stmt1 using @arg01, @arg01 ;
3711set @arg01= 10000 + 8 ;
3712execute stmt1 using @arg01, @arg01 ;
3713set @arg01= 10000 + 7 ;
3714execute stmt1 using @arg01, @arg01 ;
3715set @arg01= 10000 + 6 ;
3716execute stmt1 using @arg01, @arg01 ;
3717set @arg01= 10000 + 5 ;
3718execute stmt1 using @arg01, @arg01 ;
3719set @arg01= 10000 + 4 ;
3720execute stmt1 using @arg01, @arg01 ;
3721set @arg01= 10000 + 3 ;
3722execute stmt1 using @arg01, @arg01 ;
3723set @arg01= 10000 + 2 ;
3724execute stmt1 using @arg01, @arg01 ;
3725set @arg01= 10000 + 1 ;
3726execute stmt1 using @arg01, @arg01 ;
3727select * from t1 where a > 10000 order by a ;
3728a	b
372910001	10001
373010002	10002
373110003	10003
373210004	10004
373310005	10005
373410006	10006
373510007	10007
373610008	10008
373710009	10009
373810010	10010
3739delete from t1 where a > 10000 ;
3740set @arg00=81 ;
3741set @arg01='8-1' ;
3742set @arg02=82 ;
3743set @arg03='8-2' ;
3744prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
3745execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
3746select a,b from t1 where a in (@arg00,@arg02) ;
3747a	b
374881	8-1
374982	8-2
3750set @arg00=9 ;
3751set @arg01='nine' ;
3752prepare stmt1 from 'insert into t1 set a=?, b=? ';
3753execute stmt1 using @arg00, @arg01 ;
3754select a,b from t1 where a = @arg00 ;
3755a	b
37569	nine
3757set @arg00=6 ;
3758set @arg01=1 ;
3759prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
3760                    on duplicate key update a=a + ?, b=concat(b,''modified'') ';
3761execute stmt1 using @arg00, @arg01;
3762select * from t1 order by a;
3763a	b
37640	NULL
37651	one
37662	two
37673	three
37684	four
37695	five
37707	sixmodified
37718	eight
37729	nine
377381	8-1
377482	8-2
3775set @arg00=81 ;
3776set @arg01=1 ;
3777execute stmt1 using @arg00, @arg01;
3778ERROR 23000: Duplicate entry '82' for key 'PRIMARY'
3779drop table if exists t2 ;
3780create table t2 (id int auto_increment primary key)
3781ENGINE= 'MYISAM'  ;
3782prepare stmt1 from ' select last_insert_id() ' ;
3783insert into t2 values (NULL) ;
3784execute stmt1 ;
3785last_insert_id()
37861
3787insert into t2 values (NULL) ;
3788execute stmt1 ;
3789last_insert_id()
37902
3791drop table t2 ;
3792set @1000=1000 ;
3793set @x1000_2="x1000_2" ;
3794set @x1000_3="x1000_3" ;
3795set @x1000="x1000" ;
3796set @1100=1100 ;
3797set @x1100="x1100" ;
3798set @100=100 ;
3799set @updated="updated" ;
3800insert into t1 values(1000,'x1000_1') ;
3801insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
3802on duplicate key update a = a + @100, b = concat(b,@updated) ;
3803select a,b from t1 where a >= 1000 order by a ;
3804a	b
38051000	x1000_3
38061100	x1000_1updated
3807delete from t1 where a >= 1000 ;
3808insert into t1 values(1000,'x1000_1') ;
3809prepare stmt1 from ' insert into t1 values(?,?),(?,?)
3810               on duplicate key update a = a + ?, b = concat(b,?) ';
3811execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
3812select a,b from t1 where a >= 1000 order by a ;
3813a	b
38141000	x1000_3
38151100	x1000_1updated
3816delete from t1 where a >= 1000 ;
3817insert into t1 values(1000,'x1000_1') ;
3818execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
3819select a,b from t1 where a >= 1000 order by a ;
3820a	b
38211200	x1000_1updatedupdated
3822delete from t1 where a >= 1000 ;
3823prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
3824execute stmt1;
3825execute stmt1;
3826execute stmt1;
3827test_sequence
3828------ multi table tests ------
3829delete from t1 ;
3830delete from t9 ;
3831insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
3832insert into t9 (c1,c21)
3833values (1, 'one'), (2, 'two'), (3, 'three') ;
3834prepare stmt_delete from " delete t1, t9
3835  from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
3836prepare stmt_update from " update t1, t9
3837  set t1.b='updated', t9.c21='updated'
3838  where t1.a=t9.c1 and t1.a=? ";
3839prepare stmt_select1 from " select a, b from t1 order by a" ;
3840prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
3841set @arg00= 1 ;
3842execute stmt_update using @arg00 ;
3843execute stmt_delete ;
3844execute stmt_select1 ;
3845a	b
38462	two
38473	three
3848execute stmt_select2 ;
3849c1	c21
38502	two
38513	three
3852set @arg00= @arg00 + 1 ;
3853execute stmt_update using @arg00 ;
3854execute stmt_delete ;
3855execute stmt_select1 ;
3856a	b
38573	three
3858execute stmt_select2 ;
3859c1	c21
38603	three
3861set @arg00= @arg00 + 1 ;
3862execute stmt_update using @arg00 ;
3863execute stmt_delete ;
3864execute stmt_select1 ;
3865a	b
3866execute stmt_select2 ;
3867c1	c21
3868set @arg00= @arg00 + 1 ;
3869SET sql_mode = default;
3870SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
3871Warnings:
3872Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
3873drop table if exists t5 ;
3874set @arg01= 8;
3875set @arg02= 8.0;
3876set @arg03= 80.00000000000e-1;
3877set @arg04= 'abc' ;
3878set @arg05= CAST('abc' as binary) ;
3879set @arg06= '1991-08-05' ;
3880set @arg07= CAST('1991-08-05' as date);
3881set @arg08= '1991-08-05 01:01:01' ;
3882set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
3883set @arg10= unix_timestamp('1991-01-01 01:01:01');
3884set @arg11= YEAR('1991-01-01 01:01:01');
3885set @arg12= 8 ;
3886set @arg12= NULL ;
3887set @arg13= 8.0 ;
3888set @arg13= NULL ;
3889set @arg14= 'abc';
3890set @arg14= NULL ;
3891set @arg15= CAST('abc' as binary) ;
3892set @arg15= NULL ;
3893create table t5 as select
38948                           as const01, @arg01 as param01,
38958.0                         as const02, @arg02 as param02,
389680.00000000000e-1           as const03, @arg03 as param03,
3897'abc'                       as const04, @arg04 as param04,
3898CAST('abc' as binary)       as const05, @arg05 as param05,
3899'1991-08-05'                as const06, @arg06 as param06,
3900CAST('1991-08-05' as date)  as const07, @arg07 as param07,
3901'1991-08-05 01:01:01'       as const08, @arg08 as param08,
3902CAST('1991-08-05 01:01:01'  as datetime) as const09, @arg09 as param09,
3903unix_timestamp('1991-01-01 01:01:01')    as const10, @arg10 as param10,
3904YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
3905NULL                        as const12, @arg12 as param12,
3906@arg13 as param13,
3907@arg14 as param14,
3908@arg15 as param15;
3909show create table t5 ;
3910Table	Create Table
3911t5	CREATE TABLE `t5` (
3912  `const01` int(1) NOT NULL DEFAULT '0',
3913  `param01` bigint(20) DEFAULT NULL,
3914  `const02` decimal(2,1) NOT NULL DEFAULT '0.0',
3915  `param02` decimal(65,30) DEFAULT NULL,
3916  `const03` double NOT NULL DEFAULT '0',
3917  `param03` double DEFAULT NULL,
3918  `const04` varchar(3) NOT NULL DEFAULT '',
3919  `param04` longtext,
3920  `const05` varbinary(3) NOT NULL DEFAULT '',
3921  `param05` longblob,
3922  `const06` varchar(10) NOT NULL DEFAULT '',
3923  `param06` longtext,
3924  `const07` date DEFAULT NULL,
3925  `param07` longtext,
3926  `const08` varchar(19) NOT NULL DEFAULT '',
3927  `param08` longtext,
3928  `const09` datetime DEFAULT NULL,
3929  `param09` longtext,
3930  `const10` int(11) NOT NULL DEFAULT '0',
3931  `param10` bigint(20) DEFAULT NULL,
3932  `const11` int(4) DEFAULT NULL,
3933  `param11` bigint(20) DEFAULT NULL,
3934  `const12` binary(0) DEFAULT NULL,
3935  `param12` bigint(20) DEFAULT NULL,
3936  `param13` decimal(65,30) DEFAULT NULL,
3937  `param14` longtext,
3938  `param15` longblob
3939) ENGINE=ENGINE DEFAULT CHARSET=latin1
3940select * from t5 ;
3941Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
3942def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
3943def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
3944def	test	t5	t5	const02	const02	246	4	3	N	32769	1	63
3945def	test	t5	t5	param02	param02	246	67	32	Y	32768	30	63
3946def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
3947def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
3948def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
3949def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
3950def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
3951def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
3952def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
3953def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
3954def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
3955def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
3956def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
3957def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
3958def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
3959def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
3960def	test	t5	t5	const10	const10	3	11	9	N	32769	0	63
3961def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
3962def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
3963def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
3964def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
3965def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
3966def	test	t5	t5	param13	param13	246	67	0	Y	32768	30	63
3967def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
3968def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
3969const01	8
3970param01	8
3971const02	8.0
3972param02	8.000000000000000000000000000000
3973const03	8
3974param03	8
3975const04	abc
3976param04	abc
3977const05	abc
3978param05	abc
3979const06	1991-08-05
3980param06	1991-08-05
3981const07	1991-08-05
3982param07	1991-08-05
3983const08	1991-08-05 01:01:01
3984param08	1991-08-05 01:01:01
3985const09	1991-08-05 01:01:01
3986param09	1991-08-05 01:01:01
3987const10	662680861
3988param10	662680861
3989const11	1991
3990param11	1991
3991const12	NULL
3992param12	NULL
3993param13	NULL
3994param14	NULL
3995param15	NULL
3996drop table t5 ;
3997test_sequence
3998------ data type conversion tests ------
3999delete from t1 ;
4000insert into t1 values (1,'one');
4001insert into t1 values (2,'two');
4002insert into t1 values (3,'three');
4003insert into t1 values (4,'four');
4004commit ;
4005delete from t9 ;
4006insert into t9
4007set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
4008c10= 1, c11= 1, c12 = 1,
4009c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
4010c16= '11:11:11', c17= '2004',
4011c18= 1, c19=true, c20= 'a', c21= '123456789a',
4012c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
4013c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
4014c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
4015insert into t9
4016set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
4017c10= 9, c11= 9, c12 = 9,
4018c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
4019c16= '11:11:11', c17= '2004',
4020c18= 1, c19=false, c20= 'a', c21= '123456789a',
4021c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
4022c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
4023c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
4024commit ;
4025insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
4026select * from t9 order by c1 ;
4027c1	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
40280	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
40291	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
40309	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
4031test_sequence
4032------ select @parameter:= column ------
4033prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
4034       @arg05, @arg06, @arg07, @arg08,
4035       @arg09, @arg10, @arg11, @arg12,
4036       @arg13, @arg14, @arg15, @arg16,
4037       @arg17, @arg18, @arg19, @arg20,
4038       @arg21, @arg22, @arg23, @arg24,
4039       @arg25, @arg26, @arg27, @arg28,
4040       @arg29, @arg30, @arg31, @arg32" ;
4041select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
4042@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
4043@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
4044@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
4045@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
4046@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
4047@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
4048@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
4049from t9 where c1= 1 ;
4050@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
40511	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
4052execute full_info ;
4053Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4054def					@arg01	8	20	1	Y	32896	0	63
4055def					@arg02	8	20	1	Y	32896	0	63
4056def					@arg03	8	20	1	Y	32896	0	63
4057def					@arg04	8	20	1	Y	32896	0	63
4058def					@arg05	8	20	1	Y	32896	0	63
4059def					@arg06	8	20	1	Y	32896	0	63
4060def					@arg07	5	23	1	Y	32896	31	63
4061def					@arg08	5	23	1	Y	32896	31	63
4062def					@arg09	5	23	1	Y	32896	31	63
4063def					@arg10	5	23	1	Y	32896	31	63
4064def					@arg11	246	83	6	Y	32896	30	63
4065def					@arg12	246	83	6	Y	32896	30	63
4066def					@arg13	250	16777215	10	Y	0	31	8
4067def					@arg14	250	16777215	19	Y	0	31	8
4068def					@arg15	250	16777215	19	Y	0	31	8
4069def					@arg16	250	16777215	8	Y	0	31	8
4070def					@arg17	8	20	4	Y	32928	0	63
4071def					@arg18	8	20	1	Y	32896	0	63
4072def					@arg19	8	20	1	Y	32896	0	63
4073def					@arg20	250	16777215	1	Y	0	31	8
4074def					@arg21	250	16777215	10	Y	0	31	8
4075def					@arg22	250	16777215	30	Y	0	31	8
4076def					@arg23	250	16777215	8	Y	128	31	63
4077def					@arg24	250	16777215	8	Y	0	31	8
4078def					@arg25	250	16777215	4	Y	128	31	63
4079def					@arg26	250	16777215	4	Y	0	31	8
4080def					@arg27	250	16777215	10	Y	128	31	63
4081def					@arg28	250	16777215	10	Y	0	31	8
4082def					@arg29	250	16777215	8	Y	128	31	63
4083def					@arg30	250	16777215	8	Y	0	31	8
4084def					@arg31	250	16777215	3	Y	0	31	8
4085def					@arg32	250	16777215	6	Y	0	31	8
4086@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
40871	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
4088select @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
4089@arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
4090@arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
4091@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
4092@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
4093@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
4094@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
4095@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
4096from t9 where c1= 0 ;
4097@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
40980	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
4099execute full_info ;
4100Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4101def					@arg01	8	20	1	Y	32896	0	63
4102def					@arg02	8	20	0	Y	32896	0	63
4103def					@arg03	8	20	0	Y	32896	0	63
4104def					@arg04	8	20	0	Y	32896	0	63
4105def					@arg05	8	20	0	Y	32896	0	63
4106def					@arg06	8	20	0	Y	32896	0	63
4107def					@arg07	5	23	0	Y	32896	31	63
4108def					@arg08	5	23	0	Y	32896	31	63
4109def					@arg09	5	23	0	Y	32896	31	63
4110def					@arg10	5	23	0	Y	32896	31	63
4111def					@arg11	246	83	0	Y	32896	30	63
4112def					@arg12	246	83	0	Y	32896	30	63
4113def					@arg13	250	16777215	0	Y	0	31	8
4114def					@arg14	250	16777215	0	Y	0	31	8
4115def					@arg15	250	16777215	19	Y	0	31	8
4116def					@arg16	250	16777215	0	Y	0	31	8
4117def					@arg17	8	20	0	Y	32928	0	63
4118def					@arg18	8	20	0	Y	32896	0	63
4119def					@arg19	8	20	0	Y	32896	0	63
4120def					@arg20	250	16777215	0	Y	0	31	8
4121def					@arg21	250	16777215	0	Y	0	31	8
4122def					@arg22	250	16777215	0	Y	0	31	8
4123def					@arg23	250	16777215	0	Y	128	31	63
4124def					@arg24	250	16777215	0	Y	0	31	8
4125def					@arg25	250	16777215	0	Y	128	31	63
4126def					@arg26	250	16777215	0	Y	0	31	8
4127def					@arg27	250	16777215	0	Y	128	31	63
4128def					@arg28	250	16777215	0	Y	0	31	8
4129def					@arg29	250	16777215	0	Y	128	31	63
4130def					@arg30	250	16777215	0	Y	0	31	8
4131def					@arg31	250	16777215	0	Y	0	31	8
4132def					@arg32	250	16777215	0	Y	0	31	8
4133@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
41340	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
4135prepare stmt1 from "select
4136       @arg01:=  c1, @arg02:=  c2, @arg03:=  c3, @arg04:=  c4,
4137       @arg05:=  c5, @arg06:=  c6, @arg07:=  c7, @arg08:=  c8,
4138       @arg09:=  c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
4139       @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
4140       @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
4141       @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
4142       @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
4143       @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
4144from t9 where c1= ?" ;
4145set @my_key= 1 ;
4146execute stmt1 using @my_key ;
4147@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
41481	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
4149execute full_info ;
4150Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4151def					@arg01	8	20	1	Y	32896	0	63
4152def					@arg02	8	20	1	Y	32896	0	63
4153def					@arg03	8	20	1	Y	32896	0	63
4154def					@arg04	8	20	1	Y	32896	0	63
4155def					@arg05	8	20	1	Y	32896	0	63
4156def					@arg06	8	20	1	Y	32896	0	63
4157def					@arg07	5	23	1	Y	32896	31	63
4158def					@arg08	5	23	1	Y	32896	31	63
4159def					@arg09	5	23	1	Y	32896	31	63
4160def					@arg10	5	23	1	Y	32896	31	63
4161def					@arg11	246	83	6	Y	32896	30	63
4162def					@arg12	246	83	6	Y	32896	30	63
4163def					@arg13	250	16777215	10	Y	0	31	8
4164def					@arg14	250	16777215	19	Y	0	31	8
4165def					@arg15	250	16777215	19	Y	0	31	8
4166def					@arg16	250	16777215	8	Y	0	31	8
4167def					@arg17	8	20	4	Y	32928	0	63
4168def					@arg18	8	20	1	Y	32896	0	63
4169def					@arg19	8	20	1	Y	32896	0	63
4170def					@arg20	250	16777215	1	Y	0	31	8
4171def					@arg21	250	16777215	10	Y	0	31	8
4172def					@arg22	250	16777215	30	Y	0	31	8
4173def					@arg23	250	16777215	8	Y	128	31	63
4174def					@arg24	250	16777215	8	Y	0	31	8
4175def					@arg25	250	16777215	4	Y	128	31	63
4176def					@arg26	250	16777215	4	Y	0	31	8
4177def					@arg27	250	16777215	10	Y	128	31	63
4178def					@arg28	250	16777215	10	Y	0	31	8
4179def					@arg29	250	16777215	8	Y	128	31	63
4180def					@arg30	250	16777215	8	Y	0	31	8
4181def					@arg31	250	16777215	3	Y	0	31	8
4182def					@arg32	250	16777215	6	Y	0	31	8
4183@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
41841	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
4185set @my_key= 0 ;
4186execute stmt1 using @my_key ;
4187@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
41880	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
4189execute full_info ;
4190Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4191def					@arg01	8	20	1	Y	32896	0	63
4192def					@arg02	8	20	0	Y	32896	0	63
4193def					@arg03	8	20	0	Y	32896	0	63
4194def					@arg04	8	20	0	Y	32896	0	63
4195def					@arg05	8	20	0	Y	32896	0	63
4196def					@arg06	8	20	0	Y	32896	0	63
4197def					@arg07	5	23	0	Y	32896	31	63
4198def					@arg08	5	23	0	Y	32896	31	63
4199def					@arg09	5	23	0	Y	32896	31	63
4200def					@arg10	5	23	0	Y	32896	31	63
4201def					@arg11	246	83	0	Y	32896	30	63
4202def					@arg12	246	83	0	Y	32896	30	63
4203def					@arg13	250	16777215	0	Y	0	31	8
4204def					@arg14	250	16777215	0	Y	0	31	8
4205def					@arg15	250	16777215	19	Y	0	31	8
4206def					@arg16	250	16777215	0	Y	0	31	8
4207def					@arg17	8	20	0	Y	32928	0	63
4208def					@arg18	8	20	0	Y	32896	0	63
4209def					@arg19	8	20	0	Y	32896	0	63
4210def					@arg20	250	16777215	0	Y	0	31	8
4211def					@arg21	250	16777215	0	Y	0	31	8
4212def					@arg22	250	16777215	0	Y	0	31	8
4213def					@arg23	250	16777215	0	Y	128	31	63
4214def					@arg24	250	16777215	0	Y	0	31	8
4215def					@arg25	250	16777215	0	Y	128	31	63
4216def					@arg26	250	16777215	0	Y	0	31	8
4217def					@arg27	250	16777215	0	Y	128	31	63
4218def					@arg28	250	16777215	0	Y	0	31	8
4219def					@arg29	250	16777215	0	Y	128	31	63
4220def					@arg30	250	16777215	0	Y	0	31	8
4221def					@arg31	250	16777215	0	Y	0	31	8
4222def					@arg32	250	16777215	0	Y	0	31	8
4223@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
42240	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
4225prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
4226ERROR 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
4227test_sequence
4228------ select column, .. into @parm,.. ------
4229select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
4230c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
4231c25, c26, c27, c28, c29, c30, c31, c32
4232into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
4233@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
4234@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
4235@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
4236from t9 where c1= 1 ;
4237execute full_info ;
4238Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4239def					@arg01	8	20	1	Y	32896	0	63
4240def					@arg02	8	20	1	Y	32896	0	63
4241def					@arg03	8	20	1	Y	32896	0	63
4242def					@arg04	8	20	1	Y	32896	0	63
4243def					@arg05	8	20	1	Y	32896	0	63
4244def					@arg06	8	20	1	Y	32896	0	63
4245def					@arg07	5	23	1	Y	32896	31	63
4246def					@arg08	5	23	1	Y	32896	31	63
4247def					@arg09	5	23	1	Y	32896	31	63
4248def					@arg10	5	23	1	Y	32896	31	63
4249def					@arg11	246	83	6	Y	32896	30	63
4250def					@arg12	246	83	6	Y	32896	30	63
4251def					@arg13	250	16777215	10	Y	0	31	8
4252def					@arg14	250	16777215	19	Y	0	31	8
4253def					@arg15	250	16777215	19	Y	0	31	8
4254def					@arg16	250	16777215	8	Y	0	31	8
4255def					@arg17	8	20	4	Y	32928	0	63
4256def					@arg18	8	20	1	Y	32896	0	63
4257def					@arg19	8	20	1	Y	32896	0	63
4258def					@arg20	250	16777215	1	Y	0	31	8
4259def					@arg21	250	16777215	10	Y	0	31	8
4260def					@arg22	250	16777215	30	Y	0	31	8
4261def					@arg23	250	16777215	8	Y	128	31	63
4262def					@arg24	250	16777215	8	Y	0	31	8
4263def					@arg25	250	16777215	4	Y	128	31	63
4264def					@arg26	250	16777215	4	Y	0	31	8
4265def					@arg27	250	16777215	10	Y	128	31	63
4266def					@arg28	250	16777215	10	Y	0	31	8
4267def					@arg29	250	16777215	8	Y	128	31	63
4268def					@arg30	250	16777215	8	Y	0	31	8
4269def					@arg31	250	16777215	3	Y	0	31	8
4270def					@arg32	250	16777215	6	Y	0	31	8
4271@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
42721	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
4273select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
4274c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
4275c25, c26, c27, c28, c29, c30, c31, c32
4276into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
4277@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
4278@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
4279@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
4280from t9 where c1= 0 ;
4281execute full_info ;
4282Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4283def					@arg01	8	20	1	Y	32896	0	63
4284def					@arg02	8	20	0	Y	32896	0	63
4285def					@arg03	8	20	0	Y	32896	0	63
4286def					@arg04	8	20	0	Y	32896	0	63
4287def					@arg05	8	20	0	Y	32896	0	63
4288def					@arg06	8	20	0	Y	32896	0	63
4289def					@arg07	5	23	0	Y	32896	31	63
4290def					@arg08	5	23	0	Y	32896	31	63
4291def					@arg09	5	23	0	Y	32896	31	63
4292def					@arg10	5	23	0	Y	32896	31	63
4293def					@arg11	246	83	0	Y	32896	30	63
4294def					@arg12	246	83	0	Y	32896	30	63
4295def					@arg13	250	16777215	0	Y	0	31	8
4296def					@arg14	250	16777215	0	Y	0	31	8
4297def					@arg15	250	16777215	19	Y	0	31	8
4298def					@arg16	250	16777215	0	Y	0	31	8
4299def					@arg17	8	20	0	Y	32928	0	63
4300def					@arg18	8	20	0	Y	32896	0	63
4301def					@arg19	8	20	0	Y	32896	0	63
4302def					@arg20	250	16777215	0	Y	0	31	8
4303def					@arg21	250	16777215	0	Y	0	31	8
4304def					@arg22	250	16777215	0	Y	0	31	8
4305def					@arg23	250	16777215	0	Y	128	31	63
4306def					@arg24	250	16777215	0	Y	0	31	8
4307def					@arg25	250	16777215	0	Y	128	31	63
4308def					@arg26	250	16777215	0	Y	0	31	8
4309def					@arg27	250	16777215	0	Y	128	31	63
4310def					@arg28	250	16777215	0	Y	0	31	8
4311def					@arg29	250	16777215	0	Y	128	31	63
4312def					@arg30	250	16777215	0	Y	0	31	8
4313def					@arg31	250	16777215	0	Y	0	31	8
4314def					@arg32	250	16777215	0	Y	0	31	8
4315@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
43160	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
4317prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
4318       c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
4319       c25, c26, c27, c28, c29, c30, c31, c32
4320into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
4321     @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
4322     @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
4323     @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
4324from t9 where c1= ?" ;
4325set @my_key= 1 ;
4326execute stmt1 using @my_key ;
4327execute full_info ;
4328Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4329def					@arg01	8	20	1	Y	32896	0	63
4330def					@arg02	8	20	1	Y	32896	0	63
4331def					@arg03	8	20	1	Y	32896	0	63
4332def					@arg04	8	20	1	Y	32896	0	63
4333def					@arg05	8	20	1	Y	32896	0	63
4334def					@arg06	8	20	1	Y	32896	0	63
4335def					@arg07	5	23	1	Y	32896	31	63
4336def					@arg08	5	23	1	Y	32896	31	63
4337def					@arg09	5	23	1	Y	32896	31	63
4338def					@arg10	5	23	1	Y	32896	31	63
4339def					@arg11	246	83	6	Y	32896	30	63
4340def					@arg12	246	83	6	Y	32896	30	63
4341def					@arg13	250	16777215	10	Y	0	31	8
4342def					@arg14	250	16777215	19	Y	0	31	8
4343def					@arg15	250	16777215	19	Y	0	31	8
4344def					@arg16	250	16777215	8	Y	0	31	8
4345def					@arg17	8	20	4	Y	32928	0	63
4346def					@arg18	8	20	1	Y	32896	0	63
4347def					@arg19	8	20	1	Y	32896	0	63
4348def					@arg20	250	16777215	1	Y	0	31	8
4349def					@arg21	250	16777215	10	Y	0	31	8
4350def					@arg22	250	16777215	30	Y	0	31	8
4351def					@arg23	250	16777215	8	Y	128	31	63
4352def					@arg24	250	16777215	8	Y	0	31	8
4353def					@arg25	250	16777215	4	Y	128	31	63
4354def					@arg26	250	16777215	4	Y	0	31	8
4355def					@arg27	250	16777215	10	Y	128	31	63
4356def					@arg28	250	16777215	10	Y	0	31	8
4357def					@arg29	250	16777215	8	Y	128	31	63
4358def					@arg30	250	16777215	8	Y	0	31	8
4359def					@arg31	250	16777215	3	Y	0	31	8
4360def					@arg32	250	16777215	6	Y	0	31	8
4361@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
43621	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
4363set @my_key= 0 ;
4364execute stmt1 using @my_key ;
4365execute full_info ;
4366Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
4367def					@arg01	8	20	1	Y	32896	0	63
4368def					@arg02	8	20	0	Y	32896	0	63
4369def					@arg03	8	20	0	Y	32896	0	63
4370def					@arg04	8	20	0	Y	32896	0	63
4371def					@arg05	8	20	0	Y	32896	0	63
4372def					@arg06	8	20	0	Y	32896	0	63
4373def					@arg07	5	23	0	Y	32896	31	63
4374def					@arg08	5	23	0	Y	32896	31	63
4375def					@arg09	5	23	0	Y	32896	31	63
4376def					@arg10	5	23	0	Y	32896	31	63
4377def					@arg11	246	83	0	Y	32896	30	63
4378def					@arg12	246	83	0	Y	32896	30	63
4379def					@arg13	250	16777215	0	Y	0	31	8
4380def					@arg14	250	16777215	0	Y	0	31	8
4381def					@arg15	250	16777215	19	Y	0	31	8
4382def					@arg16	250	16777215	0	Y	0	31	8
4383def					@arg17	8	20	0	Y	32928	0	63
4384def					@arg18	8	20	0	Y	32896	0	63
4385def					@arg19	8	20	0	Y	32896	0	63
4386def					@arg20	250	16777215	0	Y	0	31	8
4387def					@arg21	250	16777215	0	Y	0	31	8
4388def					@arg22	250	16777215	0	Y	0	31	8
4389def					@arg23	250	16777215	0	Y	128	31	63
4390def					@arg24	250	16777215	0	Y	0	31	8
4391def					@arg25	250	16777215	0	Y	128	31	63
4392def					@arg26	250	16777215	0	Y	0	31	8
4393def					@arg27	250	16777215	0	Y	128	31	63
4394def					@arg28	250	16777215	0	Y	0	31	8
4395def					@arg29	250	16777215	0	Y	128	31	63
4396def					@arg30	250	16777215	0	Y	0	31	8
4397def					@arg31	250	16777215	0	Y	0	31	8
4398def					@arg32	250	16777215	0	Y	0	31	8
4399@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
44000	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
4401prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
4402ERROR 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
4403test_sequence
4404-- insert into numeric columns --
4405insert into t9
4406( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4407values
4408( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
4409set @arg00= 21 ;
4410insert into t9
4411( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4412values
4413( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4414@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4415prepare stmt1 from "insert into t9
4416  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4417values
4418  ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
4419execute stmt1 ;
4420set @arg00= 23;
4421prepare stmt2 from "insert into t9
4422  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4423values
4424  (  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4425execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4426@arg00, @arg00, @arg00, @arg00 ;
4427insert into t9
4428( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4429values
4430( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
443130.0, 30.0, 30.0 ) ;
4432set @arg00= 31.0 ;
4433insert into t9
4434( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4435values
4436( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4437@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4438prepare stmt1 from "insert into t9
4439  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4440values
4441  ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
4442    32.0, 32.0, 32.0 )" ;
4443execute stmt1 ;
4444set @arg00= 33.0;
4445prepare stmt2 from "insert into t9
4446  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4447values
4448  (  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
4449execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4450@arg00, @arg00, @arg00, @arg00 ;
4451insert into t9
4452( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4453values
4454( '40', '40', '40', '40', '40', '40', '40', '40',
4455'40', '40', '40' ) ;
4456set @arg00= '41' ;
4457insert into t9
4458( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4459values
4460( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4461@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4462prepare stmt1 from "insert into t9
4463  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4464values
4465  ( '42', '42', '42', '42', '42', '42', '42', '42',
4466    '42', '42', '42' )" ;
4467execute stmt1 ;
4468set @arg00= '43';
4469prepare stmt2 from "insert into t9
4470  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4471values
4472  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4473execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4474@arg00, @arg00, @arg00, @arg00 ;
4475insert into t9
4476( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4477values
4478( CAST('50' as binary), CAST('50' as binary),
4479CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
4480CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
4481CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
4482set @arg00= CAST('51' as binary) ;
4483insert into t9
4484( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4485values
4486( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4487@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4488prepare stmt1 from "insert into t9
4489  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4490values
4491  ( CAST('52' as binary), CAST('52' as binary),
4492  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
4493  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
4494  CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
4495execute stmt1 ;
4496set @arg00= CAST('53' as binary) ;
4497prepare stmt2 from "insert into t9
4498  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4499values
4500  ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4501execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4502@arg00, @arg00, @arg00, @arg00 ;
4503set @arg00= 2 ;
4504set @arg00= NULL ;
4505insert into t9
4506( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4507values
4508( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4509NULL, NULL, NULL ) ;
4510insert into t9
4511( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4512values
4513( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
4514@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4515prepare stmt1 from "insert into t9
4516  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4517values
4518  ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4519    NULL, NULL, NULL )" ;
4520execute stmt1 ;
4521prepare stmt2 from "insert into t9
4522  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4523values
4524  ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4525execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4526@arg00, @arg00, @arg00, @arg00 ;
4527set @arg00= 8.0 ;
4528set @arg00= NULL ;
4529insert into t9
4530( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4531values
4532( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
4533@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4534prepare stmt2 from "insert into t9
4535  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4536values
4537  ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4538execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4539@arg00, @arg00, @arg00, @arg00 ;
4540set @arg00= 'abc' ;
4541set @arg00= NULL ;
4542insert into t9
4543( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4544values
4545( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
4546@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
4547prepare stmt2 from "insert into t9
4548  ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4549values
4550  ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
4551execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4552@arg00, @arg00, @arg00, @arg00 ;
4553select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
4554from t9 where c1 >= 20
4555order by c1 ;
4556c1	c2	c3	c4	c5	c6	c7	c8	c9	c10	c12
455720	20	20	20	20	20	20	20	20	20	20.0000
455821	21	21	21	21	21	21	21	21	21	21.0000
455922	22	22	22	22	22	22	22	22	22	22.0000
456023	23	23	23	23	23	23	23	23	23	23.0000
456130	30	30	30	30	30	30	30	30	30	30.0000
456231	31	31	31	31	31	31	31	31	31	31.0000
456332	32	32	32	32	32	32	32	32	32	32.0000
456433	33	33	33	33	33	33	33	33	33	33.0000
456540	40	40	40	40	40	40	40	40	40	40.0000
456641	41	41	41	41	41	41	41	41	41	41.0000
456742	42	42	42	42	42	42	42	42	42	42.0000
456843	43	43	43	43	43	43	43	43	43	43.0000
456950	50	50	50	50	50	50	50	50	50	50.0000
457051	51	51	51	51	51	51	51	51	51	51.0000
457152	52	52	52	52	52	52	52	52	52	52.0000
457253	53	53	53	53	53	53	53	53	53	53.0000
457360	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457461	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457562	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457663	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457771	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457873	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
457981	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
458083	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
4581test_sequence
4582-- select .. where numeric column = .. --
4583set @arg00= 20;
4584select 'true' as found from t9
4585where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
4586and c8= 20 and c9= 20 and c10= 20 and c12= 20;
4587found
4588true
4589select 'true' as found from t9
4590where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
4591and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
4592and c12= @arg00;
4593found
4594true
4595prepare stmt1 from "select 'true' as found from t9
4596where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
4597  and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
4598execute stmt1 ;
4599found
4600true
4601prepare stmt1 from "select 'true' as found from t9
4602where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
4603  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
4604  and c12= ? ";
4605execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4606@arg00, @arg00, @arg00, @arg00 ;
4607found
4608true
4609set @arg00= 20.0;
4610select 'true' as found from t9
4611where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
4612and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
4613found
4614true
4615select 'true' as found from t9
4616where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
4617and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
4618and c12= @arg00;
4619found
4620true
4621prepare stmt1 from "select 'true' as found from t9
4622where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
4623  and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
4624execute stmt1 ;
4625found
4626true
4627prepare stmt1 from "select 'true' as found from t9
4628where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
4629  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
4630  and c12= ? ";
4631execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4632@arg00, @arg00, @arg00, @arg00 ;
4633found
4634true
4635select 'true' as found from t9
4636where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
4637  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
4638found
4639true
4640prepare stmt1 from "select 'true' as found from t9
4641where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
4642  and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
4643execute stmt1 ;
4644found
4645true
4646set @arg00= '20';
4647select 'true' as found from t9
4648where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
4649and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
4650and c12= @arg00;
4651found
4652true
4653prepare stmt1 from "select 'true' as found from t9
4654where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
4655  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
4656  and c12= ? ";
4657execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4658@arg00, @arg00, @arg00, @arg00 ;
4659found
4660true
4661select 'true' as found from t9
4662where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
4663c3= CAST('20' as binary) and c4= CAST('20' as binary) and
4664c5= CAST('20' as binary) and c6= CAST('20' as binary) and
4665c7= CAST('20' as binary) and c8= CAST('20' as binary) and
4666c9= CAST('20' as binary) and c10= CAST('20' as binary) and
4667c12= CAST('20' as binary);
4668found
4669true
4670prepare stmt1 from "select 'true' as found from t9
4671where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
4672      c3= CAST('20' as binary) and c4= CAST('20' as binary) and
4673      c5= CAST('20' as binary) and c6= CAST('20' as binary) and
4674      c7= CAST('20' as binary) and c8= CAST('20' as binary) and
4675      c9= CAST('20' as binary) and c10= CAST('20' as binary) and
4676      c12= CAST('20' as binary) ";
4677execute stmt1 ;
4678found
4679true
4680set @arg00= CAST('20' as binary) ;
4681select 'true' as found from t9
4682where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
4683and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
4684and c12= @arg00;
4685found
4686true
4687prepare stmt1 from "select 'true' as found from t9
4688where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
4689  and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
4690  and c12= ? ";
4691execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4692@arg00, @arg00, @arg00, @arg00 ;
4693found
4694true
4695delete from t9 ;
4696test_sequence
4697-- some numeric overflow experiments --
4698prepare my_insert from "insert into t9
4699   ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
4700values
4701   ( 'O',  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,   ?,   ? )" ;
4702prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
4703from t9 where c21 = 'O' ";
4704prepare my_delete from "delete from t9 where c21 = 'O' ";
4705set @arg00= 9223372036854775807 ;
4706execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4707@arg00, @arg00, @arg00, @arg00, @arg00 ;
4708Warnings:
4709Warning	1264	Out of range value for column 'c1' at row 1
4710Warning	1264	Out of range value for column 'c2' at row 1
4711Warning	1264	Out of range value for column 'c3' at row 1
4712Warning	1264	Out of range value for column 'c4' at row 1
4713Warning	1264	Out of range value for column 'c5' at row 1
4714Warning	1264	Out of range value for column 'c12' at row 1
4715execute my_select ;
4716c1	127
4717c2	32767
4718c3	8388607
4719c4	2147483647
4720c5	2147483647
4721c6	9223372036854775807
4722c7	9.22337e18
4723c8	9.223372036854776e18
4724c9	9.223372036854776e18
4725c10	9.223372036854776e18
4726c12	9999.9999
4727execute my_delete ;
4728set @arg00= '9223372036854775807' ;
4729execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4730@arg00, @arg00, @arg00, @arg00, @arg00 ;
4731Warnings:
4732Warning	1264	Out of range value for column 'c1' at row 1
4733Warning	1264	Out of range value for column 'c2' at row 1
4734Warning	1264	Out of range value for column 'c3' at row 1
4735Warning	1264	Out of range value for column 'c4' at row 1
4736Warning	1264	Out of range value for column 'c5' at row 1
4737Warning	1264	Out of range value for column 'c12' at row 1
4738execute my_select ;
4739c1	127
4740c2	32767
4741c3	8388607
4742c4	2147483647
4743c5	2147483647
4744c6	9223372036854775807
4745c7	9.22337e18
4746c8	9.223372036854776e18
4747c9	9.223372036854776e18
4748c10	9.223372036854776e18
4749c12	9999.9999
4750execute my_delete ;
4751set @arg00= -9223372036854775808 ;
4752execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4753@arg00, @arg00, @arg00, @arg00, @arg00 ;
4754Warnings:
4755Warning	1264	Out of range value for column 'c1' at row 1
4756Warning	1264	Out of range value for column 'c2' at row 1
4757Warning	1264	Out of range value for column 'c3' at row 1
4758Warning	1264	Out of range value for column 'c4' at row 1
4759Warning	1264	Out of range value for column 'c5' at row 1
4760Warning	1264	Out of range value for column 'c12' at row 1
4761execute my_select ;
4762c1	-128
4763c2	-32768
4764c3	-8388608
4765c4	-2147483648
4766c5	-2147483648
4767c6	-9223372036854775808
4768c7	-9.22337e18
4769c8	-9.223372036854776e18
4770c9	-9.223372036854776e18
4771c10	-9.223372036854776e18
4772c12	-9999.9999
4773execute my_delete ;
4774set @arg00= '-9223372036854775808' ;
4775execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4776@arg00, @arg00, @arg00, @arg00, @arg00 ;
4777Warnings:
4778Warning	1264	Out of range value for column 'c1' at row 1
4779Warning	1264	Out of range value for column 'c2' at row 1
4780Warning	1264	Out of range value for column 'c3' at row 1
4781Warning	1264	Out of range value for column 'c4' at row 1
4782Warning	1264	Out of range value for column 'c5' at row 1
4783Warning	1264	Out of range value for column 'c12' at row 1
4784execute my_select ;
4785c1	-128
4786c2	-32768
4787c3	-8388608
4788c4	-2147483648
4789c5	-2147483648
4790c6	-9223372036854775808
4791c7	-9.22337e18
4792c8	-9.223372036854776e18
4793c9	-9.223372036854776e18
4794c10	-9.223372036854776e18
4795c12	-9999.9999
4796execute my_delete ;
4797set @arg00= 1.11111111111111111111e+50 ;
4798execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4799@arg00, @arg00, @arg00, @arg00, @arg00 ;
4800Warnings:
4801Warning	1264	Out of range value for column 'c1' at row 1
4802Warning	1264	Out of range value for column 'c2' at row 1
4803Warning	1264	Out of range value for column 'c3' at row 1
4804Warning	1264	Out of range value for column 'c4' at row 1
4805Warning	1264	Out of range value for column 'c5' at row 1
4806Warning	1264	Out of range value for column 'c6' at row 1
4807Warning	1264	Out of range value for column 'c7' at row 1
4808Warning	1264	Out of range value for column 'c12' at row 1
4809execute my_select ;
4810c1	127
4811c2	32767
4812c3	8388607
4813c4	2147483647
4814c5	2147483647
4815c6	9223372036854775807
4816c7	3.40282e38
4817c8	1.111111111111111e50
4818c9	1.111111111111111e50
4819c10	1.111111111111111e50
4820c12	9999.9999
4821execute my_delete ;
4822set @arg00= '1.11111111111111111111e+50' ;
4823execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4824@arg00, @arg00, @arg00, @arg00, @arg00 ;
4825Warnings:
4826Warning	1264	Out of range value for column 'c1' at row 1
4827Warning	1264	Out of range value for column 'c2' at row 1
4828Warning	1264	Out of range value for column 'c3' at row 1
4829Warning	1264	Out of range value for column 'c4' at row 1
4830Warning	1264	Out of range value for column 'c5' at row 1
4831Warning	1264	Out of range value for column 'c6' at row 1
4832Warning	1264	Out of range value for column 'c7' at row 1
4833Warning	1264	Out of range value for column 'c12' at row 1
4834execute my_select ;
4835c1	127
4836c2	32767
4837c3	8388607
4838c4	2147483647
4839c5	2147483647
4840c6	9223372036854775807
4841c7	3.40282e38
4842c8	1.111111111111111e50
4843c9	1.111111111111111e50
4844c10	1.111111111111111e50
4845c12	9999.9999
4846execute my_delete ;
4847set @arg00= -1.11111111111111111111e+50 ;
4848execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4849@arg00, @arg00, @arg00, @arg00, @arg00 ;
4850Warnings:
4851Warning	1264	Out of range value for column 'c1' at row 1
4852Warning	1264	Out of range value for column 'c2' at row 1
4853Warning	1264	Out of range value for column 'c3' at row 1
4854Warning	1264	Out of range value for column 'c4' at row 1
4855Warning	1264	Out of range value for column 'c5' at row 1
4856Warning	1264	Out of range value for column 'c6' at row 1
4857Warning	1264	Out of range value for column 'c7' at row 1
4858Warning	1264	Out of range value for column 'c12' at row 1
4859execute my_select ;
4860c1	-128
4861c2	-32768
4862c3	-8388608
4863c4	-2147483648
4864c5	-2147483648
4865c6	-9223372036854775808
4866c7	-3.40282e38
4867c8	-1.111111111111111e50
4868c9	-1.111111111111111e50
4869c10	-1.111111111111111e50
4870c12	-9999.9999
4871execute my_delete ;
4872set @arg00= '-1.11111111111111111111e+50' ;
4873execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4874@arg00, @arg00, @arg00, @arg00, @arg00 ;
4875Warnings:
4876Warning	1264	Out of range value for column 'c1' at row 1
4877Warning	1264	Out of range value for column 'c2' at row 1
4878Warning	1264	Out of range value for column 'c3' at row 1
4879Warning	1264	Out of range value for column 'c4' at row 1
4880Warning	1264	Out of range value for column 'c5' at row 1
4881Warning	1264	Out of range value for column 'c6' at row 1
4882Warning	1264	Out of range value for column 'c7' at row 1
4883Warning	1264	Out of range value for column 'c12' at row 1
4884execute my_select ;
4885c1	-128
4886c2	-32768
4887c3	-8388608
4888c4	-2147483648
4889c5	-2147483648
4890c6	-9223372036854775808
4891c7	-3.40282e38
4892c8	-1.111111111111111e50
4893c9	-1.111111111111111e50
4894c10	-1.111111111111111e50
4895c12	-9999.9999
4896execute my_delete ;
4897test_sequence
4898-- insert into string columns --
4899Warnings:
4900Warning	1265	Data truncated for column 'c20' at row 1
4901Warnings:
4902Warning	1265	Data truncated for column 'c20' at row 1
4903Warnings:
4904Warning	1265	Data truncated for column 'c20' at row 1
4905Warnings:
4906Warning	1265	Data truncated for column 'c20' at row 1
4907Warnings:
4908Warning	1265	Data truncated for column 'c20' at row 1
4909Warnings:
4910Warning	1265	Data truncated for column 'c20' at row 1
4911Warnings:
4912Warning	1265	Data truncated for column 'c20' at row 1
4913Warnings:
4914Warning	1265	Data truncated for column 'c20' at row 1
4915Warnings:
4916Warning	1265	Data truncated for column 'c20' at row 1
4917Warnings:
4918Warning	1265	Data truncated for column 'c20' at row 1
4919Warnings:
4920Warning	1265	Data truncated for column 'c20' at row 1
4921Warnings:
4922Warning	1265	Data truncated for column 'c20' at row 1
4923Warnings:
4924Warning	1265	Data truncated for column 'c20' at row 1
4925Warnings:
4926Warning	1265	Data truncated for column 'c20' at row 1
4927Warnings:
4928Warning	1265	Data truncated for column 'c20' at row 1
4929Warnings:
4930Warning	1265	Data truncated for column 'c20' at row 1
4931Warnings:
4932Warning	1265	Data truncated for column 'c20' at row 1
4933Warnings:
4934Warning	1265	Data truncated for column 'c20' at row 1
4935Warnings:
4936Warning	1265	Data truncated for column 'c20' at row 1
4937Warnings:
4938Warning	1265	Data truncated for column 'c20' at row 1
4939select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
4940from t9 where c1 >= 20
4941order by c1 ;
4942c1	c20	c21	c22	c23	c24	c25	c26	c27	c28	c29	c30
494320	2	20	20	20	20	20	20	20	20	20	20
494421	2	21	21	21	21	21	21	21	21	21	21
494522	2	22	22	22	22	22	22	22	22	22	22
494623	2	23	23	23	23	23	23	23	23	23	23
494730	3	30	30	30	30	30	30	30	30	30	30
494831	3	31	31	31	31	31	31	31	31	31	31
494932	3	32	32	32	32	32	32	32	32	32	32
495033	3	33	33	33	33	33	33	33	33	33	33
495140	4	40	40	40	40	40	40	40	40	40	40
495241	4	41	41	41	41	41	41	41	41	41	41
495342	4	42	42	42	42	42	42	42	42	42	42
495443	4	43	43	43	43	43	43	43	43	43	43
495550	5	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0	50.0
495651	5	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0	51.0
495752	5	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0	52.0
495853	5	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0	53.0
495954	5	54	54	54	54	54	54	54	54	54	54
496055	6	55	55	55	55	55	55	55	55	55	55
496156	6	56	56	56	56	56	56	56	56	56	56
496257	6	57	57	57	57	57	57	57	57	57	57
496360	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496461	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496562	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496663	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496771	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496873	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
496981	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
497083	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
4971test_sequence
4972-- select .. where string column = .. --
4973set @arg00= '20';
4974select 'true' as found from t9
4975where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
4976c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
4977c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
4978found
4979true
4980select 'true' as found from t9
4981where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
4982c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
4983c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
4984found
4985true
4986prepare stmt1 from "select 'true' as found from t9
4987where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
4988  c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
4989  c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
4990execute stmt1 ;
4991found
4992true
4993prepare stmt1 from "select 'true' as found from t9
4994where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
4995  c21= ? and c22= ? and c23= ? and c25= ? and
4996  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
4997execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
4998@arg00, @arg00, @arg00, @arg00, @arg00 ;
4999found
5000true
5001set @arg00= CAST('20' as binary);
5002select 'true' as found from t9
5003where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
5004= CAST('20' as binary) and c21= CAST('20' as binary)
5005and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
5006c24= CAST('20' as binary) and c25= CAST('20' as binary) and
5007c26= CAST('20' as binary) and c27= CAST('20' as binary) and
5008c28= CAST('20' as binary) and c29= CAST('20' as binary) and
5009c30= CAST('20' as binary) ;
5010found
5011true
5012select 'true' as found from t9
5013where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
5014c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
5015c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
5016c30= @arg00;
5017found
5018true
5019prepare stmt1 from "select 'true' as found from t9
5020where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
5021                 = CAST('20' as binary) and c21= CAST('20' as binary)
5022  and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
5023  c24= CAST('20' as binary) and c25= CAST('20' as binary) and
5024  c26= CAST('20' as binary) and c27= CAST('20' as binary) and
5025  c28= CAST('20' as binary) and c29= CAST('20' as binary) and
5026  c30= CAST('20' as binary)" ;
5027execute stmt1 ;
5028found
5029true
5030prepare stmt1 from "select 'true' as found from t9
5031where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
5032  c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
5033  c29= ? and c30= ?";
5034execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
5035@arg00, @arg00, @arg00, @arg00, @arg00 ;
5036found
5037true
5038set @arg00= 20;
5039select 'true' as found from t9
5040where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
5041c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
5042c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
5043found
5044true
5045select 'true' as found from t9
5046where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
5047c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
5048c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
5049found
5050true
5051prepare stmt1 from "select 'true' as found from t9
5052where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
5053  c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
5054  c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
5055execute stmt1 ;
5056found
5057true
5058prepare stmt1 from "select 'true' as found from t9
5059where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
5060  c21= ? and c22= ? and c23= ? and c25= ? and
5061  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
5062execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
5063@arg00, @arg00, @arg00, @arg00, @arg00 ;
5064found
5065true
5066set @arg00= 20.0;
5067select 'true' as found from t9
5068where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
5069c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
5070c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
5071found
5072true
5073select 'true' as found from t9
5074where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
5075c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
5076c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
5077found
5078true
5079prepare stmt1 from "select 'true' as found from t9
5080where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
5081  c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
5082  c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
5083execute stmt1 ;
5084found
5085true
5086prepare stmt1 from "select 'true' as found from t9
5087where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
5088  c21= ? and c22= ? and c23= ? and c25= ? and
5089  c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
5090execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
5091@arg00, @arg00, @arg00, @arg00, @arg00 ;
5092found
5093true
5094delete from t9 ;
5095test_sequence
5096-- insert into date/time columns --
5097Warnings:
5098Note	1265	Data truncated for column 'c13' at row 1
5099Note	1265	Data truncated for column 'c16' at row 1
5100Warning	1265	Data truncated for column 'c17' at row 1
5101Warnings:
5102Note	1265	Data truncated for column 'c13' at row 1
5103Note	1265	Data truncated for column 'c16' at row 1
5104Warning	1265	Data truncated for column 'c17' at row 1
5105Warnings:
5106Note	1265	Data truncated for column 'c13' at row 1
5107Note	1265	Data truncated for column 'c16' at row 1
5108Warning	1265	Data truncated for column 'c17' at row 1
5109Warnings:
5110Note	1265	Data truncated for column 'c13' at row 1
5111Note	1265	Data truncated for column 'c16' at row 1
5112Warning	1265	Data truncated for column 'c17' at row 1
5113Warnings:
5114Note	1265	Data truncated for column 'c13' at row 1
5115Warnings:
5116Note	1265	Data truncated for column 'c13' at row 1
5117Note	1265	Data truncated for column 'c16' at row 1
5118Warning	1265	Data truncated for column 'c17' at row 1
5119Warnings:
5120Note	1265	Data truncated for column 'c13' at row 1
5121Warnings:
5122Note	1265	Data truncated for column 'c13' at row 1
5123Note	1265	Data truncated for column 'c16' at row 1
5124Warning	1265	Data truncated for column 'c17' at row 1
5125Warnings:
5126Warning	1265	Data truncated for column 'c13' at row 1
5127Warning	1265	Data truncated for column 'c14' at row 1
5128Warning	1265	Data truncated for column 'c15' at row 1
5129Warning	1264	Out of range value for column 'c16' at row 1
5130Warning	1264	Out of range value for column 'c17' at row 1
5131Warnings:
5132Warning	1265	Data truncated for column 'c13' at row 1
5133Warning	1265	Data truncated for column 'c14' at row 1
5134Warning	1265	Data truncated for column 'c15' at row 1
5135Warning	1264	Out of range value for column 'c16' at row 1
5136Warning	1264	Out of range value for column 'c17' at row 1
5137Warnings:
5138Warning	1265	Data truncated for column 'c13' at row 1
5139Warning	1265	Data truncated for column 'c14' at row 1
5140Warning	1265	Data truncated for column 'c15' at row 1
5141Warning	1264	Out of range value for column 'c16' at row 1
5142Warning	1264	Out of range value for column 'c17' at row 1
5143Warnings:
5144Warning	1265	Data truncated for column 'c13' at row 1
5145Warning	1265	Data truncated for column 'c14' at row 1
5146Warning	1265	Data truncated for column 'c15' at row 1
5147Warning	1264	Out of range value for column 'c16' at row 1
5148Warning	1264	Out of range value for column 'c17' at row 1
5149Warnings:
5150Warning	1265	Data truncated for column 'c15' at row 1
5151Warning	1264	Out of range value for column 'c16' at row 1
5152Warning	1264	Out of range value for column 'c17' at row 1
5153Warnings:
5154Warning	1265	Data truncated for column 'c15' at row 1
5155Warning	1264	Out of range value for column 'c16' at row 1
5156Warning	1264	Out of range value for column 'c17' at row 1
5157Warnings:
5158Warning	1265	Data truncated for column 'c15' at row 1
5159Warning	1264	Out of range value for column 'c16' at row 1
5160Warning	1264	Out of range value for column 'c17' at row 1
5161Warnings:
5162Warning	1265	Data truncated for column 'c15' at row 1
5163Warning	1264	Out of range value for column 'c16' at row 1
5164Warning	1264	Out of range value for column 'c17' at row 1
5165select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
5166c1	c13	c14	c15	c16	c17
516720	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
516821	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
516922	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517023	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517130	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517231	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517332	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517433	1991-01-01	1991-01-01 01:01:01	1991-01-01 01:01:01	01:01:01	1991
517540	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
517641	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
517742	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
517843	0000-00-00	0000-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
517950	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
518051	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
518152	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
518253	2001-00-00	2001-00-00 00:00:00	0000-00-00 00:00:00	838:59:59	0000
518360	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518461	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518562	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518663	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518771	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518873	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
518981	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
519083	NULL	NULL	1991-01-01 01:01:01	NULL	NULL
5191test_sequence
5192-- select .. where date/time column = .. --
5193set @arg00= '1991-01-01 01:01:01' ;
5194select 'true' as found from t9
5195where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
5196c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
5197c17= '1991-01-01 01:01:01' ;
5198found
5199true
5200select 'true' as found from t9
5201where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
5202and c17= @arg00 ;
5203found
5204true
5205prepare stmt1 from "select 'true' as found from t9
5206where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
5207  c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
5208  c17= '1991-01-01 01:01:01'" ;
5209execute stmt1 ;
5210found
5211true
5212prepare stmt1 from "select 'true' as found from t9
5213where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
5214execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
5215found
5216true
5217set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
5218select 'true' as found from t9
5219where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
5220c14= CAST('1991-01-01 01:01:01' as datetime) and
5221c15= CAST('1991-01-01 01:01:01' as datetime) and
5222c16= CAST('1991-01-01 01:01:01' as datetime) and
5223c17= CAST('1991-01-01 01:01:01' as datetime) ;
5224found
5225true
5226select 'true' as found from t9
5227where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
5228and c17= @arg00 ;
5229found
5230true
5231prepare stmt1 from "select 'true' as found from t9
5232where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and
5233  c14= CAST('1991-01-01 01:01:01' as datetime) and
5234  c15= CAST('1991-01-01 01:01:01' as datetime) and
5235  c16= CAST('1991-01-01 01:01:01' as datetime) and
5236  c17= CAST('1991-01-01 01:01:01' as datetime)" ;
5237execute stmt1 ;
5238found
5239true
5240prepare stmt1 from "select 'true' as found from t9
5241where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
5242execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
5243found
5244true
5245set @arg00= 1991 ;
5246select 'true' as found from t9
5247where c1= 20 and c17= 1991 ;
5248found
5249true
5250select 'true' as found from t9
5251where c1= 20 and c17= @arg00 ;
5252found
5253true
5254prepare stmt1 from "select 'true' as found from t9
5255where c1= 20 and c17= 1991" ;
5256execute stmt1 ;
5257found
5258true
5259prepare stmt1 from "select 'true' as found from t9
5260where c1= 20 and c17= ?" ;
5261execute stmt1 using @arg00 ;
5262found
5263true
5264set @arg00= 1.991e+3 ;
5265select 'true' as found from t9
5266where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
5267found
5268true
5269select 'true' as found from t9
5270where c1= 20 and abs(c17 - @arg00) < 0.01 ;
5271found
5272true
5273prepare stmt1 from "select 'true' as found from t9
5274where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
5275execute stmt1 ;
5276found
5277true
5278prepare stmt1 from "select 'true' as found from t9
5279where c1= 20 and abs(c17 - ?) < 0.01" ;
5280execute stmt1 using @arg00 ;
5281found
5282true
5283SET sql_mode = default;
5284DROP TABLE t1, t1_1, t1_2, t9_1, t9_2, t9;
5285"End of tests"
5286