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