1use test; 2drop table if exists t1, t1_1, t1_2, 3t9, t9_1, t9_2; 4drop table if exists t1, t9 ; 5create table t1 6( 7a int, b varchar(30), 8primary key(a) 9) engine = 'MYISAM' ; 10create table t9 11( 12c1 tinyint, c2 smallint, c3 mediumint, c4 int, 13c5 integer, c6 bigint, c7 float, c8 double, 14c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), 15c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 16ON UPDATE CURRENT_TIMESTAMP, c16 time, 17c17 year, c18 tinyint, c19 bool, c20 char, 18c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, 19c25 blob, c26 text, c27 mediumblob, c28 mediumtext, 20c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), 21c32 set('monday', 'tuesday', 'wednesday'), 22primary key(c1) 23) engine = 'MYISAM' ; 24rename table t1 to t1_1, t9 to t9_1 ; 25drop table if exists t1, t9 ; 26create table t1 27( 28a int, b varchar(30), 29primary key(a) 30) engine = 'MYISAM' ; 31create table t9 32( 33c1 tinyint, c2 smallint, c3 mediumint, c4 int, 34c5 integer, c6 bigint, c7 float, c8 double, 35c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), 36c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 37ON UPDATE CURRENT_TIMESTAMP, c16 time, 38c17 year, c18 tinyint, c19 bool, c20 char, 39c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, 40c25 blob, c26 text, c27 mediumblob, c28 mediumtext, 41c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), 42c32 set('monday', 'tuesday', 'wednesday'), 43primary key(c1) 44) engine = 'MYISAM' ; 45rename table t1 to t1_2, t9 to t9_2 ; 46create table t1 47( 48a int, b varchar(30), 49primary key(a) 50) ENGINE = MERGE UNION=(t1_1,t1_2) 51INSERT_METHOD=FIRST; 52create table t9 53( 54c1 tinyint, c2 smallint, c3 mediumint, c4 int, 55c5 integer, c6 bigint, c7 float, c8 double, 56c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), 57c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time, 58c17 year, c18 tinyint, c19 bool, c20 char, 59c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, 60c25 blob, c26 text, c27 mediumblob, c28 mediumtext, 61c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), 62c32 set('monday', 'tuesday', 'wednesday'), 63primary key(c1) 64) ENGINE = MERGE UNION=(t9_1,t9_2) 65INSERT_METHOD=FIRST; 66delete from t1 ; 67insert into t1 values (1,'one'); 68insert into t1 values (2,'two'); 69insert into t1 values (3,'three'); 70insert into t1 values (4,'four'); 71commit ; 72delete from t9 ; 73insert into t9 74set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 75c10= 1, c11= 1, c12 = 1, 76c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 77c16= '11:11:11', c17= '2004', 78c18= 1, c19=true, c20= 'a', c21= '123456789a', 79c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 80c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 81c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 82insert into t9 83set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 84c10= 9, c11= 9, c12 = 9, 85c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 86c16= '11:11:11', c17= '2004', 87c18= 1, c19=false, c20= 'a', c21= '123456789a', 88c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 89c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 90c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 91commit ; 92test_sequence 93------ simple select tests ------ 94prepare stmt1 from ' select * from t9 order by c1 ' ; 95execute stmt1; 96Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 97def test t9 t9 c1 c1 1 4 1 N 49155 0 63 98def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 99def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 100def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 101def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 102def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 103def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 104def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 105def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 106def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 107def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 108def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 109def test t9 t9 c13 c13 10 10 10 Y 128 0 63 110def test t9 t9 c14 c14 12 19 19 Y 128 0 63 111def test t9 t9 c15 c15 7 19 19 N 9345 0 63 112def test t9 t9 c16 c16 11 10 8 Y 128 0 63 113def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 114def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 115def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 116def test t9 t9 c20 c20 254 1 1 Y 0 0 8 117def test t9 t9 c21 c21 254 10 10 Y 0 0 8 118def test t9 t9 c22 c22 253 30 30 Y 0 0 8 119def test t9 t9 c23 c23 252 255 8 Y 144 0 63 120def test t9 t9 c24 c24 252 255 8 Y 16 0 8 121def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 122def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 123def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 124def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 125def test t9 t9 c29 c29 252 4294967295 8 Y 144 0 63 126def test t9 t9 c30 c30 252 4294967295 8 Y 16 0 8 127def test t9 t9 c31 c31 254 5 3 Y 256 0 8 128def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 129c1 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 1301 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 1319 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 132set @arg00='SELECT' ; 133@arg00 a from t1 where a=1; 134ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1 135prepare stmt1 from ' ? a from t1 where a=1 '; 136ERROR 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 137set @arg00=1 ; 138select @arg00, b from t1 where a=1 ; 139@arg00 b 1401 one 141prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 142execute stmt1 using @arg00 ; 143? b 1441 one 145set @arg00='lion' ; 146select @arg00, b from t1 where a=1 ; 147@arg00 b 148lion one 149prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 150execute stmt1 using @arg00 ; 151? b 152lion one 153set @arg00=NULL ; 154select @arg00, b from t1 where a=1 ; 155@arg00 b 156NULL one 157prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 158execute stmt1 using @arg00 ; 159? b 160NULL one 161set @arg00=1 ; 162select b, a - @arg00 from t1 where a=1 ; 163b a - @arg00 164one 0 165prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; 166execute stmt1 using @arg00 ; 167b a - ? 168one 0 169set @arg00=null ; 170select @arg00 as my_col ; 171my_col 172NULL 173prepare stmt1 from ' select ? as my_col'; 174execute stmt1 using @arg00 ; 175my_col 176NULL 177select @arg00 + 1 as my_col ; 178my_col 179NULL 180prepare stmt1 from ' select ? + 1 as my_col'; 181execute stmt1 using @arg00 ; 182my_col 183NULL 184select 1 + @arg00 as my_col ; 185my_col 186NULL 187prepare stmt1 from ' select 1 + ? as my_col'; 188execute stmt1 using @arg00 ; 189my_col 190NULL 191set @arg00='MySQL' ; 192select substr(@arg00,1,2) from t1 where a=1 ; 193substr(@arg00,1,2) 194My 195prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; 196execute stmt1 using @arg00 ; 197substr(?,1,2) 198My 199set @arg00=3 ; 200select substr('MySQL',@arg00,5) from t1 where a=1 ; 201substr('MySQL',@arg00,5) 202SQL 203prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; 204execute stmt1 using @arg00 ; 205substr('MySQL',?,5) 206SQL 207select substr('MySQL',1,@arg00) from t1 where a=1 ; 208substr('MySQL',1,@arg00) 209MyS 210prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; 211execute stmt1 using @arg00 ; 212substr('MySQL',1,?) 213MyS 214set @arg00='MySQL' ; 215select a , concat(@arg00,b) from t1 order by a; 216a concat(@arg00,b) 2171 MySQLone 2182 MySQLtwo 2193 MySQLthree 2204 MySQLfour 221prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; 222execute stmt1 using @arg00; 223a concat(?,b) 2241 MySQLone 2252 MySQLtwo 2263 MySQLthree 2274 MySQLfour 228select a , concat(b,@arg00) from t1 order by a ; 229a concat(b,@arg00) 2301 oneMySQL 2312 twoMySQL 2323 threeMySQL 2334 fourMySQL 234prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; 235execute stmt1 using @arg00; 236a concat(b,?) 2371 oneMySQL 2382 twoMySQL 2393 threeMySQL 2404 fourMySQL 241set @arg00='MySQL' ; 242select group_concat(@arg00,b order by a) from t1 243group by 'a' ; 244group_concat(@arg00,b order by a) 245MySQLone,MySQLtwo,MySQLthree,MySQLfour 246prepare stmt1 from ' select group_concat(?,b order by a) from t1 247group by ''a'' ' ; 248execute stmt1 using @arg00; 249group_concat(?,b order by a) 250MySQLone,MySQLtwo,MySQLthree,MySQLfour 251select group_concat(b,@arg00 order by a) from t1 252group by 'a' ; 253group_concat(b,@arg00 order by a) 254oneMySQL,twoMySQL,threeMySQL,fourMySQL 255prepare stmt1 from ' select group_concat(b,? order by a) from t1 256group by ''a'' ' ; 257execute stmt1 using @arg00; 258group_concat(b,? order by a) 259oneMySQL,twoMySQL,threeMySQL,fourMySQL 260set @arg00='first' ; 261set @arg01='second' ; 262set @arg02=NULL; 263select @arg00, @arg01 from t1 where a=1 ; 264@arg00 @arg01 265first second 266prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; 267execute stmt1 using @arg00, @arg01 ; 268? ? 269first second 270execute stmt1 using @arg02, @arg01 ; 271? ? 272NULL second 273execute stmt1 using @arg00, @arg02 ; 274? ? 275first NULL 276execute stmt1 using @arg02, @arg02 ; 277? ? 278NULL NULL 279drop table if exists t5 ; 280create table t5 (id1 int(11) not null default '0', 281value2 varchar(100), value1 varchar(100)) ; 282insert into t5 values (1,'hh','hh'),(2,'hh','hh'), 283(1,'ii','ii'),(2,'ii','ii') ; 284prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; 285set @arg00=1 ; 286set @arg01='hh' ; 287execute stmt1 using @arg00, @arg01 ; 288id1 value1 2891 hh 2901 ii 2912 hh 292drop table t5 ; 293drop table if exists t5 ; 294create table t5(session_id char(9) not null) ; 295insert into t5 values ('abc') ; 296prepare stmt1 from ' select * from t5 297where ?=''1111'' and session_id = ''abc'' ' ; 298set @arg00='abc' ; 299execute stmt1 using @arg00 ; 300session_id 301set @arg00='1111' ; 302execute stmt1 using @arg00 ; 303session_id 304abc 305set @arg00='abc' ; 306execute stmt1 using @arg00 ; 307session_id 308drop table t5 ; 309set @arg00='FROM' ; 310select a @arg00 t1 where a=1 ; 311ERROR 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 312prepare stmt1 from ' select a ? t1 where a=1 ' ; 313ERROR 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 314set @arg00='t1' ; 315select a from @arg00 where a=1 ; 316ERROR 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 317prepare stmt1 from ' select a from ? where a=1 ' ; 318ERROR 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 319set @arg00='WHERE' ; 320select a from t1 @arg00 a=1 ; 321ERROR 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 322prepare stmt1 from ' select a from t1 ? a=1 ' ; 323ERROR 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 324set @arg00=1 ; 325select a FROM t1 where a=@arg00 ; 326a 3271 328prepare stmt1 from ' select a FROM t1 where a=? ' ; 329execute stmt1 using @arg00 ; 330a 3311 332set @arg00=1000 ; 333execute stmt1 using @arg00 ; 334a 335set @arg00=NULL ; 336select a FROM t1 where a=@arg00 ; 337a 338prepare stmt1 from ' select a FROM t1 where a=? ' ; 339execute stmt1 using @arg00 ; 340a 341set @arg00=4 ; 342select a FROM t1 where a=sqrt(@arg00) ; 343a 3442 345prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; 346execute stmt1 using @arg00 ; 347a 3482 349set @arg00=NULL ; 350select a FROM t1 where a=sqrt(@arg00) ; 351a 352prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; 353execute stmt1 using @arg00 ; 354a 355set @arg00=2 ; 356set @arg01=3 ; 357select a FROM t1 where a in (@arg00,@arg01) order by a; 358a 3592 3603 361prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; 362execute stmt1 using @arg00, @arg01; 363a 3642 3653 366set @arg00= 'one' ; 367set @arg01= 'two' ; 368set @arg02= 'five' ; 369prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; 370execute stmt1 using @arg00, @arg01, @arg02 ; 371b 372one 373two 374prepare stmt1 from ' select b FROM t1 where b like ? '; 375set @arg00='two' ; 376execute stmt1 using @arg00 ; 377b 378two 379set @arg00='tw%' ; 380execute stmt1 using @arg00 ; 381b 382two 383set @arg00='%wo' ; 384execute stmt1 using @arg00 ; 385b 386two 387set @arg00=null ; 388insert into t9 set c1= 0, c5 = NULL ; 389select c5 from t9 where c5 > NULL ; 390c5 391prepare stmt1 from ' select c5 from t9 where c5 > ? '; 392execute stmt1 using @arg00 ; 393c5 394select c5 from t9 where c5 < NULL ; 395c5 396prepare stmt1 from ' select c5 from t9 where c5 < ? '; 397execute stmt1 using @arg00 ; 398c5 399select c5 from t9 where c5 = NULL ; 400c5 401prepare stmt1 from ' select c5 from t9 where c5 = ? '; 402execute stmt1 using @arg00 ; 403c5 404select c5 from t9 where c5 <=> NULL ; 405c5 406NULL 407prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; 408execute stmt1 using @arg00 ; 409c5 410NULL 411delete from t9 where c1= 0 ; 412set @arg00='>' ; 413select a FROM t1 where a @arg00 1 ; 414ERROR 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 415prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; 416ERROR 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 417set @arg00=1 ; 418select a,b FROM t1 where a is not NULL 419AND b is not NULL group by a - @arg00 ; 420a b 4211 one 4222 two 4233 three 4244 four 425prepare stmt1 from ' select a,b FROM t1 where a is not NULL 426AND b is not NULL group by a - ? ' ; 427execute stmt1 using @arg00 ; 428a b 4291 one 4302 two 4313 three 4324 four 433set @arg00='two' ; 434select a,b FROM t1 where a is not NULL 435AND b is not NULL having b <> @arg00 order by a ; 436a b 4371 one 4383 three 4394 four 440prepare stmt1 from ' select a,b FROM t1 where a is not NULL 441AND b is not NULL having b <> ? order by a ' ; 442execute stmt1 using @arg00 ; 443a b 4441 one 4453 three 4464 four 447set @arg00=1 ; 448select a,b FROM t1 where a is not NULL 449AND b is not NULL order by a - @arg00 ; 450a b 4511 one 4522 two 4533 three 4544 four 455prepare stmt1 from ' select a,b FROM t1 where a is not NULL 456AND b is not NULL order by a - ? ' ; 457execute stmt1 using @arg00 ; 458a b 4591 one 4602 two 4613 three 4624 four 463set @arg00=2 ; 464select a,b from t1 order by 2 ; 465a b 4664 four 4671 one 4683 three 4692 two 470prepare stmt1 from ' select a,b from t1 471order by ? '; 472execute stmt1 using @arg00; 473a b 4744 four 4751 one 4763 three 4772 two 478set @arg00=1 ; 479execute stmt1 using @arg00; 480a b 4811 one 4822 two 4833 three 4844 four 485set @arg00=0 ; 486execute stmt1 using @arg00; 487ERROR 42S22: Unknown column '?' in 'order clause' 488set @arg00=1; 489prepare stmt1 from ' select a,b from t1 order by a 490limit 1 '; 491execute stmt1 ; 492a b 4931 one 494prepare stmt1 from ' select a,b from t1 order by a limit ? '; 495execute stmt1 using @arg00; 496a b 4971 one 498set @arg00='b' ; 499set @arg01=0 ; 500set @arg02=2 ; 501set @arg03=2 ; 502select sum(a), @arg00 from t1 where a > @arg01 503and b is not null group by substr(b,@arg02) 504having sum(a) <> @arg03 ; 505sum(a) @arg00 5063 b 5071 b 5084 b 509prepare stmt1 from ' select sum(a), ? from t1 where a > ? 510and b is not null group by substr(b,?) 511having sum(a) <> ? '; 512execute stmt1 using @arg00, @arg01, @arg02, @arg03; 513sum(a) ? 5143 b 5151 b 5164 b 517test_sequence 518------ join tests ------ 519select first.a as a1, second.a as a2 520from t1 first, t1 second 521where first.a = second.a order by a1 ; 522a1 a2 5231 1 5242 2 5253 3 5264 4 527prepare stmt1 from ' select first.a as a1, second.a as a2 528 from t1 first, t1 second 529 where first.a = second.a order by a1 '; 530execute stmt1 ; 531a1 a2 5321 1 5332 2 5343 3 5354 4 536set @arg00='ABC'; 537set @arg01='two'; 538set @arg02='one'; 539select first.a, @arg00, second.a FROM t1 first, t1 second 540where @arg01 = first.b or first.a = second.a or second.b = @arg02 541order by second.a, first.a; 542a @arg00 a 5431 ABC 1 5442 ABC 1 5453 ABC 1 5464 ABC 1 5472 ABC 2 5482 ABC 3 5493 ABC 3 5502 ABC 4 5514 ABC 4 552prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second 553 where ? = first.b or first.a = second.a or second.b = ? 554 order by second.a, first.a'; 555execute stmt1 using @arg00, @arg01, @arg02; 556a ? a 5571 ABC 1 5582 ABC 1 5593 ABC 1 5604 ABC 1 5612 ABC 2 5622 ABC 3 5633 ABC 3 5642 ABC 4 5654 ABC 4 566drop table if exists t2 ; 567create table t2 as select * from t1 ; 568set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; 569set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; 570set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; 571set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; 572set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; 573set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; 574set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; 575set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; 576set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; 577the join statement is: 578SELECT * FROM t2 right join t1 using(a) order by t2.a 579prepare stmt1 from @query9 ; 580execute stmt1 ; 581a b b 5821 one one 5832 two two 5843 three three 5854 four four 586execute stmt1 ; 587a b b 5881 one one 5892 two two 5903 three three 5914 four four 592execute stmt1 ; 593a b b 5941 one one 5952 two two 5963 three three 5974 four four 598the join statement is: 599SELECT * FROM t2 natural right join t1 order by t2.a 600prepare stmt1 from @query8 ; 601execute stmt1 ; 602a b 6031 one 6042 two 6053 three 6064 four 607execute stmt1 ; 608a b 6091 one 6102 two 6113 three 6124 four 613execute stmt1 ; 614a b 6151 one 6162 two 6173 three 6184 four 619the join statement is: 620SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a 621prepare stmt1 from @query7 ; 622execute stmt1 ; 623a b a b 6241 one 1 one 6252 two 2 two 6263 three 3 three 6274 four 4 four 628execute stmt1 ; 629a b a b 6301 one 1 one 6312 two 2 two 6323 three 3 three 6334 four 4 four 634execute stmt1 ; 635a b a b 6361 one 1 one 6372 two 2 two 6383 three 3 three 6394 four 4 four 640the join statement is: 641SELECT * FROM t2 left join t1 using(a) order by t2.a 642prepare stmt1 from @query6 ; 643execute stmt1 ; 644a b b 6451 one one 6462 two two 6473 three three 6484 four four 649execute stmt1 ; 650a b b 6511 one one 6522 two two 6533 three three 6544 four four 655execute stmt1 ; 656a b b 6571 one one 6582 two two 6593 three three 6604 four four 661the join statement is: 662SELECT * FROM t2 natural left join t1 order by t2.a 663prepare stmt1 from @query5 ; 664execute stmt1 ; 665a b 6661 one 6672 two 6683 three 6694 four 670execute stmt1 ; 671a b 6721 one 6732 two 6743 three 6754 four 676execute stmt1 ; 677a b 6781 one 6792 two 6803 three 6814 four 682the join statement is: 683SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a 684prepare stmt1 from @query4 ; 685execute stmt1 ; 686a b a b 6871 one 1 one 6882 two 2 two 6893 three 3 three 6904 four 4 four 691execute stmt1 ; 692a b a b 6931 one 1 one 6942 two 2 two 6953 three 3 three 6964 four 4 four 697execute stmt1 ; 698a b a b 6991 one 1 one 7002 two 2 two 7013 three 3 three 7024 four 4 four 703the join statement is: 704SELECT * FROM t2 join t1 using(a) order by t2.a 705prepare stmt1 from @query3 ; 706execute stmt1 ; 707a b b 7081 one one 7092 two two 7103 three three 7114 four four 712execute stmt1 ; 713a b b 7141 one one 7152 two two 7163 three three 7174 four four 718execute stmt1 ; 719a b b 7201 one one 7212 two two 7223 three three 7234 four four 724the join statement is: 725SELECT * FROM t2 natural join t1 order by t2.a 726prepare stmt1 from @query2 ; 727execute stmt1 ; 728a b 7291 one 7302 two 7313 three 7324 four 733execute stmt1 ; 734a b 7351 one 7362 two 7373 three 7384 four 739execute stmt1 ; 740a b 7411 one 7422 two 7433 three 7444 four 745the join statement is: 746SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a 747prepare stmt1 from @query1 ; 748execute stmt1 ; 749a b a b 7501 one 1 one 7512 two 2 two 7523 three 3 three 7534 four 4 four 754execute stmt1 ; 755a b a b 7561 one 1 one 7572 two 2 two 7583 three 3 three 7594 four 4 four 760execute stmt1 ; 761a b a b 7621 one 1 one 7632 two 2 two 7643 three 3 three 7654 four 4 four 766drop table t2 ; 767test_sequence 768------ subquery tests ------ 769prepare stmt1 from ' select a, b FROM t1 outer_table where 770 a = (select a from t1 where b = ''two'') '; 771execute stmt1 ; 772a b 7732 two 774set @arg00='two' ; 775select a, b FROM t1 outer_table where 776a = (select a from t1 where b = 'two' ) and b=@arg00 ; 777a b 7782 two 779prepare stmt1 from ' select a, b FROM t1 outer_table where 780 a = (select a from t1 where b = ''two'') and b=? '; 781execute stmt1 using @arg00; 782a b 7832 two 784set @arg00='two' ; 785select a, b FROM t1 outer_table where 786a = (select a from t1 where b = @arg00 ) and b='two' ; 787a b 7882 two 789prepare stmt1 from ' select a, b FROM t1 outer_table where 790 a = (select a from t1 where b = ? ) and b=''two'' ' ; 791execute stmt1 using @arg00; 792a b 7932 two 794set @arg00=3 ; 795set @arg01='three' ; 796select a,b FROM t1 where (a,b) in (select 3, 'three'); 797a b 7983 three 799select a FROM t1 where (a,b) in (select @arg00,@arg01); 800a 8013 802prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; 803execute stmt1 using @arg00, @arg01; 804a 8053 806set @arg00=1 ; 807set @arg01='two' ; 808set @arg02=2 ; 809set @arg03='two' ; 810select a, @arg00, b FROM t1 outer_table where 811b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; 812a @arg00 b 8132 1 two 814prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 815 b=? and a = (select ? from t1 where b = ? ) ' ; 816execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 817a ? b 8182 1 two 819prepare stmt1 from 'select c4 FROM t9 where 820 c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ; 821execute stmt1 using @arg01, @arg02; 822c4 823prepare stmt1 from ' select a, b FROM t1 outer_table where 824 a = (select a from t1 where b = outer_table.b ) order by a '; 825execute stmt1 ; 826a b 8271 one 8282 two 8293 three 8304 four 831prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 832 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 833execute stmt1 ; 834ccc 8351 836deallocate prepare stmt1 ; 837prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 838 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 839execute stmt1 ; 840ccc 8411 842deallocate prepare stmt1 ; 843prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 844 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 845execute stmt1 ; 846ccc 8471 848deallocate prepare stmt1 ; 849set @arg00='two' ; 850select a, b FROM t1 outer_table where 851a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; 852a b 8532 two 854prepare stmt1 from ' select a, b FROM t1 outer_table where 855 a = (select a from t1 where b = outer_table.b) and b=? '; 856execute stmt1 using @arg00; 857a b 8582 two 859set @arg00=2 ; 860select a, b FROM t1 outer_table where 861a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; 862a b 8632 two 864prepare stmt1 from ' select a, b FROM t1 outer_table where 865 a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; 866execute stmt1 using @arg00; 867a b 8682 two 869set @arg00=2 ; 870select a, b FROM t1 outer_table where 871a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; 872a b 8732 two 874prepare stmt1 from ' select a, b FROM t1 outer_table where 875 a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; 876execute stmt1 using @arg00; 877a b 8782 two 879set @arg00=1 ; 880set @arg01='two' ; 881set @arg02=2 ; 882set @arg03='two' ; 883select a, @arg00, b FROM t1 outer_table where 884b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 885and outer_table.a=a ) ; 886a @arg00 b 8872 1 two 888prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 889 b=? and a = (select ? from t1 where outer_table.b = ? 890 and outer_table.a=a ) ' ; 891execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 892a ? b 8932 1 two 894set @arg00=1 ; 895set @arg01=0 ; 896select a, @arg00 897from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 898where a=@arg01; 899a @arg00 9000 1 901prepare stmt1 from ' select a, ? 902 from ( select a - ? as a from t1 where a=? ) as t2 903 where a=? '; 904execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; 905a ? 9060 1 907drop table if exists t2 ; 908create table t2 as select * from t1; 909prepare stmt1 from ' select a in (select a from t2) from t1 ' ; 910execute stmt1 ; 911a in (select a from t2) 9121 9131 9141 9151 916drop table if exists t5, t6, t7 ; 917create table t5 (a int , b int) ; 918create table t6 like t5 ; 919create table t7 like t5 ; 920insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), 921(2, -1), (3, 10) ; 922insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; 923insert into t7 values (3, 3), (2, 2), (1, 1) ; 924prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 925 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 926 group by t5.a order by sum limit 1) from t7 ' ; 927execute stmt1 ; 928a (select count(distinct t5.b) as sum from t5, t6 929 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 930 group by t5.a order by sum limit 1) 9313 1 9322 2 9331 2 934execute stmt1 ; 935a (select count(distinct t5.b) as sum from t5, t6 936 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 937 group by t5.a order by sum limit 1) 9383 1 9392 2 9401 2 941execute stmt1 ; 942a (select count(distinct t5.b) as sum from t5, t6 943 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 944 group by t5.a order by sum limit 1) 9453 1 9462 2 9471 2 948drop table t5, t6, t7 ; 949drop table if exists t2 ; 950create table t2 as select * from t9; 951set @stmt= ' SELECT 952 (SELECT SUM(c1 + c12 + 0.0) FROM t2 953 where (t9.c2 - 0e-3) = t2.c2 954 GROUP BY t9.c15 LIMIT 1) as scalar_s, 955 exists (select 1.0e+0 from t2 956 where t2.c3 * 9.0000000000 = t9.c4) as exists_s, 957 c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, 958 (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s 959FROM t9, 960(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; 961prepare stmt1 from @stmt ; 962execute stmt1 ; 963execute stmt1 ; 964set @stmt= concat('explain ',@stmt); 965prepare stmt1 from @stmt ; 966execute stmt1 ; 967execute stmt1 ; 968set @stmt= ' SELECT 969 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 970 GROUP BY t9.c15 LIMIT 1) as scalar_s, 971 exists (select ? from t2 972 where t2.c3*?=t9.c4) as exists_s, 973 c5*? in (select c6+? from t2) as in_s, 974 (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s 975FROM t9, 976(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; 977set @arg00= 0.0 ; 978set @arg01= 0e-3 ; 979set @arg02= 1.0e+0 ; 980set @arg03= 9.0000000000 ; 981set @arg04= 4 ; 982set @arg05= 0.3e+1 ; 983set @arg06= 4 ; 984set @arg07= 4 ; 985set @arg08= 4.0 ; 986set @arg09= 40e-1 ; 987prepare stmt1 from @stmt ; 988execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 989@arg07, @arg08, @arg09 ; 990execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 991@arg07, @arg08, @arg09 ; 992set @stmt= concat('explain ',@stmt); 993prepare stmt1 from @stmt ; 994execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 995@arg07, @arg08, @arg09 ; 996execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 997@arg07, @arg08, @arg09 ; 998drop table t2 ; 999select 1 < (select a from t1) ; 1000ERROR 21000: Subquery returns more than 1 row 1001prepare stmt1 from ' select 1 < (select a from t1) ' ; 1002execute stmt1 ; 1003ERROR 21000: Subquery returns more than 1 row 1004select 1 as my_col ; 1005my_col 10061 1007test_sequence 1008------ union tests ------ 1009prepare stmt1 from ' select a FROM t1 where a=1 1010 union distinct 1011 select a FROM t1 where a=1 '; 1012execute stmt1 ; 1013a 10141 1015execute stmt1 ; 1016a 10171 1018prepare stmt1 from ' select a FROM t1 where a=1 1019 union all 1020 select a FROM t1 where a=1 '; 1021execute stmt1 ; 1022a 10231 10241 1025prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; 1026ERROR 21000: The used SELECT statements have a different number of columns 1027prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; 1028ERROR 21000: The used SELECT statements have a different number of columns 1029prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; 1030ERROR 21000: The used SELECT statements have a different number of columns 1031prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; 1032ERROR 21000: The used SELECT statements have a different number of columns 1033set @arg00=1 ; 1034select @arg00 FROM t1 where a=1 1035union distinct 1036select 1 FROM t1 where a=1; 1037@arg00 10381 1039prepare stmt1 from ' select ? FROM t1 where a=1 1040 union distinct 1041 select 1 FROM t1 where a=1 ' ; 1042execute stmt1 using @arg00; 1043? 10441 1045set @arg00=1 ; 1046select 1 FROM t1 where a=1 1047union distinct 1048select @arg00 FROM t1 where a=1; 10491 10501 1051prepare stmt1 from ' select 1 FROM t1 where a=1 1052 union distinct 1053 select ? FROM t1 where a=1 ' ; 1054execute stmt1 using @arg00; 10551 10561 1057set @arg00='a' ; 1058select @arg00 FROM t1 where a=1 1059union distinct 1060select @arg00 FROM t1 where a=1; 1061@arg00 1062a 1063prepare stmt1 from ' select ? FROM t1 where a=1 1064 union distinct 1065 select ? FROM t1 where a=1 '; 1066execute stmt1 using @arg00, @arg00; 1067? 1068a 1069prepare stmt1 from ' select ? 1070 union distinct 1071 select ? '; 1072execute stmt1 using @arg00, @arg00; 1073? 1074a 1075set @arg00='a' ; 1076set @arg01=1 ; 1077set @arg02='a' ; 1078set @arg03=2 ; 1079select @arg00 FROM t1 where a=@arg01 1080union distinct 1081select @arg02 FROM t1 where a=@arg03; 1082@arg00 1083a 1084prepare stmt1 from ' select ? FROM t1 where a=? 1085 union distinct 1086 select ? FROM t1 where a=? ' ; 1087execute stmt1 using @arg00, @arg01, @arg02, @arg03; 1088? 1089a 1090set @arg00=1 ; 1091prepare stmt1 from ' select sum(a) + 200, ? from t1 1092union distinct 1093select sum(a) + 200, 1 from t1 1094group by b ' ; 1095execute stmt1 using @arg00; 1096sum(a) + 200 ? 1097210 1 1098204 1 1099201 1 1100203 1 1101202 1 1102set @Oporto='Oporto' ; 1103set @Lisboa='Lisboa' ; 1104set @0=0 ; 1105set @1=1 ; 1106set @2=2 ; 1107set @3=3 ; 1108set @4=4 ; 1109select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; 1110@Oporto @Lisboa @0 @1 @2 @3 @4 1111Oporto Lisboa 0 1 2 3 4 1112select sum(a) + 200 as the_sum, @Oporto as the_town from t1 1113group by b 1114union distinct 1115select sum(a) + 200, @Lisboa from t1 1116group by b ; 1117the_sum the_town 1118204 Oporto 1119201 Oporto 1120203 Oporto 1121202 Oporto 1122204 Lisboa 1123201 Lisboa 1124203 Lisboa 1125202 Lisboa 1126prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 1127 group by b 1128 union distinct 1129 select sum(a) + 200, ? from t1 1130 group by b ' ; 1131execute stmt1 using @Oporto, @Lisboa; 1132the_sum the_town 1133204 Oporto 1134201 Oporto 1135203 Oporto 1136202 Oporto 1137204 Lisboa 1138201 Lisboa 1139203 Lisboa 1140202 Lisboa 1141select sum(a) + 200 as the_sum, @Oporto as the_town from t1 1142where a > @1 1143group by b 1144union distinct 1145select sum(a) + 200, @Lisboa from t1 1146where a > @2 1147group by b ; 1148the_sum the_town 1149204 Oporto 1150203 Oporto 1151202 Oporto 1152204 Lisboa 1153203 Lisboa 1154prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 1155 where a > ? 1156 group by b 1157 union distinct 1158 select sum(a) + 200, ? from t1 1159 where a > ? 1160 group by b ' ; 1161execute stmt1 using @Oporto, @1, @Lisboa, @2; 1162the_sum the_town 1163204 Oporto 1164203 Oporto 1165202 Oporto 1166204 Lisboa 1167203 Lisboa 1168select sum(a) + 200 as the_sum, @Oporto as the_town from t1 1169where a > @1 1170group by b 1171having avg(a) > @2 1172union distinct 1173select sum(a) + 200, @Lisboa from t1 1174where a > @2 1175group by b 1176having avg(a) > @3; 1177the_sum the_town 1178204 Oporto 1179203 Oporto 1180204 Lisboa 1181prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 1182 where a > ? 1183 group by b 1184 having avg(a) > ? 1185 union distinct 1186 select sum(a) + 200, ? from t1 1187 where a > ? 1188 group by b 1189 having avg(a) > ? '; 1190execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; 1191the_sum the_town 1192204 Oporto 1193203 Oporto 1194204 Lisboa 1195test_sequence 1196------ explain select tests ------ 1197prepare stmt1 from ' explain select * from t9 ' ; 1198execute stmt1; 1199Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1200def id 8 3 1 N 32929 0 63 1201def select_type 253 19 6 N 1 31 8 1202def table 253 64 2 Y 0 31 8 1203def type 253 10 3 Y 0 31 8 1204def possible_keys 253 4096 0 Y 0 31 8 1205def key 253 64 0 Y 0 31 8 1206def key_len 253 4096 0 Y 0 31 8 1207def ref 253 1024 0 Y 0 31 8 1208def rows 8 10 1 Y 32928 0 63 1209def Extra 253 255 0 N 1 31 8 1210id select_type table type possible_keys key key_len ref rows Extra 12111 SIMPLE t9 ALL NULL NULL NULL NULL 2 NULL 1212test_sequence 1213------ delete tests ------ 1214delete from t1 ; 1215insert into t1 values (1,'one'); 1216insert into t1 values (2,'two'); 1217insert into t1 values (3,'three'); 1218insert into t1 values (4,'four'); 1219commit ; 1220delete from t9 ; 1221insert into t9 1222set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 1223c10= 1, c11= 1, c12 = 1, 1224c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1225c16= '11:11:11', c17= '2004', 1226c18= 1, c19=true, c20= 'a', c21= '123456789a', 1227c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1228c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1229c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 1230insert into t9 1231set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 1232c10= 9, c11= 9, c12 = 9, 1233c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1234c16= '11:11:11', c17= '2004', 1235c18= 1, c19=false, c20= 'a', c21= '123456789a', 1236c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1237c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1238c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 1239commit ; 1240prepare stmt1 from 'delete from t1 where a=2' ; 1241execute stmt1; 1242select a,b from t1 where a=2; 1243a b 1244execute stmt1; 1245insert into t1 values(0,NULL); 1246set @arg00=NULL; 1247prepare stmt1 from 'delete from t1 where b=?' ; 1248execute stmt1 using @arg00; 1249select a,b from t1 where b is NULL ; 1250a b 12510 NULL 1252set @arg00='one'; 1253execute stmt1 using @arg00; 1254select a,b from t1 where b=@arg00; 1255a b 1256prepare stmt1 from 'truncate table t1' ; 1257test_sequence 1258------ update tests ------ 1259delete from t1 ; 1260insert into t1 values (1,'one'); 1261insert into t1 values (2,'two'); 1262insert into t1 values (3,'three'); 1263insert into t1 values (4,'four'); 1264commit ; 1265delete from t9 ; 1266insert into t9 1267set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 1268c10= 1, c11= 1, c12 = 1, 1269c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1270c16= '11:11:11', c17= '2004', 1271c18= 1, c19=true, c20= 'a', c21= '123456789a', 1272c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1273c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1274c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 1275insert into t9 1276set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 1277c10= 9, c11= 9, c12 = 9, 1278c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1279c16= '11:11:11', c17= '2004', 1280c18= 1, c19=false, c20= 'a', c21= '123456789a', 1281c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1282c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1283c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 1284commit ; 1285prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; 1286execute stmt1; 1287select a,b from t1 where a=2; 1288a b 12892 a=two 1290execute stmt1; 1291select a,b from t1 where a=2; 1292a b 12932 a=two 1294set @arg00=NULL; 1295prepare stmt1 from 'update t1 set b=? where a=2' ; 1296execute stmt1 using @arg00; 1297select a,b from t1 where a=2; 1298a b 12992 NULL 1300set @arg00='two'; 1301execute stmt1 using @arg00; 1302select a,b from t1 where a=2; 1303a b 13042 two 1305set @arg00=2; 1306prepare stmt1 from 'update t1 set b=NULL where a=?' ; 1307execute stmt1 using @arg00; 1308select a,b from t1 where a=@arg00; 1309a b 13102 NULL 1311update t1 set b='two' where a=@arg00; 1312set @arg00=2000; 1313execute stmt1 using @arg00; 1314select a,b from t1 where a=@arg00; 1315a b 1316set @arg00=2; 1317set @arg01=22; 1318prepare stmt1 from 'update t1 set a=? where a=?' ; 1319execute stmt1 using @arg00, @arg00; 1320select a,b from t1 where a=@arg00; 1321a b 13222 two 1323execute stmt1 using @arg01, @arg00; 1324select a,b from t1 where a=@arg01; 1325a b 132622 two 1327execute stmt1 using @arg00, @arg01; 1328select a,b from t1 where a=@arg00; 1329a b 13302 two 1331set @arg00=NULL; 1332set @arg01=2; 1333execute stmt1 using @arg00, @arg01; 1334Warnings: 1335Warning 1048 Column 'a' cannot be null 1336select a,b from t1 order by a; 1337a b 13380 two 13391 one 13403 three 13414 four 1342set @arg00=0; 1343execute stmt1 using @arg01, @arg00; 1344select a,b from t1 order by a; 1345a b 13461 one 13472 two 13483 three 13494 four 1350set @arg00=23; 1351set @arg01='two'; 1352set @arg02=2; 1353set @arg03='two'; 1354set @arg04=2; 1355drop table if exists t2; 1356create table t2 as select a,b from t1 ; 1357prepare stmt1 from 'update t1 set a=? where b=? 1358 and a in (select ? from t2 1359 where b = ? or a = ?)'; 1360execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; 1361affected rows: 1 1362info: Rows matched: 1 Changed: 1 Warnings: 0 1363select a,b from t1 where a = @arg00 ; 1364a b 136523 two 1366prepare stmt1 from 'update t1 set a=? where b=? 1367 and a not in (select ? from t2 1368 where b = ? or a = ?)'; 1369execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; 1370affected rows: 1 1371info: Rows matched: 1 Changed: 1 Warnings: 0 1372select a,b from t1 order by a ; 1373a b 13741 one 13752 two 13763 three 13774 four 1378drop table t2 ; 1379create table t2 1380( 1381a int, b varchar(30), 1382primary key(a) 1383) engine = 'MYISAM' ; 1384insert into t2(a,b) select a, b from t1 ; 1385prepare stmt1 from 'update t1 set a=? where b=? 1386 and a in (select ? from t2 1387 where b = ? or a = ?)'; 1388execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; 1389affected rows: 1 1390info: Rows matched: 1 Changed: 1 Warnings: 0 1391select a,b from t1 where a = @arg00 ; 1392a b 139323 two 1394prepare stmt1 from 'update t1 set a=? where b=? 1395 and a not in (select ? from t2 1396 where b = ? or a = ?)'; 1397execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; 1398affected rows: 1 1399info: Rows matched: 1 Changed: 1 Warnings: 0 1400select a,b from t1 order by a ; 1401a b 14021 one 14032 two 14043 three 14054 four 1406drop table t2 ; 1407set @arg00=1; 1408prepare stmt1 from 'update t1 set b=''bla'' 1409where a=2 1410limit 1'; 1411execute stmt1 ; 1412select a,b from t1 where b = 'bla' ; 1413a b 14142 bla 1415prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; 1416execute stmt1 using @arg00; 1417test_sequence 1418------ insert tests ------ 1419delete from t1 ; 1420insert into t1 values (1,'one'); 1421insert into t1 values (2,'two'); 1422insert into t1 values (3,'three'); 1423insert into t1 values (4,'four'); 1424commit ; 1425delete from t9 ; 1426insert into t9 1427set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 1428c10= 1, c11= 1, c12 = 1, 1429c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1430c16= '11:11:11', c17= '2004', 1431c18= 1, c19=true, c20= 'a', c21= '123456789a', 1432c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1433c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1434c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 1435insert into t9 1436set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 1437c10= 9, c11= 9, c12 = 9, 1438c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1439c16= '11:11:11', c17= '2004', 1440c18= 1, c19=false, c20= 'a', c21= '123456789a', 1441c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1442c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1443c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 1444commit ; 1445prepare stmt1 from 'insert into t1 values(5, ''five'' )'; 1446execute stmt1; 1447select a,b from t1 where a = 5; 1448a b 14495 five 1450set @arg00='six' ; 1451prepare stmt1 from 'insert into t1 values(6, ? )'; 1452execute stmt1 using @arg00; 1453select a,b from t1 where b = @arg00; 1454a b 14556 six 1456execute stmt1 using @arg00; 1457ERROR 23000: Duplicate entry '6' for key 'PRIMARY' 1458set @arg00=NULL ; 1459prepare stmt1 from 'insert into t1 values(0, ? )'; 1460execute stmt1 using @arg00; 1461select a,b from t1 where b is NULL; 1462a b 14630 NULL 1464set @arg00=8 ; 1465set @arg01='eight' ; 1466prepare stmt1 from 'insert into t1 values(?, ? )'; 1467execute stmt1 using @arg00, @arg01 ; 1468select a,b from t1 where b = @arg01; 1469a b 14708 eight 1471set @NULL= null ; 1472set @arg00= 'abc' ; 1473execute stmt1 using @NULL, @NULL ; 1474ERROR 23000: Column 'a' cannot be null 1475execute stmt1 using @NULL, @NULL ; 1476ERROR 23000: Column 'a' cannot be null 1477execute stmt1 using @NULL, @arg00 ; 1478ERROR 23000: Column 'a' cannot be null 1479execute stmt1 using @NULL, @arg00 ; 1480ERROR 23000: Column 'a' cannot be null 1481set @arg01= 10000 + 2 ; 1482execute stmt1 using @arg01, @arg00 ; 1483set @arg01= 10000 + 1 ; 1484execute stmt1 using @arg01, @arg00 ; 1485select * from t1 where a > 10000 order by a ; 1486a b 148710001 abc 148810002 abc 1489delete from t1 where a > 10000 ; 1490set @arg01= 10000 + 2 ; 1491execute stmt1 using @arg01, @NULL ; 1492set @arg01= 10000 + 1 ; 1493execute stmt1 using @arg01, @NULL ; 1494select * from t1 where a > 10000 order by a ; 1495a b 149610001 NULL 149710002 NULL 1498delete from t1 where a > 10000 ; 1499set @arg01= 10000 + 10 ; 1500execute stmt1 using @arg01, @arg01 ; 1501set @arg01= 10000 + 9 ; 1502execute stmt1 using @arg01, @arg01 ; 1503set @arg01= 10000 + 8 ; 1504execute stmt1 using @arg01, @arg01 ; 1505set @arg01= 10000 + 7 ; 1506execute stmt1 using @arg01, @arg01 ; 1507set @arg01= 10000 + 6 ; 1508execute stmt1 using @arg01, @arg01 ; 1509set @arg01= 10000 + 5 ; 1510execute stmt1 using @arg01, @arg01 ; 1511set @arg01= 10000 + 4 ; 1512execute stmt1 using @arg01, @arg01 ; 1513set @arg01= 10000 + 3 ; 1514execute stmt1 using @arg01, @arg01 ; 1515set @arg01= 10000 + 2 ; 1516execute stmt1 using @arg01, @arg01 ; 1517set @arg01= 10000 + 1 ; 1518execute stmt1 using @arg01, @arg01 ; 1519select * from t1 where a > 10000 order by a ; 1520a b 152110001 10001 152210002 10002 152310003 10003 152410004 10004 152510005 10005 152610006 10006 152710007 10007 152810008 10008 152910009 10009 153010010 10010 1531delete from t1 where a > 10000 ; 1532set @arg00=81 ; 1533set @arg01='8-1' ; 1534set @arg02=82 ; 1535set @arg03='8-2' ; 1536prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; 1537execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 1538select a,b from t1 where a in (@arg00,@arg02) ; 1539a b 154081 8-1 154182 8-2 1542set @arg00=9 ; 1543set @arg01='nine' ; 1544prepare stmt1 from 'insert into t1 set a=?, b=? '; 1545execute stmt1 using @arg00, @arg01 ; 1546select a,b from t1 where a = @arg00 ; 1547a b 15489 nine 1549set @arg00=6 ; 1550set @arg01=1 ; 1551prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' 1552 on duplicate key update a=a + ?, b=concat(b,''modified'') '; 1553execute stmt1 using @arg00, @arg01; 1554select * from t1 order by a; 1555a b 15560 NULL 15571 one 15582 two 15593 three 15604 four 15615 five 15627 sixmodified 15638 eight 15649 nine 156581 8-1 156682 8-2 1567set @arg00=81 ; 1568set @arg01=1 ; 1569execute stmt1 using @arg00, @arg01; 1570ERROR 23000: Duplicate entry '82' for key 'PRIMARY' 1571drop table if exists t2 ; 1572create table t2 (id int auto_increment primary key) 1573ENGINE= 'MYISAM' ; 1574prepare stmt1 from ' select last_insert_id() ' ; 1575insert into t2 values (NULL) ; 1576execute stmt1 ; 1577last_insert_id() 15781 1579insert into t2 values (NULL) ; 1580execute stmt1 ; 1581last_insert_id() 15822 1583drop table t2 ; 1584set @1000=1000 ; 1585set @x1000_2="x1000_2" ; 1586set @x1000_3="x1000_3" ; 1587set @x1000="x1000" ; 1588set @1100=1100 ; 1589set @x1100="x1100" ; 1590set @100=100 ; 1591set @updated="updated" ; 1592insert into t1 values(1000,'x1000_1') ; 1593insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) 1594on duplicate key update a = a + @100, b = concat(b,@updated) ; 1595select a,b from t1 where a >= 1000 order by a ; 1596a b 15971000 x1000_3 15981100 x1000_1updated 1599delete from t1 where a >= 1000 ; 1600insert into t1 values(1000,'x1000_1') ; 1601prepare stmt1 from ' insert into t1 values(?,?),(?,?) 1602 on duplicate key update a = a + ?, b = concat(b,?) '; 1603execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; 1604select a,b from t1 where a >= 1000 order by a ; 1605a b 16061000 x1000_3 16071100 x1000_1updated 1608delete from t1 where a >= 1000 ; 1609insert into t1 values(1000,'x1000_1') ; 1610execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; 1611select a,b from t1 where a >= 1000 order by a ; 1612a b 16131200 x1000_1updatedupdated 1614delete from t1 where a >= 1000 ; 1615prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; 1616execute stmt1; 1617execute stmt1; 1618execute stmt1; 1619test_sequence 1620------ multi table tests ------ 1621delete from t1 ; 1622delete from t9 ; 1623insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; 1624insert into t9 (c1,c21) 1625values (1, 'one'), (2, 'two'), (3, 'three') ; 1626prepare stmt_delete from " delete t1, t9 1627 from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; 1628prepare stmt_update from " update t1, t9 1629 set t1.b='updated', t9.c21='updated' 1630 where t1.a=t9.c1 and t1.a=? "; 1631prepare stmt_select1 from " select a, b from t1 order by a" ; 1632prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; 1633set @arg00= 1 ; 1634execute stmt_update using @arg00 ; 1635execute stmt_delete ; 1636execute stmt_select1 ; 1637a b 16382 two 16393 three 1640execute stmt_select2 ; 1641c1 c21 16422 two 16433 three 1644set @arg00= @arg00 + 1 ; 1645execute stmt_update using @arg00 ; 1646execute stmt_delete ; 1647execute stmt_select1 ; 1648a b 16493 three 1650execute stmt_select2 ; 1651c1 c21 16523 three 1653set @arg00= @arg00 + 1 ; 1654execute stmt_update using @arg00 ; 1655execute stmt_delete ; 1656execute stmt_select1 ; 1657a b 1658execute stmt_select2 ; 1659c1 c21 1660set @arg00= @arg00 + 1 ; 1661drop table if exists t5 ; 1662set @arg01= 8; 1663set @arg02= 8.0; 1664set @arg03= 80.00000000000e-1; 1665set @arg04= 'abc' ; 1666set @arg05= CAST('abc' as binary) ; 1667set @arg06= '1991-08-05' ; 1668set @arg07= CAST('1991-08-05' as date); 1669set @arg08= '1991-08-05 01:01:01' ; 1670set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; 1671set @arg10= unix_timestamp('1991-01-01 01:01:01'); 1672set @arg11= YEAR('1991-01-01 01:01:01'); 1673set @arg12= 8 ; 1674set @arg12= NULL ; 1675set @arg13= 8.0 ; 1676set @arg13= NULL ; 1677set @arg14= 'abc'; 1678set @arg14= NULL ; 1679set @arg15= CAST('abc' as binary) ; 1680set @arg15= NULL ; 1681create table t5 as select 16828 as const01, @arg01 as param01, 16838.0 as const02, @arg02 as param02, 168480.00000000000e-1 as const03, @arg03 as param03, 1685'abc' as const04, @arg04 as param04, 1686CAST('abc' as binary) as const05, @arg05 as param05, 1687'1991-08-05' as const06, @arg06 as param06, 1688CAST('1991-08-05' as date) as const07, @arg07 as param07, 1689'1991-08-05 01:01:01' as const08, @arg08 as param08, 1690CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, 1691unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, 1692YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, 1693NULL as const12, @arg12 as param12, 1694@arg13 as param13, 1695@arg14 as param14, 1696@arg15 as param15; 1697show create table t5 ; 1698Table Create Table 1699t5 CREATE TABLE `t5` ( 1700 `const01` int(1) NOT NULL DEFAULT '0', 1701 `param01` bigint(20) DEFAULT NULL, 1702 `const02` decimal(2,1) NOT NULL DEFAULT '0.0', 1703 `param02` decimal(65,30) DEFAULT NULL, 1704 `const03` double NOT NULL DEFAULT '0', 1705 `param03` double DEFAULT NULL, 1706 `const04` varchar(3) NOT NULL DEFAULT '', 1707 `param04` longtext, 1708 `const05` varbinary(3) NOT NULL DEFAULT '', 1709 `param05` longblob, 1710 `const06` varchar(10) NOT NULL DEFAULT '', 1711 `param06` longtext, 1712 `const07` date DEFAULT NULL, 1713 `param07` longtext, 1714 `const08` varchar(19) NOT NULL DEFAULT '', 1715 `param08` longtext, 1716 `const09` datetime DEFAULT NULL, 1717 `param09` longtext, 1718 `const10` int(11) NOT NULL DEFAULT '0', 1719 `param10` bigint(20) DEFAULT NULL, 1720 `const11` int(4) DEFAULT NULL, 1721 `param11` bigint(20) DEFAULT NULL, 1722 `const12` binary(0) DEFAULT NULL, 1723 `param12` bigint(20) DEFAULT NULL, 1724 `param13` decimal(65,30) DEFAULT NULL, 1725 `param14` longtext, 1726 `param15` longblob 1727) ENGINE=MyISAM DEFAULT CHARSET=latin1 1728select * from t5 ; 1729Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1730def test t5 t5 const01 const01 3 1 1 N 32769 0 63 1731def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 1732def test t5 t5 const02 const02 246 4 3 N 32769 1 63 1733def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 1734def test t5 t5 const03 const03 5 17 1 N 32769 31 63 1735def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 1736def test t5 t5 const04 const04 253 3 3 N 1 0 8 1737def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 1738def test t5 t5 const05 const05 253 3 3 N 129 0 63 1739def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 1740def test t5 t5 const06 const06 253 10 10 N 1 0 8 1741def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 1742def test t5 t5 const07 const07 10 10 10 Y 128 0 63 1743def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 1744def test t5 t5 const08 const08 253 19 19 N 1 0 8 1745def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 1746def test t5 t5 const09 const09 12 19 19 Y 128 0 63 1747def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 1748def test t5 t5 const10 const10 3 11 9 N 32769 0 63 1749def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 1750def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 1751def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 1752def test t5 t5 const12 const12 254 0 0 Y 128 0 63 1753def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 1754def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 1755def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 1756def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 1757const01 8 1758param01 8 1759const02 8.0 1760param02 8.000000000000000000000000000000 1761const03 8 1762param03 8 1763const04 abc 1764param04 abc 1765const05 abc 1766param05 abc 1767const06 1991-08-05 1768param06 1991-08-05 1769const07 1991-08-05 1770param07 1991-08-05 1771const08 1991-08-05 01:01:01 1772param08 1991-08-05 01:01:01 1773const09 1991-08-05 01:01:01 1774param09 1991-08-05 01:01:01 1775const10 662680861 1776param10 662680861 1777const11 1991 1778param11 1991 1779const12 NULL 1780param12 NULL 1781param13 NULL 1782param14 NULL 1783param15 NULL 1784drop table t5 ; 1785test_sequence 1786------ data type conversion tests ------ 1787delete from t1 ; 1788insert into t1 values (1,'one'); 1789insert into t1 values (2,'two'); 1790insert into t1 values (3,'three'); 1791insert into t1 values (4,'four'); 1792commit ; 1793delete from t9 ; 1794insert into t9 1795set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 1796c10= 1, c11= 1, c12 = 1, 1797c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1798c16= '11:11:11', c17= '2004', 1799c18= 1, c19=true, c20= 'a', c21= '123456789a', 1800c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1801c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1802c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 1803insert into t9 1804set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 1805c10= 9, c11= 9, c12 = 9, 1806c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 1807c16= '11:11:11', c17= '2004', 1808c18= 1, c19=false, c20= 'a', c21= '123456789a', 1809c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 1810c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 1811c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 1812commit ; 1813insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; 1814select * from t9 order by c1 ; 1815c1 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 18160 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 18171 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 18189 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 1819test_sequence 1820------ select @parameter:= column ------ 1821prepare full_info from "select @arg01, @arg02, @arg03, @arg04, 1822 @arg05, @arg06, @arg07, @arg08, 1823 @arg09, @arg10, @arg11, @arg12, 1824 @arg13, @arg14, @arg15, @arg16, 1825 @arg17, @arg18, @arg19, @arg20, 1826 @arg21, @arg22, @arg23, @arg24, 1827 @arg25, @arg26, @arg27, @arg28, 1828 @arg29, @arg30, @arg31, @arg32" ; 1829select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 1830@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 1831@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 1832@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 1833@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 1834@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 1835@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 1836@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 1837from t9 where c1= 1 ; 1838@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 18391 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 1840execute full_info ; 1841Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1842def @arg01 8 20 1 Y 32896 0 63 1843def @arg02 8 20 1 Y 32896 0 63 1844def @arg03 8 20 1 Y 32896 0 63 1845def @arg04 8 20 1 Y 32896 0 63 1846def @arg05 8 20 1 Y 32896 0 63 1847def @arg06 8 20 1 Y 32896 0 63 1848def @arg07 5 23 1 Y 32896 31 63 1849def @arg08 5 23 1 Y 32896 31 63 1850def @arg09 5 23 1 Y 32896 31 63 1851def @arg10 5 23 1 Y 32896 31 63 1852def @arg11 246 83 6 Y 32896 30 63 1853def @arg12 246 83 6 Y 32896 30 63 1854def @arg13 250 16777215 10 Y 0 31 8 1855def @arg14 250 16777215 19 Y 0 31 8 1856def @arg15 250 16777215 19 Y 0 31 8 1857def @arg16 250 16777215 8 Y 0 31 8 1858def @arg17 8 20 4 Y 32928 0 63 1859def @arg18 8 20 1 Y 32896 0 63 1860def @arg19 8 20 1 Y 32896 0 63 1861def @arg20 250 16777215 1 Y 0 31 8 1862def @arg21 250 16777215 10 Y 0 31 8 1863def @arg22 250 16777215 30 Y 0 31 8 1864def @arg23 250 16777215 8 Y 128 31 63 1865def @arg24 250 16777215 8 Y 0 31 8 1866def @arg25 250 16777215 4 Y 128 31 63 1867def @arg26 250 16777215 4 Y 0 31 8 1868def @arg27 250 16777215 10 Y 128 31 63 1869def @arg28 250 16777215 10 Y 0 31 8 1870def @arg29 250 16777215 8 Y 128 31 63 1871def @arg30 250 16777215 8 Y 0 31 8 1872def @arg31 250 16777215 3 Y 0 31 8 1873def @arg32 250 16777215 6 Y 0 31 8 1874@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 18751 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 1876select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 1877@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 1878@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 1879@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 1880@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 1881@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 1882@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 1883@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 1884from t9 where c1= 0 ; 1885@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 18860 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 1887execute full_info ; 1888Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1889def @arg01 8 20 1 Y 32896 0 63 1890def @arg02 8 20 0 Y 32896 0 63 1891def @arg03 8 20 0 Y 32896 0 63 1892def @arg04 8 20 0 Y 32896 0 63 1893def @arg05 8 20 0 Y 32896 0 63 1894def @arg06 8 20 0 Y 32896 0 63 1895def @arg07 5 23 0 Y 32896 31 63 1896def @arg08 5 23 0 Y 32896 31 63 1897def @arg09 5 23 0 Y 32896 31 63 1898def @arg10 5 23 0 Y 32896 31 63 1899def @arg11 246 83 0 Y 32896 30 63 1900def @arg12 246 83 0 Y 32896 30 63 1901def @arg13 250 16777215 0 Y 0 31 8 1902def @arg14 250 16777215 0 Y 0 31 8 1903def @arg15 250 16777215 19 Y 0 31 8 1904def @arg16 250 16777215 0 Y 0 31 8 1905def @arg17 8 20 0 Y 32928 0 63 1906def @arg18 8 20 0 Y 32896 0 63 1907def @arg19 8 20 0 Y 32896 0 63 1908def @arg20 250 16777215 0 Y 0 31 8 1909def @arg21 250 16777215 0 Y 0 31 8 1910def @arg22 250 16777215 0 Y 0 31 8 1911def @arg23 250 16777215 0 Y 128 31 63 1912def @arg24 250 16777215 0 Y 0 31 8 1913def @arg25 250 16777215 0 Y 128 31 63 1914def @arg26 250 16777215 0 Y 0 31 8 1915def @arg27 250 16777215 0 Y 128 31 63 1916def @arg28 250 16777215 0 Y 0 31 8 1917def @arg29 250 16777215 0 Y 128 31 63 1918def @arg30 250 16777215 0 Y 0 31 8 1919def @arg31 250 16777215 0 Y 0 31 8 1920def @arg32 250 16777215 0 Y 0 31 8 1921@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 19220 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 1923prepare stmt1 from "select 1924 @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 1925 @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 1926 @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 1927 @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 1928 @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 1929 @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 1930 @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 1931 @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 1932from t9 where c1= ?" ; 1933set @my_key= 1 ; 1934execute stmt1 using @my_key ; 1935@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 19361 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 1937execute full_info ; 1938Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1939def @arg01 8 20 1 Y 32896 0 63 1940def @arg02 8 20 1 Y 32896 0 63 1941def @arg03 8 20 1 Y 32896 0 63 1942def @arg04 8 20 1 Y 32896 0 63 1943def @arg05 8 20 1 Y 32896 0 63 1944def @arg06 8 20 1 Y 32896 0 63 1945def @arg07 5 23 1 Y 32896 31 63 1946def @arg08 5 23 1 Y 32896 31 63 1947def @arg09 5 23 1 Y 32896 31 63 1948def @arg10 5 23 1 Y 32896 31 63 1949def @arg11 246 83 6 Y 32896 30 63 1950def @arg12 246 83 6 Y 32896 30 63 1951def @arg13 250 16777215 10 Y 0 31 8 1952def @arg14 250 16777215 19 Y 0 31 8 1953def @arg15 250 16777215 19 Y 0 31 8 1954def @arg16 250 16777215 8 Y 0 31 8 1955def @arg17 8 20 4 Y 32928 0 63 1956def @arg18 8 20 1 Y 32896 0 63 1957def @arg19 8 20 1 Y 32896 0 63 1958def @arg20 250 16777215 1 Y 0 31 8 1959def @arg21 250 16777215 10 Y 0 31 8 1960def @arg22 250 16777215 30 Y 0 31 8 1961def @arg23 250 16777215 8 Y 128 31 63 1962def @arg24 250 16777215 8 Y 0 31 8 1963def @arg25 250 16777215 4 Y 128 31 63 1964def @arg26 250 16777215 4 Y 0 31 8 1965def @arg27 250 16777215 10 Y 128 31 63 1966def @arg28 250 16777215 10 Y 0 31 8 1967def @arg29 250 16777215 8 Y 128 31 63 1968def @arg30 250 16777215 8 Y 0 31 8 1969def @arg31 250 16777215 3 Y 0 31 8 1970def @arg32 250 16777215 6 Y 0 31 8 1971@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 19721 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 1973set @my_key= 0 ; 1974execute stmt1 using @my_key ; 1975@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 19760 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 1977execute full_info ; 1978Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 1979def @arg01 8 20 1 Y 32896 0 63 1980def @arg02 8 20 0 Y 32896 0 63 1981def @arg03 8 20 0 Y 32896 0 63 1982def @arg04 8 20 0 Y 32896 0 63 1983def @arg05 8 20 0 Y 32896 0 63 1984def @arg06 8 20 0 Y 32896 0 63 1985def @arg07 5 23 0 Y 32896 31 63 1986def @arg08 5 23 0 Y 32896 31 63 1987def @arg09 5 23 0 Y 32896 31 63 1988def @arg10 5 23 0 Y 32896 31 63 1989def @arg11 246 83 0 Y 32896 30 63 1990def @arg12 246 83 0 Y 32896 30 63 1991def @arg13 250 16777215 0 Y 0 31 8 1992def @arg14 250 16777215 0 Y 0 31 8 1993def @arg15 250 16777215 19 Y 0 31 8 1994def @arg16 250 16777215 0 Y 0 31 8 1995def @arg17 8 20 0 Y 32928 0 63 1996def @arg18 8 20 0 Y 32896 0 63 1997def @arg19 8 20 0 Y 32896 0 63 1998def @arg20 250 16777215 0 Y 0 31 8 1999def @arg21 250 16777215 0 Y 0 31 8 2000def @arg22 250 16777215 0 Y 0 31 8 2001def @arg23 250 16777215 0 Y 128 31 63 2002def @arg24 250 16777215 0 Y 0 31 8 2003def @arg25 250 16777215 0 Y 128 31 63 2004def @arg26 250 16777215 0 Y 0 31 8 2005def @arg27 250 16777215 0 Y 128 31 63 2006def @arg28 250 16777215 0 Y 0 31 8 2007def @arg29 250 16777215 0 Y 128 31 63 2008def @arg30 250 16777215 0 Y 0 31 8 2009def @arg31 250 16777215 0 Y 0 31 8 2010def @arg32 250 16777215 0 Y 0 31 8 2011@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 20120 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 2013prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; 2014ERROR 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 2015test_sequence 2016------ select column, .. into @parm,.. ------ 2017select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 2018c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 2019c25, c26, c27, c28, c29, c30, c31, c32 2020into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 2021@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 2022@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 2023@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 2024from t9 where c1= 1 ; 2025execute full_info ; 2026Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 2027def @arg01 8 20 1 Y 32896 0 63 2028def @arg02 8 20 1 Y 32896 0 63 2029def @arg03 8 20 1 Y 32896 0 63 2030def @arg04 8 20 1 Y 32896 0 63 2031def @arg05 8 20 1 Y 32896 0 63 2032def @arg06 8 20 1 Y 32896 0 63 2033def @arg07 5 23 1 Y 32896 31 63 2034def @arg08 5 23 1 Y 32896 31 63 2035def @arg09 5 23 1 Y 32896 31 63 2036def @arg10 5 23 1 Y 32896 31 63 2037def @arg11 246 83 6 Y 32896 30 63 2038def @arg12 246 83 6 Y 32896 30 63 2039def @arg13 250 16777215 10 Y 0 31 8 2040def @arg14 250 16777215 19 Y 0 31 8 2041def @arg15 250 16777215 19 Y 0 31 8 2042def @arg16 250 16777215 8 Y 0 31 8 2043def @arg17 8 20 4 Y 32928 0 63 2044def @arg18 8 20 1 Y 32896 0 63 2045def @arg19 8 20 1 Y 32896 0 63 2046def @arg20 250 16777215 1 Y 0 31 8 2047def @arg21 250 16777215 10 Y 0 31 8 2048def @arg22 250 16777215 30 Y 0 31 8 2049def @arg23 250 16777215 8 Y 128 31 63 2050def @arg24 250 16777215 8 Y 0 31 8 2051def @arg25 250 16777215 4 Y 128 31 63 2052def @arg26 250 16777215 4 Y 0 31 8 2053def @arg27 250 16777215 10 Y 128 31 63 2054def @arg28 250 16777215 10 Y 0 31 8 2055def @arg29 250 16777215 8 Y 128 31 63 2056def @arg30 250 16777215 8 Y 0 31 8 2057def @arg31 250 16777215 3 Y 0 31 8 2058def @arg32 250 16777215 6 Y 0 31 8 2059@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 20601 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 2061select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 2062c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 2063c25, c26, c27, c28, c29, c30, c31, c32 2064into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 2065@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 2066@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 2067@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 2068from t9 where c1= 0 ; 2069execute full_info ; 2070Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 2071def @arg01 8 20 1 Y 32896 0 63 2072def @arg02 8 20 0 Y 32896 0 63 2073def @arg03 8 20 0 Y 32896 0 63 2074def @arg04 8 20 0 Y 32896 0 63 2075def @arg05 8 20 0 Y 32896 0 63 2076def @arg06 8 20 0 Y 32896 0 63 2077def @arg07 5 23 0 Y 32896 31 63 2078def @arg08 5 23 0 Y 32896 31 63 2079def @arg09 5 23 0 Y 32896 31 63 2080def @arg10 5 23 0 Y 32896 31 63 2081def @arg11 246 83 0 Y 32896 30 63 2082def @arg12 246 83 0 Y 32896 30 63 2083def @arg13 250 16777215 0 Y 0 31 8 2084def @arg14 250 16777215 0 Y 0 31 8 2085def @arg15 250 16777215 19 Y 0 31 8 2086def @arg16 250 16777215 0 Y 0 31 8 2087def @arg17 8 20 0 Y 32928 0 63 2088def @arg18 8 20 0 Y 32896 0 63 2089def @arg19 8 20 0 Y 32896 0 63 2090def @arg20 250 16777215 0 Y 0 31 8 2091def @arg21 250 16777215 0 Y 0 31 8 2092def @arg22 250 16777215 0 Y 0 31 8 2093def @arg23 250 16777215 0 Y 128 31 63 2094def @arg24 250 16777215 0 Y 0 31 8 2095def @arg25 250 16777215 0 Y 128 31 63 2096def @arg26 250 16777215 0 Y 0 31 8 2097def @arg27 250 16777215 0 Y 128 31 63 2098def @arg28 250 16777215 0 Y 0 31 8 2099def @arg29 250 16777215 0 Y 128 31 63 2100def @arg30 250 16777215 0 Y 0 31 8 2101def @arg31 250 16777215 0 Y 0 31 8 2102def @arg32 250 16777215 0 Y 0 31 8 2103@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 21040 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 2105prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 2106 c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 2107 c25, c26, c27, c28, c29, c30, c31, c32 2108into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 2109 @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 2110 @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 2111 @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 2112from t9 where c1= ?" ; 2113set @my_key= 1 ; 2114execute stmt1 using @my_key ; 2115execute full_info ; 2116Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 2117def @arg01 8 20 1 Y 32896 0 63 2118def @arg02 8 20 1 Y 32896 0 63 2119def @arg03 8 20 1 Y 32896 0 63 2120def @arg04 8 20 1 Y 32896 0 63 2121def @arg05 8 20 1 Y 32896 0 63 2122def @arg06 8 20 1 Y 32896 0 63 2123def @arg07 5 23 1 Y 32896 31 63 2124def @arg08 5 23 1 Y 32896 31 63 2125def @arg09 5 23 1 Y 32896 31 63 2126def @arg10 5 23 1 Y 32896 31 63 2127def @arg11 246 83 6 Y 32896 30 63 2128def @arg12 246 83 6 Y 32896 30 63 2129def @arg13 250 16777215 10 Y 0 31 8 2130def @arg14 250 16777215 19 Y 0 31 8 2131def @arg15 250 16777215 19 Y 0 31 8 2132def @arg16 250 16777215 8 Y 0 31 8 2133def @arg17 8 20 4 Y 32928 0 63 2134def @arg18 8 20 1 Y 32896 0 63 2135def @arg19 8 20 1 Y 32896 0 63 2136def @arg20 250 16777215 1 Y 0 31 8 2137def @arg21 250 16777215 10 Y 0 31 8 2138def @arg22 250 16777215 30 Y 0 31 8 2139def @arg23 250 16777215 8 Y 128 31 63 2140def @arg24 250 16777215 8 Y 0 31 8 2141def @arg25 250 16777215 4 Y 128 31 63 2142def @arg26 250 16777215 4 Y 0 31 8 2143def @arg27 250 16777215 10 Y 128 31 63 2144def @arg28 250 16777215 10 Y 0 31 8 2145def @arg29 250 16777215 8 Y 128 31 63 2146def @arg30 250 16777215 8 Y 0 31 8 2147def @arg31 250 16777215 3 Y 0 31 8 2148def @arg32 250 16777215 6 Y 0 31 8 2149@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 21501 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 2151set @my_key= 0 ; 2152execute stmt1 using @my_key ; 2153execute full_info ; 2154Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 2155def @arg01 8 20 1 Y 32896 0 63 2156def @arg02 8 20 0 Y 32896 0 63 2157def @arg03 8 20 0 Y 32896 0 63 2158def @arg04 8 20 0 Y 32896 0 63 2159def @arg05 8 20 0 Y 32896 0 63 2160def @arg06 8 20 0 Y 32896 0 63 2161def @arg07 5 23 0 Y 32896 31 63 2162def @arg08 5 23 0 Y 32896 31 63 2163def @arg09 5 23 0 Y 32896 31 63 2164def @arg10 5 23 0 Y 32896 31 63 2165def @arg11 246 83 0 Y 32896 30 63 2166def @arg12 246 83 0 Y 32896 30 63 2167def @arg13 250 16777215 0 Y 0 31 8 2168def @arg14 250 16777215 0 Y 0 31 8 2169def @arg15 250 16777215 19 Y 0 31 8 2170def @arg16 250 16777215 0 Y 0 31 8 2171def @arg17 8 20 0 Y 32928 0 63 2172def @arg18 8 20 0 Y 32896 0 63 2173def @arg19 8 20 0 Y 32896 0 63 2174def @arg20 250 16777215 0 Y 0 31 8 2175def @arg21 250 16777215 0 Y 0 31 8 2176def @arg22 250 16777215 0 Y 0 31 8 2177def @arg23 250 16777215 0 Y 128 31 63 2178def @arg24 250 16777215 0 Y 0 31 8 2179def @arg25 250 16777215 0 Y 128 31 63 2180def @arg26 250 16777215 0 Y 0 31 8 2181def @arg27 250 16777215 0 Y 128 31 63 2182def @arg28 250 16777215 0 Y 0 31 8 2183def @arg29 250 16777215 0 Y 128 31 63 2184def @arg30 250 16777215 0 Y 0 31 8 2185def @arg31 250 16777215 0 Y 0 31 8 2186def @arg32 250 16777215 0 Y 0 31 8 2187@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 21880 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 2189prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; 2190ERROR 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 2191test_sequence 2192-- insert into numeric columns -- 2193insert into t9 2194( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2195values 2196( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; 2197set @arg00= 21 ; 2198insert into t9 2199( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2200values 2201( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2202@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2203prepare stmt1 from "insert into t9 2204 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2205values 2206 ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; 2207execute stmt1 ; 2208set @arg00= 23; 2209prepare stmt2 from "insert into t9 2210 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2211values 2212 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2213execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2214@arg00, @arg00, @arg00, @arg00 ; 2215insert into t9 2216( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2217values 2218( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 221930.0, 30.0, 30.0 ) ; 2220set @arg00= 31.0 ; 2221insert into t9 2222( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2223values 2224( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2225@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2226prepare stmt1 from "insert into t9 2227 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2228values 2229 ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 2230 32.0, 32.0, 32.0 )" ; 2231execute stmt1 ; 2232set @arg00= 33.0; 2233prepare stmt2 from "insert into t9 2234 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2235values 2236 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2237execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2238@arg00, @arg00, @arg00, @arg00 ; 2239insert into t9 2240( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2241values 2242( '40', '40', '40', '40', '40', '40', '40', '40', 2243'40', '40', '40' ) ; 2244set @arg00= '41' ; 2245insert into t9 2246( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2247values 2248( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2249@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2250prepare stmt1 from "insert into t9 2251 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2252values 2253 ( '42', '42', '42', '42', '42', '42', '42', '42', 2254 '42', '42', '42' )" ; 2255execute stmt1 ; 2256set @arg00= '43'; 2257prepare stmt2 from "insert into t9 2258 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2259values 2260 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2261execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2262@arg00, @arg00, @arg00, @arg00 ; 2263insert into t9 2264( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2265values 2266( CAST('50' as binary), CAST('50' as binary), 2267CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 2268CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 2269CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; 2270set @arg00= CAST('51' as binary) ; 2271insert into t9 2272( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2273values 2274( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2275@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2276prepare stmt1 from "insert into t9 2277 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2278values 2279 ( CAST('52' as binary), CAST('52' as binary), 2280 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 2281 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 2282 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; 2283execute stmt1 ; 2284set @arg00= CAST('53' as binary) ; 2285prepare stmt2 from "insert into t9 2286 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2287values 2288 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2289execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2290@arg00, @arg00, @arg00, @arg00 ; 2291set @arg00= 2 ; 2292set @arg00= NULL ; 2293insert into t9 2294( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2295values 2296( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2297NULL, NULL, NULL ) ; 2298insert into t9 2299( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2300values 2301( 61, @arg00, @arg00, @arg00, @arg00, @arg00, 2302@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2303prepare stmt1 from "insert into t9 2304 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2305values 2306 ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2307 NULL, NULL, NULL )" ; 2308execute stmt1 ; 2309prepare stmt2 from "insert into t9 2310 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2311values 2312 ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2313execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2314@arg00, @arg00, @arg00, @arg00 ; 2315set @arg00= 8.0 ; 2316set @arg00= NULL ; 2317insert into t9 2318( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2319values 2320( 71, @arg00, @arg00, @arg00, @arg00, @arg00, 2321@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2322prepare stmt2 from "insert into t9 2323 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2324values 2325 ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2326execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2327@arg00, @arg00, @arg00, @arg00 ; 2328set @arg00= 'abc' ; 2329set @arg00= NULL ; 2330insert into t9 2331( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2332values 2333( 81, @arg00, @arg00, @arg00, @arg00, @arg00, 2334@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 2335prepare stmt2 from "insert into t9 2336 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2337values 2338 ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2339execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2340@arg00, @arg00, @arg00, @arg00 ; 2341select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 2342from t9 where c1 >= 20 2343order by c1 ; 2344c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 234520 20 20 20 20 20 20 20 20 20 20.0000 234621 21 21 21 21 21 21 21 21 21 21.0000 234722 22 22 22 22 22 22 22 22 22 22.0000 234823 23 23 23 23 23 23 23 23 23 23.0000 234930 30 30 30 30 30 30 30 30 30 30.0000 235031 31 31 31 31 31 31 31 31 31 31.0000 235132 32 32 32 32 32 32 32 32 32 32.0000 235233 33 33 33 33 33 33 33 33 33 33.0000 235340 40 40 40 40 40 40 40 40 40 40.0000 235441 41 41 41 41 41 41 41 41 41 41.0000 235542 42 42 42 42 42 42 42 42 42 42.0000 235643 43 43 43 43 43 43 43 43 43 43.0000 235750 50 50 50 50 50 50 50 50 50 50.0000 235851 51 51 51 51 51 51 51 51 51 51.0000 235952 52 52 52 52 52 52 52 52 52 52.0000 236053 53 53 53 53 53 53 53 53 53 53.0000 236160 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236261 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236362 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236463 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236571 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236673 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236781 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 236883 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2369test_sequence 2370-- select .. where numeric column = .. -- 2371set @arg00= 20; 2372select 'true' as found from t9 2373where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 2374and c8= 20 and c9= 20 and c10= 20 and c12= 20; 2375found 2376true 2377select 'true' as found from t9 2378where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 2379and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 2380and c12= @arg00; 2381found 2382true 2383prepare stmt1 from "select 'true' as found from t9 2384where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 2385 and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; 2386execute stmt1 ; 2387found 2388true 2389prepare stmt1 from "select 'true' as found from t9 2390where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 2391 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 2392 and c12= ? "; 2393execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2394@arg00, @arg00, @arg00, @arg00 ; 2395found 2396true 2397set @arg00= 20.0; 2398select 'true' as found from t9 2399where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 2400and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; 2401found 2402true 2403select 'true' as found from t9 2404where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 2405and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 2406and c12= @arg00; 2407found 2408true 2409prepare stmt1 from "select 'true' as found from t9 2410where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 2411 and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; 2412execute stmt1 ; 2413found 2414true 2415prepare stmt1 from "select 'true' as found from t9 2416where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 2417 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 2418 and c12= ? "; 2419execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2420@arg00, @arg00, @arg00, @arg00 ; 2421found 2422true 2423select 'true' as found from t9 2424where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' 2425 and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; 2426found 2427true 2428prepare stmt1 from "select 'true' as found from t9 2429where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' 2430 and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; 2431execute stmt1 ; 2432found 2433true 2434set @arg00= '20'; 2435select 'true' as found from t9 2436where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 2437and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 2438and c12= @arg00; 2439found 2440true 2441prepare stmt1 from "select 'true' as found from t9 2442where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 2443 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 2444 and c12= ? "; 2445execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2446@arg00, @arg00, @arg00, @arg00 ; 2447found 2448true 2449select 'true' as found from t9 2450where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 2451c3= CAST('20' as binary) and c4= CAST('20' as binary) and 2452c5= CAST('20' as binary) and c6= CAST('20' as binary) and 2453c7= CAST('20' as binary) and c8= CAST('20' as binary) and 2454c9= CAST('20' as binary) and c10= CAST('20' as binary) and 2455c12= CAST('20' as binary); 2456found 2457true 2458prepare stmt1 from "select 'true' as found from t9 2459where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 2460 c3= CAST('20' as binary) and c4= CAST('20' as binary) and 2461 c5= CAST('20' as binary) and c6= CAST('20' as binary) and 2462 c7= CAST('20' as binary) and c8= CAST('20' as binary) and 2463 c9= CAST('20' as binary) and c10= CAST('20' as binary) and 2464 c12= CAST('20' as binary) "; 2465execute stmt1 ; 2466found 2467true 2468set @arg00= CAST('20' as binary) ; 2469select 'true' as found from t9 2470where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 2471and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 2472and c12= @arg00; 2473found 2474true 2475prepare stmt1 from "select 'true' as found from t9 2476where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 2477 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 2478 and c12= ? "; 2479execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2480@arg00, @arg00, @arg00, @arg00 ; 2481found 2482true 2483delete from t9 ; 2484test_sequence 2485-- some numeric overflow experiments -- 2486prepare my_insert from "insert into t9 2487 ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 2488values 2489 ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 2490prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 2491from t9 where c21 = 'O' "; 2492prepare my_delete from "delete from t9 where c21 = 'O' "; 2493set @arg00= 9223372036854775807 ; 2494execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2495@arg00, @arg00, @arg00, @arg00, @arg00 ; 2496Warnings: 2497Warning 1264 Out of range value for column 'c1' at row 1 2498Warning 1264 Out of range value for column 'c2' at row 1 2499Warning 1264 Out of range value for column 'c3' at row 1 2500Warning 1264 Out of range value for column 'c4' at row 1 2501Warning 1264 Out of range value for column 'c5' at row 1 2502Warning 1264 Out of range value for column 'c12' at row 1 2503execute my_select ; 2504c1 127 2505c2 32767 2506c3 8388607 2507c4 2147483647 2508c5 2147483647 2509c6 9223372036854775807 2510c7 9.22337e18 2511c8 9.223372036854776e18 2512c9 9.223372036854776e18 2513c10 9.223372036854776e18 2514c12 9999.9999 2515execute my_delete ; 2516set @arg00= '9223372036854775807' ; 2517execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2518@arg00, @arg00, @arg00, @arg00, @arg00 ; 2519Warnings: 2520Warning 1264 Out of range value for column 'c1' at row 1 2521Warning 1264 Out of range value for column 'c2' at row 1 2522Warning 1264 Out of range value for column 'c3' at row 1 2523Warning 1264 Out of range value for column 'c4' at row 1 2524Warning 1264 Out of range value for column 'c5' at row 1 2525Warning 1264 Out of range value for column 'c12' at row 1 2526execute my_select ; 2527c1 127 2528c2 32767 2529c3 8388607 2530c4 2147483647 2531c5 2147483647 2532c6 9223372036854775807 2533c7 9.22337e18 2534c8 9.223372036854776e18 2535c9 9.223372036854776e18 2536c10 9.223372036854776e18 2537c12 9999.9999 2538execute my_delete ; 2539set @arg00= -9223372036854775808 ; 2540execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2541@arg00, @arg00, @arg00, @arg00, @arg00 ; 2542Warnings: 2543Warning 1264 Out of range value for column 'c1' at row 1 2544Warning 1264 Out of range value for column 'c2' at row 1 2545Warning 1264 Out of range value for column 'c3' at row 1 2546Warning 1264 Out of range value for column 'c4' at row 1 2547Warning 1264 Out of range value for column 'c5' at row 1 2548Warning 1264 Out of range value for column 'c12' at row 1 2549execute my_select ; 2550c1 -128 2551c2 -32768 2552c3 -8388608 2553c4 -2147483648 2554c5 -2147483648 2555c6 -9223372036854775808 2556c7 -9.22337e18 2557c8 -9.223372036854776e18 2558c9 -9.223372036854776e18 2559c10 -9.223372036854776e18 2560c12 -9999.9999 2561execute my_delete ; 2562set @arg00= '-9223372036854775808' ; 2563execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2564@arg00, @arg00, @arg00, @arg00, @arg00 ; 2565Warnings: 2566Warning 1264 Out of range value for column 'c1' at row 1 2567Warning 1264 Out of range value for column 'c2' at row 1 2568Warning 1264 Out of range value for column 'c3' at row 1 2569Warning 1264 Out of range value for column 'c4' at row 1 2570Warning 1264 Out of range value for column 'c5' at row 1 2571Warning 1264 Out of range value for column 'c12' at row 1 2572execute my_select ; 2573c1 -128 2574c2 -32768 2575c3 -8388608 2576c4 -2147483648 2577c5 -2147483648 2578c6 -9223372036854775808 2579c7 -9.22337e18 2580c8 -9.223372036854776e18 2581c9 -9.223372036854776e18 2582c10 -9.223372036854776e18 2583c12 -9999.9999 2584execute my_delete ; 2585set @arg00= 1.11111111111111111111e+50 ; 2586execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2587@arg00, @arg00, @arg00, @arg00, @arg00 ; 2588Warnings: 2589Warning 1264 Out of range value for column 'c1' at row 1 2590Warning 1264 Out of range value for column 'c2' at row 1 2591Warning 1264 Out of range value for column 'c3' at row 1 2592Warning 1264 Out of range value for column 'c4' at row 1 2593Warning 1264 Out of range value for column 'c5' at row 1 2594Warning 1264 Out of range value for column 'c6' at row 1 2595Warning 1264 Out of range value for column 'c7' at row 1 2596Warning 1264 Out of range value for column 'c12' at row 1 2597execute my_select ; 2598c1 127 2599c2 32767 2600c3 8388607 2601c4 2147483647 2602c5 2147483647 2603c6 9223372036854775807 2604c7 3.40282e38 2605c8 1.111111111111111e50 2606c9 1.111111111111111e50 2607c10 1.111111111111111e50 2608c12 9999.9999 2609execute my_delete ; 2610set @arg00= '1.11111111111111111111e+50' ; 2611execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2612@arg00, @arg00, @arg00, @arg00, @arg00 ; 2613Warnings: 2614Warning 1264 Out of range value for column 'c1' at row 1 2615Warning 1264 Out of range value for column 'c2' at row 1 2616Warning 1264 Out of range value for column 'c3' at row 1 2617Warning 1264 Out of range value for column 'c4' at row 1 2618Warning 1264 Out of range value for column 'c5' at row 1 2619Warning 1264 Out of range value for column 'c6' at row 1 2620Warning 1264 Out of range value for column 'c7' at row 1 2621Warning 1264 Out of range value for column 'c12' at row 1 2622execute my_select ; 2623c1 127 2624c2 32767 2625c3 8388607 2626c4 2147483647 2627c5 2147483647 2628c6 9223372036854775807 2629c7 3.40282e38 2630c8 1.111111111111111e50 2631c9 1.111111111111111e50 2632c10 1.111111111111111e50 2633c12 9999.9999 2634execute my_delete ; 2635set @arg00= -1.11111111111111111111e+50 ; 2636execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2637@arg00, @arg00, @arg00, @arg00, @arg00 ; 2638Warnings: 2639Warning 1264 Out of range value for column 'c1' at row 1 2640Warning 1264 Out of range value for column 'c2' at row 1 2641Warning 1264 Out of range value for column 'c3' at row 1 2642Warning 1264 Out of range value for column 'c4' at row 1 2643Warning 1264 Out of range value for column 'c5' at row 1 2644Warning 1264 Out of range value for column 'c6' at row 1 2645Warning 1264 Out of range value for column 'c7' at row 1 2646Warning 1264 Out of range value for column 'c12' at row 1 2647execute my_select ; 2648c1 -128 2649c2 -32768 2650c3 -8388608 2651c4 -2147483648 2652c5 -2147483648 2653c6 -9223372036854775808 2654c7 -3.40282e38 2655c8 -1.111111111111111e50 2656c9 -1.111111111111111e50 2657c10 -1.111111111111111e50 2658c12 -9999.9999 2659execute my_delete ; 2660set @arg00= '-1.11111111111111111111e+50' ; 2661execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2662@arg00, @arg00, @arg00, @arg00, @arg00 ; 2663Warnings: 2664Warning 1264 Out of range value for column 'c1' at row 1 2665Warning 1264 Out of range value for column 'c2' at row 1 2666Warning 1264 Out of range value for column 'c3' at row 1 2667Warning 1264 Out of range value for column 'c4' at row 1 2668Warning 1264 Out of range value for column 'c5' at row 1 2669Warning 1264 Out of range value for column 'c6' at row 1 2670Warning 1264 Out of range value for column 'c7' at row 1 2671Warning 1264 Out of range value for column 'c12' at row 1 2672execute my_select ; 2673c1 -128 2674c2 -32768 2675c3 -8388608 2676c4 -2147483648 2677c5 -2147483648 2678c6 -9223372036854775808 2679c7 -3.40282e38 2680c8 -1.111111111111111e50 2681c9 -1.111111111111111e50 2682c10 -1.111111111111111e50 2683c12 -9999.9999 2684execute my_delete ; 2685test_sequence 2686-- insert into string columns -- 2687Warnings: 2688Warning 1265 Data truncated for column 'c20' at row 1 2689Warnings: 2690Warning 1265 Data truncated for column 'c20' at row 1 2691Warnings: 2692Warning 1265 Data truncated for column 'c20' at row 1 2693Warnings: 2694Warning 1265 Data truncated for column 'c20' at row 1 2695Warnings: 2696Warning 1265 Data truncated for column 'c20' at row 1 2697Warnings: 2698Warning 1265 Data truncated for column 'c20' at row 1 2699Warnings: 2700Warning 1265 Data truncated for column 'c20' at row 1 2701Warnings: 2702Warning 1265 Data truncated for column 'c20' at row 1 2703Warnings: 2704Warning 1265 Data truncated for column 'c20' at row 1 2705Warnings: 2706Warning 1265 Data truncated for column 'c20' at row 1 2707Warnings: 2708Warning 1265 Data truncated for column 'c20' at row 1 2709Warnings: 2710Warning 1265 Data truncated for column 'c20' at row 1 2711Warnings: 2712Warning 1265 Data truncated for column 'c20' at row 1 2713Warnings: 2714Warning 1265 Data truncated for column 'c20' at row 1 2715Warnings: 2716Warning 1265 Data truncated for column 'c20' at row 1 2717Warnings: 2718Warning 1265 Data truncated for column 'c20' at row 1 2719Warnings: 2720Warning 1265 Data truncated for column 'c20' at row 1 2721Warnings: 2722Warning 1265 Data truncated for column 'c20' at row 1 2723Warnings: 2724Warning 1265 Data truncated for column 'c20' at row 1 2725Warnings: 2726Warning 1265 Data truncated for column 'c20' at row 1 2727select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 2728from t9 where c1 >= 20 2729order by c1 ; 2730c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 273120 2 20 20 20 20 20 20 20 20 20 20 273221 2 21 21 21 21 21 21 21 21 21 21 273322 2 22 22 22 22 22 22 22 22 22 22 273423 2 23 23 23 23 23 23 23 23 23 23 273530 3 30 30 30 30 30 30 30 30 30 30 273631 3 31 31 31 31 31 31 31 31 31 31 273732 3 32 32 32 32 32 32 32 32 32 32 273833 3 33 33 33 33 33 33 33 33 33 33 273940 4 40 40 40 40 40 40 40 40 40 40 274041 4 41 41 41 41 41 41 41 41 41 41 274142 4 42 42 42 42 42 42 42 42 42 42 274243 4 43 43 43 43 43 43 43 43 43 43 274350 5 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 274451 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 274552 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 274653 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 274754 5 54 54 54 54 54 54 54 54 54 54 274855 6 55 55 55 55 55 55 55 55 55 55 274956 6 56 56 56 56 56 56 56 56 56 56 275057 6 57 57 57 57 57 57 57 57 57 57 275160 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275261 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275362 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275463 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275571 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275673 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275781 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 275883 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2759test_sequence 2760-- select .. where string column = .. -- 2761set @arg00= '20'; 2762select 'true' as found from t9 2763where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and 2764c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and 2765c27= '20' and c28= '20' and c29= '20' and c30= '20' ; 2766found 2767true 2768select 'true' as found from t9 2769where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 2770c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 2771c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 2772found 2773true 2774prepare stmt1 from "select 'true' as found from t9 2775where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and 2776 c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and 2777 c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; 2778execute stmt1 ; 2779found 2780true 2781prepare stmt1 from "select 'true' as found from t9 2782where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 2783 c21= ? and c22= ? and c23= ? and c25= ? and 2784 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 2785execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2786@arg00, @arg00, @arg00, @arg00, @arg00 ; 2787found 2788true 2789set @arg00= CAST('20' as binary); 2790select 'true' as found from t9 2791where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) 2792= CAST('20' as binary) and c21= CAST('20' as binary) 2793and c22= CAST('20' as binary) and c23= CAST('20' as binary) and 2794c24= CAST('20' as binary) and c25= CAST('20' as binary) and 2795c26= CAST('20' as binary) and c27= CAST('20' as binary) and 2796c28= CAST('20' as binary) and c29= CAST('20' as binary) and 2797c30= CAST('20' as binary) ; 2798found 2799true 2800select 'true' as found from t9 2801where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and 2802c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 2803c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and 2804c30= @arg00; 2805found 2806true 2807prepare stmt1 from "select 'true' as found from t9 2808where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) 2809 = CAST('20' as binary) and c21= CAST('20' as binary) 2810 and c22= CAST('20' as binary) and c23= CAST('20' as binary) and 2811 c24= CAST('20' as binary) and c25= CAST('20' as binary) and 2812 c26= CAST('20' as binary) and c27= CAST('20' as binary) and 2813 c28= CAST('20' as binary) and c29= CAST('20' as binary) and 2814 c30= CAST('20' as binary)" ; 2815execute stmt1 ; 2816found 2817true 2818prepare stmt1 from "select 'true' as found from t9 2819where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and 2820 c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and 2821 c29= ? and c30= ?"; 2822execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2823@arg00, @arg00, @arg00, @arg00, @arg00 ; 2824found 2825true 2826set @arg00= 20; 2827select 'true' as found from t9 2828where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and 2829c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and 2830c27= 20 and c28= 20 and c29= 20 and c30= 20 ; 2831found 2832true 2833select 'true' as found from t9 2834where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 2835c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 2836c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 2837found 2838true 2839prepare stmt1 from "select 'true' as found from t9 2840where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and 2841 c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and 2842 c27= 20 and c28= 20 and c29= 20 and c30= 20" ; 2843execute stmt1 ; 2844found 2845true 2846prepare stmt1 from "select 'true' as found from t9 2847where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 2848 c21= ? and c22= ? and c23= ? and c25= ? and 2849 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 2850execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2851@arg00, @arg00, @arg00, @arg00, @arg00 ; 2852found 2853true 2854set @arg00= 20.0; 2855select 'true' as found from t9 2856where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and 2857c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and 2858c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; 2859found 2860true 2861select 'true' as found from t9 2862where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 2863c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 2864c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 2865found 2866true 2867prepare stmt1 from "select 'true' as found from t9 2868where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and 2869 c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and 2870 c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; 2871execute stmt1 ; 2872found 2873true 2874prepare stmt1 from "select 'true' as found from t9 2875where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 2876 c21= ? and c22= ? and c23= ? and c25= ? and 2877 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 2878execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 2879@arg00, @arg00, @arg00, @arg00, @arg00 ; 2880found 2881true 2882delete from t9 ; 2883test_sequence 2884-- insert into date/time columns -- 2885Warnings: 2886Note 1265 Data truncated for column 'c13' at row 1 2887Note 1265 Data truncated for column 'c16' at row 1 2888Warning 1265 Data truncated for column 'c17' at row 1 2889Warnings: 2890Note 1265 Data truncated for column 'c13' at row 1 2891Note 1265 Data truncated for column 'c16' at row 1 2892Warning 1265 Data truncated for column 'c17' at row 1 2893Warnings: 2894Note 1265 Data truncated for column 'c13' at row 1 2895Note 1265 Data truncated for column 'c16' at row 1 2896Warning 1265 Data truncated for column 'c17' at row 1 2897Warnings: 2898Note 1265 Data truncated for column 'c13' at row 1 2899Note 1265 Data truncated for column 'c16' at row 1 2900Warning 1265 Data truncated for column 'c17' at row 1 2901Warnings: 2902Note 1265 Data truncated for column 'c13' at row 1 2903Warnings: 2904Note 1265 Data truncated for column 'c13' at row 1 2905Note 1265 Data truncated for column 'c16' at row 1 2906Warning 1265 Data truncated for column 'c17' at row 1 2907Warnings: 2908Note 1265 Data truncated for column 'c13' at row 1 2909Warnings: 2910Note 1265 Data truncated for column 'c13' at row 1 2911Note 1265 Data truncated for column 'c16' at row 1 2912Warning 1265 Data truncated for column 'c17' at row 1 2913Warnings: 2914Warning 1265 Data truncated for column 'c13' at row 1 2915Warning 1265 Data truncated for column 'c14' at row 1 2916Warning 1265 Data truncated for column 'c15' at row 1 2917Warning 1264 Out of range value for column 'c16' at row 1 2918Warning 1264 Out of range value for column 'c17' at row 1 2919Warnings: 2920Warning 1265 Data truncated for column 'c13' at row 1 2921Warning 1265 Data truncated for column 'c14' at row 1 2922Warning 1265 Data truncated for column 'c15' at row 1 2923Warning 1264 Out of range value for column 'c16' at row 1 2924Warning 1264 Out of range value for column 'c17' at row 1 2925Warnings: 2926Warning 1265 Data truncated for column 'c13' at row 1 2927Warning 1265 Data truncated for column 'c14' at row 1 2928Warning 1265 Data truncated for column 'c15' at row 1 2929Warning 1264 Out of range value for column 'c16' at row 1 2930Warning 1264 Out of range value for column 'c17' at row 1 2931Warnings: 2932Warning 1265 Data truncated for column 'c13' at row 1 2933Warning 1265 Data truncated for column 'c14' at row 1 2934Warning 1265 Data truncated for column 'c15' at row 1 2935Warning 1264 Out of range value for column 'c16' at row 1 2936Warning 1264 Out of range value for column 'c17' at row 1 2937Warnings: 2938Warning 1265 Data truncated for column 'c15' at row 1 2939Warning 1264 Out of range value for column 'c16' at row 1 2940Warning 1264 Out of range value for column 'c17' at row 1 2941Warnings: 2942Warning 1265 Data truncated for column 'c15' at row 1 2943Warning 1264 Out of range value for column 'c16' at row 1 2944Warning 1264 Out of range value for column 'c17' at row 1 2945Warnings: 2946Warning 1265 Data truncated for column 'c15' at row 1 2947Warning 1264 Out of range value for column 'c16' at row 1 2948Warning 1264 Out of range value for column 'c17' at row 1 2949Warnings: 2950Warning 1265 Data truncated for column 'c15' at row 1 2951Warning 1264 Out of range value for column 'c16' at row 1 2952Warning 1264 Out of range value for column 'c17' at row 1 2953select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; 2954c1 c13 c14 c15 c16 c17 295520 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 295621 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 295722 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 295823 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 295930 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 296031 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 296132 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 296233 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 296340 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296441 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296542 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296643 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296750 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296851 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 296952 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 297053 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 297160 NULL NULL 1991-01-01 01:01:01 NULL NULL 297261 NULL NULL 1991-01-01 01:01:01 NULL NULL 297362 NULL NULL 1991-01-01 01:01:01 NULL NULL 297463 NULL NULL 1991-01-01 01:01:01 NULL NULL 297571 NULL NULL 1991-01-01 01:01:01 NULL NULL 297673 NULL NULL 1991-01-01 01:01:01 NULL NULL 297781 NULL NULL 1991-01-01 01:01:01 NULL NULL 297883 NULL NULL 1991-01-01 01:01:01 NULL NULL 2979test_sequence 2980-- select .. where date/time column = .. -- 2981set @arg00= '1991-01-01 01:01:01' ; 2982select 'true' as found from t9 2983where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and 2984c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and 2985c17= '1991-01-01 01:01:01' ; 2986found 2987true 2988select 'true' as found from t9 2989where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 2990and c17= @arg00 ; 2991found 2992true 2993prepare stmt1 from "select 'true' as found from t9 2994where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and 2995 c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and 2996 c17= '1991-01-01 01:01:01'" ; 2997execute stmt1 ; 2998found 2999true 3000prepare stmt1 from "select 'true' as found from t9 3001where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; 3002execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; 3003found 3004true 3005set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; 3006select 'true' as found from t9 3007where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and 3008c14= CAST('1991-01-01 01:01:01' as datetime) and 3009c15= CAST('1991-01-01 01:01:01' as datetime) and 3010c16= CAST('1991-01-01 01:01:01' as datetime) and 3011c17= CAST('1991-01-01 01:01:01' as datetime) ; 3012found 3013true 3014select 'true' as found from t9 3015where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 3016and c17= @arg00 ; 3017found 3018true 3019prepare stmt1 from "select 'true' as found from t9 3020where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and 3021 c14= CAST('1991-01-01 01:01:01' as datetime) and 3022 c15= CAST('1991-01-01 01:01:01' as datetime) and 3023 c16= CAST('1991-01-01 01:01:01' as datetime) and 3024 c17= CAST('1991-01-01 01:01:01' as datetime)" ; 3025execute stmt1 ; 3026found 3027true 3028prepare stmt1 from "select 'true' as found from t9 3029where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; 3030execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; 3031found 3032true 3033set @arg00= 1991 ; 3034select 'true' as found from t9 3035where c1= 20 and c17= 1991 ; 3036found 3037true 3038select 'true' as found from t9 3039where c1= 20 and c17= @arg00 ; 3040found 3041true 3042prepare stmt1 from "select 'true' as found from t9 3043where c1= 20 and c17= 1991" ; 3044execute stmt1 ; 3045found 3046true 3047prepare stmt1 from "select 'true' as found from t9 3048where c1= 20 and c17= ?" ; 3049execute stmt1 using @arg00 ; 3050found 3051true 3052set @arg00= 1.991e+3 ; 3053select 'true' as found from t9 3054where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; 3055found 3056true 3057select 'true' as found from t9 3058where c1= 20 and abs(c17 - @arg00) < 0.01 ; 3059found 3060true 3061prepare stmt1 from "select 'true' as found from t9 3062where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; 3063execute stmt1 ; 3064found 3065true 3066prepare stmt1 from "select 'true' as found from t9 3067where c1= 20 and abs(c17 - ?) < 0.01" ; 3068execute stmt1 using @arg00 ; 3069found 3070true 3071drop table t1, t9 ; 3072create table t1 3073( 3074a int, b varchar(30), 3075primary key(a) 3076) ENGINE = MERGE UNION=(t1_1,t1_2) 3077INSERT_METHOD=LAST; 3078create table t9 3079( 3080c1 tinyint, c2 smallint, c3 mediumint, c4 int, 3081c5 integer, c6 bigint, c7 float, c8 double, 3082c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), 3083c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time, 3084c17 year, c18 tinyint, c19 bool, c20 char, 3085c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, 3086c25 blob, c26 text, c27 mediumblob, c28 mediumtext, 3087c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), 3088c32 set('monday', 'tuesday', 'wednesday'), 3089primary key(c1) 3090) ENGINE = MERGE UNION=(t9_1,t9_2) 3091INSERT_METHOD=LAST; 3092delete from t1 ; 3093insert into t1 values (1,'one'); 3094insert into t1 values (2,'two'); 3095insert into t1 values (3,'three'); 3096insert into t1 values (4,'four'); 3097commit ; 3098delete from t9 ; 3099insert into t9 3100set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 3101c10= 1, c11= 1, c12 = 1, 3102c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 3103c16= '11:11:11', c17= '2004', 3104c18= 1, c19=true, c20= 'a', c21= '123456789a', 3105c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 3106c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 3107c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 3108insert into t9 3109set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 3110c10= 9, c11= 9, c12 = 9, 3111c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 3112c16= '11:11:11', c17= '2004', 3113c18= 1, c19=false, c20= 'a', c21= '123456789a', 3114c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 3115c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 3116c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 3117commit ; 3118test_sequence 3119------ simple select tests ------ 3120prepare stmt1 from ' select * from t9 order by c1 ' ; 3121execute stmt1; 3122Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 3123def test t9 t9 c1 c1 1 4 1 N 49155 0 63 3124def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 3125def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 3126def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 3127def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 3128def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 3129def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 3130def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 3131def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 3132def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 3133def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 3134def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 3135def test t9 t9 c13 c13 10 10 10 Y 128 0 63 3136def test t9 t9 c14 c14 12 19 19 Y 128 0 63 3137def test t9 t9 c15 c15 7 19 19 N 9345 0 63 3138def test t9 t9 c16 c16 11 10 8 Y 128 0 63 3139def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 3140def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 3141def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 3142def test t9 t9 c20 c20 254 1 1 Y 0 0 8 3143def test t9 t9 c21 c21 254 10 10 Y 0 0 8 3144def test t9 t9 c22 c22 253 30 30 Y 0 0 8 3145def test t9 t9 c23 c23 252 255 8 Y 144 0 63 3146def test t9 t9 c24 c24 252 255 8 Y 16 0 8 3147def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 3148def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 3149def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 3150def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 3151def test t9 t9 c29 c29 252 4294967295 8 Y 144 0 63 3152def test t9 t9 c30 c30 252 4294967295 8 Y 16 0 8 3153def test t9 t9 c31 c31 254 5 3 Y 256 0 8 3154def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 3155c1 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 31561 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 31579 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 3158set @arg00='SELECT' ; 3159@arg00 a from t1 where a=1; 3160ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1 3161prepare stmt1 from ' ? a from t1 where a=1 '; 3162ERROR 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 3163set @arg00=1 ; 3164select @arg00, b from t1 where a=1 ; 3165@arg00 b 31661 one 3167prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 3168execute stmt1 using @arg00 ; 3169? b 31701 one 3171set @arg00='lion' ; 3172select @arg00, b from t1 where a=1 ; 3173@arg00 b 3174lion one 3175prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 3176execute stmt1 using @arg00 ; 3177? b 3178lion one 3179set @arg00=NULL ; 3180select @arg00, b from t1 where a=1 ; 3181@arg00 b 3182NULL one 3183prepare stmt1 from ' select ?, b from t1 where a=1 ' ; 3184execute stmt1 using @arg00 ; 3185? b 3186NULL one 3187set @arg00=1 ; 3188select b, a - @arg00 from t1 where a=1 ; 3189b a - @arg00 3190one 0 3191prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; 3192execute stmt1 using @arg00 ; 3193b a - ? 3194one 0 3195set @arg00=null ; 3196select @arg00 as my_col ; 3197my_col 3198NULL 3199prepare stmt1 from ' select ? as my_col'; 3200execute stmt1 using @arg00 ; 3201my_col 3202NULL 3203select @arg00 + 1 as my_col ; 3204my_col 3205NULL 3206prepare stmt1 from ' select ? + 1 as my_col'; 3207execute stmt1 using @arg00 ; 3208my_col 3209NULL 3210select 1 + @arg00 as my_col ; 3211my_col 3212NULL 3213prepare stmt1 from ' select 1 + ? as my_col'; 3214execute stmt1 using @arg00 ; 3215my_col 3216NULL 3217set @arg00='MySQL' ; 3218select substr(@arg00,1,2) from t1 where a=1 ; 3219substr(@arg00,1,2) 3220My 3221prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; 3222execute stmt1 using @arg00 ; 3223substr(?,1,2) 3224My 3225set @arg00=3 ; 3226select substr('MySQL',@arg00,5) from t1 where a=1 ; 3227substr('MySQL',@arg00,5) 3228SQL 3229prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; 3230execute stmt1 using @arg00 ; 3231substr('MySQL',?,5) 3232SQL 3233select substr('MySQL',1,@arg00) from t1 where a=1 ; 3234substr('MySQL',1,@arg00) 3235MyS 3236prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; 3237execute stmt1 using @arg00 ; 3238substr('MySQL',1,?) 3239MyS 3240set @arg00='MySQL' ; 3241select a , concat(@arg00,b) from t1 order by a; 3242a concat(@arg00,b) 32431 MySQLone 32442 MySQLtwo 32453 MySQLthree 32464 MySQLfour 3247prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; 3248execute stmt1 using @arg00; 3249a concat(?,b) 32501 MySQLone 32512 MySQLtwo 32523 MySQLthree 32534 MySQLfour 3254select a , concat(b,@arg00) from t1 order by a ; 3255a concat(b,@arg00) 32561 oneMySQL 32572 twoMySQL 32583 threeMySQL 32594 fourMySQL 3260prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; 3261execute stmt1 using @arg00; 3262a concat(b,?) 32631 oneMySQL 32642 twoMySQL 32653 threeMySQL 32664 fourMySQL 3267set @arg00='MySQL' ; 3268select group_concat(@arg00,b order by a) from t1 3269group by 'a' ; 3270group_concat(@arg00,b order by a) 3271MySQLone,MySQLtwo,MySQLthree,MySQLfour 3272prepare stmt1 from ' select group_concat(?,b order by a) from t1 3273group by ''a'' ' ; 3274execute stmt1 using @arg00; 3275group_concat(?,b order by a) 3276MySQLone,MySQLtwo,MySQLthree,MySQLfour 3277select group_concat(b,@arg00 order by a) from t1 3278group by 'a' ; 3279group_concat(b,@arg00 order by a) 3280oneMySQL,twoMySQL,threeMySQL,fourMySQL 3281prepare stmt1 from ' select group_concat(b,? order by a) from t1 3282group by ''a'' ' ; 3283execute stmt1 using @arg00; 3284group_concat(b,? order by a) 3285oneMySQL,twoMySQL,threeMySQL,fourMySQL 3286set @arg00='first' ; 3287set @arg01='second' ; 3288set @arg02=NULL; 3289select @arg00, @arg01 from t1 where a=1 ; 3290@arg00 @arg01 3291first second 3292prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; 3293execute stmt1 using @arg00, @arg01 ; 3294? ? 3295first second 3296execute stmt1 using @arg02, @arg01 ; 3297? ? 3298NULL second 3299execute stmt1 using @arg00, @arg02 ; 3300? ? 3301first NULL 3302execute stmt1 using @arg02, @arg02 ; 3303? ? 3304NULL NULL 3305drop table if exists t5 ; 3306create table t5 (id1 int(11) not null default '0', 3307value2 varchar(100), value1 varchar(100)) ; 3308insert into t5 values (1,'hh','hh'),(2,'hh','hh'), 3309(1,'ii','ii'),(2,'ii','ii') ; 3310prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; 3311set @arg00=1 ; 3312set @arg01='hh' ; 3313execute stmt1 using @arg00, @arg01 ; 3314id1 value1 33151 hh 33161 ii 33172 hh 3318drop table t5 ; 3319drop table if exists t5 ; 3320create table t5(session_id char(9) not null) ; 3321insert into t5 values ('abc') ; 3322prepare stmt1 from ' select * from t5 3323where ?=''1111'' and session_id = ''abc'' ' ; 3324set @arg00='abc' ; 3325execute stmt1 using @arg00 ; 3326session_id 3327set @arg00='1111' ; 3328execute stmt1 using @arg00 ; 3329session_id 3330abc 3331set @arg00='abc' ; 3332execute stmt1 using @arg00 ; 3333session_id 3334drop table t5 ; 3335set @arg00='FROM' ; 3336select a @arg00 t1 where a=1 ; 3337ERROR 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 3338prepare stmt1 from ' select a ? t1 where a=1 ' ; 3339ERROR 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 3340set @arg00='t1' ; 3341select a from @arg00 where a=1 ; 3342ERROR 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 3343prepare stmt1 from ' select a from ? where a=1 ' ; 3344ERROR 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 3345set @arg00='WHERE' ; 3346select a from t1 @arg00 a=1 ; 3347ERROR 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 3348prepare stmt1 from ' select a from t1 ? a=1 ' ; 3349ERROR 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 3350set @arg00=1 ; 3351select a FROM t1 where a=@arg00 ; 3352a 33531 3354prepare stmt1 from ' select a FROM t1 where a=? ' ; 3355execute stmt1 using @arg00 ; 3356a 33571 3358set @arg00=1000 ; 3359execute stmt1 using @arg00 ; 3360a 3361set @arg00=NULL ; 3362select a FROM t1 where a=@arg00 ; 3363a 3364prepare stmt1 from ' select a FROM t1 where a=? ' ; 3365execute stmt1 using @arg00 ; 3366a 3367set @arg00=4 ; 3368select a FROM t1 where a=sqrt(@arg00) ; 3369a 33702 3371prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; 3372execute stmt1 using @arg00 ; 3373a 33742 3375set @arg00=NULL ; 3376select a FROM t1 where a=sqrt(@arg00) ; 3377a 3378prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; 3379execute stmt1 using @arg00 ; 3380a 3381set @arg00=2 ; 3382set @arg01=3 ; 3383select a FROM t1 where a in (@arg00,@arg01) order by a; 3384a 33852 33863 3387prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; 3388execute stmt1 using @arg00, @arg01; 3389a 33902 33913 3392set @arg00= 'one' ; 3393set @arg01= 'two' ; 3394set @arg02= 'five' ; 3395prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; 3396execute stmt1 using @arg00, @arg01, @arg02 ; 3397b 3398one 3399two 3400prepare stmt1 from ' select b FROM t1 where b like ? '; 3401set @arg00='two' ; 3402execute stmt1 using @arg00 ; 3403b 3404two 3405set @arg00='tw%' ; 3406execute stmt1 using @arg00 ; 3407b 3408two 3409set @arg00='%wo' ; 3410execute stmt1 using @arg00 ; 3411b 3412two 3413set @arg00=null ; 3414insert into t9 set c1= 0, c5 = NULL ; 3415select c5 from t9 where c5 > NULL ; 3416c5 3417prepare stmt1 from ' select c5 from t9 where c5 > ? '; 3418execute stmt1 using @arg00 ; 3419c5 3420select c5 from t9 where c5 < NULL ; 3421c5 3422prepare stmt1 from ' select c5 from t9 where c5 < ? '; 3423execute stmt1 using @arg00 ; 3424c5 3425select c5 from t9 where c5 = NULL ; 3426c5 3427prepare stmt1 from ' select c5 from t9 where c5 = ? '; 3428execute stmt1 using @arg00 ; 3429c5 3430select c5 from t9 where c5 <=> NULL ; 3431c5 3432NULL 3433prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; 3434execute stmt1 using @arg00 ; 3435c5 3436NULL 3437delete from t9 where c1= 0 ; 3438set @arg00='>' ; 3439select a FROM t1 where a @arg00 1 ; 3440ERROR 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 3441prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; 3442ERROR 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 3443set @arg00=1 ; 3444select a,b FROM t1 where a is not NULL 3445AND b is not NULL group by a - @arg00 ; 3446a b 34471 one 34482 two 34493 three 34504 four 3451prepare stmt1 from ' select a,b FROM t1 where a is not NULL 3452AND b is not NULL group by a - ? ' ; 3453execute stmt1 using @arg00 ; 3454a b 34551 one 34562 two 34573 three 34584 four 3459set @arg00='two' ; 3460select a,b FROM t1 where a is not NULL 3461AND b is not NULL having b <> @arg00 order by a ; 3462a b 34631 one 34643 three 34654 four 3466prepare stmt1 from ' select a,b FROM t1 where a is not NULL 3467AND b is not NULL having b <> ? order by a ' ; 3468execute stmt1 using @arg00 ; 3469a b 34701 one 34713 three 34724 four 3473set @arg00=1 ; 3474select a,b FROM t1 where a is not NULL 3475AND b is not NULL order by a - @arg00 ; 3476a b 34771 one 34782 two 34793 three 34804 four 3481prepare stmt1 from ' select a,b FROM t1 where a is not NULL 3482AND b is not NULL order by a - ? ' ; 3483execute stmt1 using @arg00 ; 3484a b 34851 one 34862 two 34873 three 34884 four 3489set @arg00=2 ; 3490select a,b from t1 order by 2 ; 3491a b 34924 four 34931 one 34943 three 34952 two 3496prepare stmt1 from ' select a,b from t1 3497order by ? '; 3498execute stmt1 using @arg00; 3499a b 35004 four 35011 one 35023 three 35032 two 3504set @arg00=1 ; 3505execute stmt1 using @arg00; 3506a b 35071 one 35082 two 35093 three 35104 four 3511set @arg00=0 ; 3512execute stmt1 using @arg00; 3513ERROR 42S22: Unknown column '?' in 'order clause' 3514set @arg00=1; 3515prepare stmt1 from ' select a,b from t1 order by a 3516limit 1 '; 3517execute stmt1 ; 3518a b 35191 one 3520prepare stmt1 from ' select a,b from t1 order by a limit ? '; 3521execute stmt1 using @arg00; 3522a b 35231 one 3524set @arg00='b' ; 3525set @arg01=0 ; 3526set @arg02=2 ; 3527set @arg03=2 ; 3528select sum(a), @arg00 from t1 where a > @arg01 3529and b is not null group by substr(b,@arg02) 3530having sum(a) <> @arg03 ; 3531sum(a) @arg00 35323 b 35331 b 35344 b 3535prepare stmt1 from ' select sum(a), ? from t1 where a > ? 3536and b is not null group by substr(b,?) 3537having sum(a) <> ? '; 3538execute stmt1 using @arg00, @arg01, @arg02, @arg03; 3539sum(a) ? 35403 b 35411 b 35424 b 3543test_sequence 3544------ join tests ------ 3545select first.a as a1, second.a as a2 3546from t1 first, t1 second 3547where first.a = second.a order by a1 ; 3548a1 a2 35491 1 35502 2 35513 3 35524 4 3553prepare stmt1 from ' select first.a as a1, second.a as a2 3554 from t1 first, t1 second 3555 where first.a = second.a order by a1 '; 3556execute stmt1 ; 3557a1 a2 35581 1 35592 2 35603 3 35614 4 3562set @arg00='ABC'; 3563set @arg01='two'; 3564set @arg02='one'; 3565select first.a, @arg00, second.a FROM t1 first, t1 second 3566where @arg01 = first.b or first.a = second.a or second.b = @arg02 3567order by second.a, first.a; 3568a @arg00 a 35691 ABC 1 35702 ABC 1 35713 ABC 1 35724 ABC 1 35732 ABC 2 35742 ABC 3 35753 ABC 3 35762 ABC 4 35774 ABC 4 3578prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second 3579 where ? = first.b or first.a = second.a or second.b = ? 3580 order by second.a, first.a'; 3581execute stmt1 using @arg00, @arg01, @arg02; 3582a ? a 35831 ABC 1 35842 ABC 1 35853 ABC 1 35864 ABC 1 35872 ABC 2 35882 ABC 3 35893 ABC 3 35902 ABC 4 35914 ABC 4 3592drop table if exists t2 ; 3593create table t2 as select * from t1 ; 3594set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; 3595set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; 3596set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; 3597set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; 3598set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; 3599set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; 3600set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; 3601set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; 3602set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; 3603the join statement is: 3604SELECT * FROM t2 right join t1 using(a) order by t2.a 3605prepare stmt1 from @query9 ; 3606execute stmt1 ; 3607a b b 36081 one one 36092 two two 36103 three three 36114 four four 3612execute stmt1 ; 3613a b b 36141 one one 36152 two two 36163 three three 36174 four four 3618execute stmt1 ; 3619a b b 36201 one one 36212 two two 36223 three three 36234 four four 3624the join statement is: 3625SELECT * FROM t2 natural right join t1 order by t2.a 3626prepare stmt1 from @query8 ; 3627execute stmt1 ; 3628a b 36291 one 36302 two 36313 three 36324 four 3633execute stmt1 ; 3634a b 36351 one 36362 two 36373 three 36384 four 3639execute stmt1 ; 3640a b 36411 one 36422 two 36433 three 36444 four 3645the join statement is: 3646SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a 3647prepare stmt1 from @query7 ; 3648execute stmt1 ; 3649a b a b 36501 one 1 one 36512 two 2 two 36523 three 3 three 36534 four 4 four 3654execute stmt1 ; 3655a b a b 36561 one 1 one 36572 two 2 two 36583 three 3 three 36594 four 4 four 3660execute stmt1 ; 3661a b a b 36621 one 1 one 36632 two 2 two 36643 three 3 three 36654 four 4 four 3666the join statement is: 3667SELECT * FROM t2 left join t1 using(a) order by t2.a 3668prepare stmt1 from @query6 ; 3669execute stmt1 ; 3670a b b 36711 one one 36722 two two 36733 three three 36744 four four 3675execute stmt1 ; 3676a b b 36771 one one 36782 two two 36793 three three 36804 four four 3681execute stmt1 ; 3682a b b 36831 one one 36842 two two 36853 three three 36864 four four 3687the join statement is: 3688SELECT * FROM t2 natural left join t1 order by t2.a 3689prepare stmt1 from @query5 ; 3690execute stmt1 ; 3691a b 36921 one 36932 two 36943 three 36954 four 3696execute stmt1 ; 3697a b 36981 one 36992 two 37003 three 37014 four 3702execute stmt1 ; 3703a b 37041 one 37052 two 37063 three 37074 four 3708the join statement is: 3709SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a 3710prepare stmt1 from @query4 ; 3711execute stmt1 ; 3712a b a b 37131 one 1 one 37142 two 2 two 37153 three 3 three 37164 four 4 four 3717execute stmt1 ; 3718a b a b 37191 one 1 one 37202 two 2 two 37213 three 3 three 37224 four 4 four 3723execute stmt1 ; 3724a b a b 37251 one 1 one 37262 two 2 two 37273 three 3 three 37284 four 4 four 3729the join statement is: 3730SELECT * FROM t2 join t1 using(a) order by t2.a 3731prepare stmt1 from @query3 ; 3732execute stmt1 ; 3733a b b 37341 one one 37352 two two 37363 three three 37374 four four 3738execute stmt1 ; 3739a b b 37401 one one 37412 two two 37423 three three 37434 four four 3744execute stmt1 ; 3745a b b 37461 one one 37472 two two 37483 three three 37494 four four 3750the join statement is: 3751SELECT * FROM t2 natural join t1 order by t2.a 3752prepare stmt1 from @query2 ; 3753execute stmt1 ; 3754a b 37551 one 37562 two 37573 three 37584 four 3759execute stmt1 ; 3760a b 37611 one 37622 two 37633 three 37644 four 3765execute stmt1 ; 3766a b 37671 one 37682 two 37693 three 37704 four 3771the join statement is: 3772SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a 3773prepare stmt1 from @query1 ; 3774execute stmt1 ; 3775a b a b 37761 one 1 one 37772 two 2 two 37783 three 3 three 37794 four 4 four 3780execute stmt1 ; 3781a b a b 37821 one 1 one 37832 two 2 two 37843 three 3 three 37854 four 4 four 3786execute stmt1 ; 3787a b a b 37881 one 1 one 37892 two 2 two 37903 three 3 three 37914 four 4 four 3792drop table t2 ; 3793test_sequence 3794------ subquery tests ------ 3795prepare stmt1 from ' select a, b FROM t1 outer_table where 3796 a = (select a from t1 where b = ''two'') '; 3797execute stmt1 ; 3798a b 37992 two 3800set @arg00='two' ; 3801select a, b FROM t1 outer_table where 3802a = (select a from t1 where b = 'two' ) and b=@arg00 ; 3803a b 38042 two 3805prepare stmt1 from ' select a, b FROM t1 outer_table where 3806 a = (select a from t1 where b = ''two'') and b=? '; 3807execute stmt1 using @arg00; 3808a b 38092 two 3810set @arg00='two' ; 3811select a, b FROM t1 outer_table where 3812a = (select a from t1 where b = @arg00 ) and b='two' ; 3813a b 38142 two 3815prepare stmt1 from ' select a, b FROM t1 outer_table where 3816 a = (select a from t1 where b = ? ) and b=''two'' ' ; 3817execute stmt1 using @arg00; 3818a b 38192 two 3820set @arg00=3 ; 3821set @arg01='three' ; 3822select a,b FROM t1 where (a,b) in (select 3, 'three'); 3823a b 38243 three 3825select a FROM t1 where (a,b) in (select @arg00,@arg01); 3826a 38273 3828prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; 3829execute stmt1 using @arg00, @arg01; 3830a 38313 3832set @arg00=1 ; 3833set @arg01='two' ; 3834set @arg02=2 ; 3835set @arg03='two' ; 3836select a, @arg00, b FROM t1 outer_table where 3837b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; 3838a @arg00 b 38392 1 two 3840prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 3841 b=? and a = (select ? from t1 where b = ? ) ' ; 3842execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 3843a ? b 38442 1 two 3845prepare stmt1 from 'select c4 FROM t9 where 3846 c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ; 3847execute stmt1 using @arg01, @arg02; 3848c4 3849prepare stmt1 from ' select a, b FROM t1 outer_table where 3850 a = (select a from t1 where b = outer_table.b ) order by a '; 3851execute stmt1 ; 3852a b 38531 one 38542 two 38553 three 38564 four 3857prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 3858 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 3859execute stmt1 ; 3860ccc 38611 3862deallocate prepare stmt1 ; 3863prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 3864 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 3865execute stmt1 ; 3866ccc 38671 3868deallocate prepare stmt1 ; 3869prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1= 3870 (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) '; 3871execute stmt1 ; 3872ccc 38731 3874deallocate prepare stmt1 ; 3875set @arg00='two' ; 3876select a, b FROM t1 outer_table where 3877a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; 3878a b 38792 two 3880prepare stmt1 from ' select a, b FROM t1 outer_table where 3881 a = (select a from t1 where b = outer_table.b) and b=? '; 3882execute stmt1 using @arg00; 3883a b 38842 two 3885set @arg00=2 ; 3886select a, b FROM t1 outer_table where 3887a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; 3888a b 38892 two 3890prepare stmt1 from ' select a, b FROM t1 outer_table where 3891 a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; 3892execute stmt1 using @arg00; 3893a b 38942 two 3895set @arg00=2 ; 3896select a, b FROM t1 outer_table where 3897a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; 3898a b 38992 two 3900prepare stmt1 from ' select a, b FROM t1 outer_table where 3901 a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; 3902execute stmt1 using @arg00; 3903a b 39042 two 3905set @arg00=1 ; 3906set @arg01='two' ; 3907set @arg02=2 ; 3908set @arg03='two' ; 3909select a, @arg00, b FROM t1 outer_table where 3910b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 3911and outer_table.a=a ) ; 3912a @arg00 b 39132 1 two 3914prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 3915 b=? and a = (select ? from t1 where outer_table.b = ? 3916 and outer_table.a=a ) ' ; 3917execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 3918a ? b 39192 1 two 3920set @arg00=1 ; 3921set @arg01=0 ; 3922select a, @arg00 3923from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 3924where a=@arg01; 3925a @arg00 39260 1 3927prepare stmt1 from ' select a, ? 3928 from ( select a - ? as a from t1 where a=? ) as t2 3929 where a=? '; 3930execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; 3931a ? 39320 1 3933drop table if exists t2 ; 3934create table t2 as select * from t1; 3935prepare stmt1 from ' select a in (select a from t2) from t1 ' ; 3936execute stmt1 ; 3937a in (select a from t2) 39381 39391 39401 39411 3942drop table if exists t5, t6, t7 ; 3943create table t5 (a int , b int) ; 3944create table t6 like t5 ; 3945create table t7 like t5 ; 3946insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), 3947(2, -1), (3, 10) ; 3948insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; 3949insert into t7 values (3, 3), (2, 2), (1, 1) ; 3950prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 3951 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 3952 group by t5.a order by sum limit 1) from t7 ' ; 3953execute stmt1 ; 3954a (select count(distinct t5.b) as sum from t5, t6 3955 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 3956 group by t5.a order by sum limit 1) 39573 1 39582 2 39591 2 3960execute stmt1 ; 3961a (select count(distinct t5.b) as sum from t5, t6 3962 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 3963 group by t5.a order by sum limit 1) 39643 1 39652 2 39661 2 3967execute stmt1 ; 3968a (select count(distinct t5.b) as sum from t5, t6 3969 where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b 3970 group by t5.a order by sum limit 1) 39713 1 39722 2 39731 2 3974drop table t5, t6, t7 ; 3975drop table if exists t2 ; 3976create table t2 as select * from t9; 3977set @stmt= ' SELECT 3978 (SELECT SUM(c1 + c12 + 0.0) FROM t2 3979 where (t9.c2 - 0e-3) = t2.c2 3980 GROUP BY t9.c15 LIMIT 1) as scalar_s, 3981 exists (select 1.0e+0 from t2 3982 where t2.c3 * 9.0000000000 = t9.c4) as exists_s, 3983 c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, 3984 (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s 3985FROM t9, 3986(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; 3987prepare stmt1 from @stmt ; 3988execute stmt1 ; 3989execute stmt1 ; 3990set @stmt= concat('explain ',@stmt); 3991prepare stmt1 from @stmt ; 3992execute stmt1 ; 3993execute stmt1 ; 3994set @stmt= ' SELECT 3995 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 3996 GROUP BY t9.c15 LIMIT 1) as scalar_s, 3997 exists (select ? from t2 3998 where t2.c3*?=t9.c4) as exists_s, 3999 c5*? in (select c6+? from t2) as in_s, 4000 (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s 4001FROM t9, 4002(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; 4003set @arg00= 0.0 ; 4004set @arg01= 0e-3 ; 4005set @arg02= 1.0e+0 ; 4006set @arg03= 9.0000000000 ; 4007set @arg04= 4 ; 4008set @arg05= 0.3e+1 ; 4009set @arg06= 4 ; 4010set @arg07= 4 ; 4011set @arg08= 4.0 ; 4012set @arg09= 40e-1 ; 4013prepare stmt1 from @stmt ; 4014execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 4015@arg07, @arg08, @arg09 ; 4016execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 4017@arg07, @arg08, @arg09 ; 4018set @stmt= concat('explain ',@stmt); 4019prepare stmt1 from @stmt ; 4020execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 4021@arg07, @arg08, @arg09 ; 4022execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, 4023@arg07, @arg08, @arg09 ; 4024drop table t2 ; 4025select 1 < (select a from t1) ; 4026ERROR 21000: Subquery returns more than 1 row 4027prepare stmt1 from ' select 1 < (select a from t1) ' ; 4028execute stmt1 ; 4029ERROR 21000: Subquery returns more than 1 row 4030select 1 as my_col ; 4031my_col 40321 4033test_sequence 4034------ union tests ------ 4035prepare stmt1 from ' select a FROM t1 where a=1 4036 union distinct 4037 select a FROM t1 where a=1 '; 4038execute stmt1 ; 4039a 40401 4041execute stmt1 ; 4042a 40431 4044prepare stmt1 from ' select a FROM t1 where a=1 4045 union all 4046 select a FROM t1 where a=1 '; 4047execute stmt1 ; 4048a 40491 40501 4051prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; 4052ERROR 21000: The used SELECT statements have a different number of columns 4053prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; 4054ERROR 21000: The used SELECT statements have a different number of columns 4055prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; 4056ERROR 21000: The used SELECT statements have a different number of columns 4057prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; 4058ERROR 21000: The used SELECT statements have a different number of columns 4059set @arg00=1 ; 4060select @arg00 FROM t1 where a=1 4061union distinct 4062select 1 FROM t1 where a=1; 4063@arg00 40641 4065prepare stmt1 from ' select ? FROM t1 where a=1 4066 union distinct 4067 select 1 FROM t1 where a=1 ' ; 4068execute stmt1 using @arg00; 4069? 40701 4071set @arg00=1 ; 4072select 1 FROM t1 where a=1 4073union distinct 4074select @arg00 FROM t1 where a=1; 40751 40761 4077prepare stmt1 from ' select 1 FROM t1 where a=1 4078 union distinct 4079 select ? FROM t1 where a=1 ' ; 4080execute stmt1 using @arg00; 40811 40821 4083set @arg00='a' ; 4084select @arg00 FROM t1 where a=1 4085union distinct 4086select @arg00 FROM t1 where a=1; 4087@arg00 4088a 4089prepare stmt1 from ' select ? FROM t1 where a=1 4090 union distinct 4091 select ? FROM t1 where a=1 '; 4092execute stmt1 using @arg00, @arg00; 4093? 4094a 4095prepare stmt1 from ' select ? 4096 union distinct 4097 select ? '; 4098execute stmt1 using @arg00, @arg00; 4099? 4100a 4101set @arg00='a' ; 4102set @arg01=1 ; 4103set @arg02='a' ; 4104set @arg03=2 ; 4105select @arg00 FROM t1 where a=@arg01 4106union distinct 4107select @arg02 FROM t1 where a=@arg03; 4108@arg00 4109a 4110prepare stmt1 from ' select ? FROM t1 where a=? 4111 union distinct 4112 select ? FROM t1 where a=? ' ; 4113execute stmt1 using @arg00, @arg01, @arg02, @arg03; 4114? 4115a 4116set @arg00=1 ; 4117prepare stmt1 from ' select sum(a) + 200, ? from t1 4118union distinct 4119select sum(a) + 200, 1 from t1 4120group by b ' ; 4121execute stmt1 using @arg00; 4122sum(a) + 200 ? 4123210 1 4124204 1 4125201 1 4126203 1 4127202 1 4128set @Oporto='Oporto' ; 4129set @Lisboa='Lisboa' ; 4130set @0=0 ; 4131set @1=1 ; 4132set @2=2 ; 4133set @3=3 ; 4134set @4=4 ; 4135select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; 4136@Oporto @Lisboa @0 @1 @2 @3 @4 4137Oporto Lisboa 0 1 2 3 4 4138select sum(a) + 200 as the_sum, @Oporto as the_town from t1 4139group by b 4140union distinct 4141select sum(a) + 200, @Lisboa from t1 4142group by b ; 4143the_sum the_town 4144204 Oporto 4145201 Oporto 4146203 Oporto 4147202 Oporto 4148204 Lisboa 4149201 Lisboa 4150203 Lisboa 4151202 Lisboa 4152prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 4153 group by b 4154 union distinct 4155 select sum(a) + 200, ? from t1 4156 group by b ' ; 4157execute stmt1 using @Oporto, @Lisboa; 4158the_sum the_town 4159204 Oporto 4160201 Oporto 4161203 Oporto 4162202 Oporto 4163204 Lisboa 4164201 Lisboa 4165203 Lisboa 4166202 Lisboa 4167select sum(a) + 200 as the_sum, @Oporto as the_town from t1 4168where a > @1 4169group by b 4170union distinct 4171select sum(a) + 200, @Lisboa from t1 4172where a > @2 4173group by b ; 4174the_sum the_town 4175204 Oporto 4176203 Oporto 4177202 Oporto 4178204 Lisboa 4179203 Lisboa 4180prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 4181 where a > ? 4182 group by b 4183 union distinct 4184 select sum(a) + 200, ? from t1 4185 where a > ? 4186 group by b ' ; 4187execute stmt1 using @Oporto, @1, @Lisboa, @2; 4188the_sum the_town 4189204 Oporto 4190203 Oporto 4191202 Oporto 4192204 Lisboa 4193203 Lisboa 4194select sum(a) + 200 as the_sum, @Oporto as the_town from t1 4195where a > @1 4196group by b 4197having avg(a) > @2 4198union distinct 4199select sum(a) + 200, @Lisboa from t1 4200where a > @2 4201group by b 4202having avg(a) > @3; 4203the_sum the_town 4204204 Oporto 4205203 Oporto 4206204 Lisboa 4207prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 4208 where a > ? 4209 group by b 4210 having avg(a) > ? 4211 union distinct 4212 select sum(a) + 200, ? from t1 4213 where a > ? 4214 group by b 4215 having avg(a) > ? '; 4216execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; 4217the_sum the_town 4218204 Oporto 4219203 Oporto 4220204 Lisboa 4221test_sequence 4222------ explain select tests ------ 4223prepare stmt1 from ' explain select * from t9 ' ; 4224execute stmt1; 4225Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 4226def id 8 3 1 N 32929 0 63 4227def select_type 253 19 6 N 1 31 8 4228def table 253 64 2 Y 0 31 8 4229def type 253 10 3 Y 0 31 8 4230def possible_keys 253 4096 0 Y 0 31 8 4231def key 253 64 0 Y 0 31 8 4232def key_len 253 4096 0 Y 0 31 8 4233def ref 253 1024 0 Y 0 31 8 4234def rows 8 10 1 Y 32928 0 63 4235def Extra 253 255 0 N 1 31 8 4236id select_type table type possible_keys key key_len ref rows Extra 42371 SIMPLE t9 ALL NULL NULL NULL NULL 2 NULL 4238test_sequence 4239------ delete tests ------ 4240delete from t1 ; 4241insert into t1 values (1,'one'); 4242insert into t1 values (2,'two'); 4243insert into t1 values (3,'three'); 4244insert into t1 values (4,'four'); 4245commit ; 4246delete from t9 ; 4247insert into t9 4248set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 4249c10= 1, c11= 1, c12 = 1, 4250c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4251c16= '11:11:11', c17= '2004', 4252c18= 1, c19=true, c20= 'a', c21= '123456789a', 4253c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4254c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4255c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 4256insert into t9 4257set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 4258c10= 9, c11= 9, c12 = 9, 4259c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4260c16= '11:11:11', c17= '2004', 4261c18= 1, c19=false, c20= 'a', c21= '123456789a', 4262c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4263c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4264c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 4265commit ; 4266prepare stmt1 from 'delete from t1 where a=2' ; 4267execute stmt1; 4268select a,b from t1 where a=2; 4269a b 4270execute stmt1; 4271insert into t1 values(0,NULL); 4272set @arg00=NULL; 4273prepare stmt1 from 'delete from t1 where b=?' ; 4274execute stmt1 using @arg00; 4275select a,b from t1 where b is NULL ; 4276a b 42770 NULL 4278set @arg00='one'; 4279execute stmt1 using @arg00; 4280select a,b from t1 where b=@arg00; 4281a b 4282prepare stmt1 from 'truncate table t1' ; 4283test_sequence 4284------ update tests ------ 4285delete from t1 ; 4286insert into t1 values (1,'one'); 4287insert into t1 values (2,'two'); 4288insert into t1 values (3,'three'); 4289insert into t1 values (4,'four'); 4290commit ; 4291delete from t9 ; 4292insert into t9 4293set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 4294c10= 1, c11= 1, c12 = 1, 4295c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4296c16= '11:11:11', c17= '2004', 4297c18= 1, c19=true, c20= 'a', c21= '123456789a', 4298c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4299c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4300c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 4301insert into t9 4302set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 4303c10= 9, c11= 9, c12 = 9, 4304c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4305c16= '11:11:11', c17= '2004', 4306c18= 1, c19=false, c20= 'a', c21= '123456789a', 4307c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4308c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4309c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 4310commit ; 4311prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; 4312execute stmt1; 4313select a,b from t1 where a=2; 4314a b 43152 a=two 4316execute stmt1; 4317select a,b from t1 where a=2; 4318a b 43192 a=two 4320set @arg00=NULL; 4321prepare stmt1 from 'update t1 set b=? where a=2' ; 4322execute stmt1 using @arg00; 4323select a,b from t1 where a=2; 4324a b 43252 NULL 4326set @arg00='two'; 4327execute stmt1 using @arg00; 4328select a,b from t1 where a=2; 4329a b 43302 two 4331set @arg00=2; 4332prepare stmt1 from 'update t1 set b=NULL where a=?' ; 4333execute stmt1 using @arg00; 4334select a,b from t1 where a=@arg00; 4335a b 43362 NULL 4337update t1 set b='two' where a=@arg00; 4338set @arg00=2000; 4339execute stmt1 using @arg00; 4340select a,b from t1 where a=@arg00; 4341a b 4342set @arg00=2; 4343set @arg01=22; 4344prepare stmt1 from 'update t1 set a=? where a=?' ; 4345execute stmt1 using @arg00, @arg00; 4346select a,b from t1 where a=@arg00; 4347a b 43482 two 4349execute stmt1 using @arg01, @arg00; 4350select a,b from t1 where a=@arg01; 4351a b 435222 two 4353execute stmt1 using @arg00, @arg01; 4354select a,b from t1 where a=@arg00; 4355a b 43562 two 4357set @arg00=NULL; 4358set @arg01=2; 4359execute stmt1 using @arg00, @arg01; 4360Warnings: 4361Warning 1048 Column 'a' cannot be null 4362select a,b from t1 order by a; 4363a b 43640 two 43651 one 43663 three 43674 four 4368set @arg00=0; 4369execute stmt1 using @arg01, @arg00; 4370select a,b from t1 order by a; 4371a b 43721 one 43732 two 43743 three 43754 four 4376set @arg00=23; 4377set @arg01='two'; 4378set @arg02=2; 4379set @arg03='two'; 4380set @arg04=2; 4381drop table if exists t2; 4382create table t2 as select a,b from t1 ; 4383prepare stmt1 from 'update t1 set a=? where b=? 4384 and a in (select ? from t2 4385 where b = ? or a = ?)'; 4386execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; 4387affected rows: 1 4388info: Rows matched: 1 Changed: 1 Warnings: 0 4389select a,b from t1 where a = @arg00 ; 4390a b 439123 two 4392prepare stmt1 from 'update t1 set a=? where b=? 4393 and a not in (select ? from t2 4394 where b = ? or a = ?)'; 4395execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; 4396affected rows: 1 4397info: Rows matched: 1 Changed: 1 Warnings: 0 4398select a,b from t1 order by a ; 4399a b 44001 one 44012 two 44023 three 44034 four 4404drop table t2 ; 4405create table t2 4406( 4407a int, b varchar(30), 4408primary key(a) 4409) engine = 'MYISAM' ; 4410insert into t2(a,b) select a, b from t1 ; 4411prepare stmt1 from 'update t1 set a=? where b=? 4412 and a in (select ? from t2 4413 where b = ? or a = ?)'; 4414execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; 4415affected rows: 1 4416info: Rows matched: 1 Changed: 1 Warnings: 0 4417select a,b from t1 where a = @arg00 ; 4418a b 441923 two 4420prepare stmt1 from 'update t1 set a=? where b=? 4421 and a not in (select ? from t2 4422 where b = ? or a = ?)'; 4423execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; 4424affected rows: 1 4425info: Rows matched: 1 Changed: 1 Warnings: 0 4426select a,b from t1 order by a ; 4427a b 44281 one 44292 two 44303 three 44314 four 4432drop table t2 ; 4433set @arg00=1; 4434prepare stmt1 from 'update t1 set b=''bla'' 4435where a=2 4436limit 1'; 4437execute stmt1 ; 4438select a,b from t1 where b = 'bla' ; 4439a b 44402 bla 4441prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; 4442execute stmt1 using @arg00; 4443test_sequence 4444------ insert tests ------ 4445delete from t1 ; 4446insert into t1 values (1,'one'); 4447insert into t1 values (2,'two'); 4448insert into t1 values (3,'three'); 4449insert into t1 values (4,'four'); 4450commit ; 4451delete from t9 ; 4452insert into t9 4453set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 4454c10= 1, c11= 1, c12 = 1, 4455c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4456c16= '11:11:11', c17= '2004', 4457c18= 1, c19=true, c20= 'a', c21= '123456789a', 4458c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4459c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4460c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 4461insert into t9 4462set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 4463c10= 9, c11= 9, c12 = 9, 4464c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4465c16= '11:11:11', c17= '2004', 4466c18= 1, c19=false, c20= 'a', c21= '123456789a', 4467c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4468c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4469c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 4470commit ; 4471prepare stmt1 from 'insert into t1 values(5, ''five'' )'; 4472execute stmt1; 4473select a,b from t1 where a = 5; 4474a b 44755 five 4476set @arg00='six' ; 4477prepare stmt1 from 'insert into t1 values(6, ? )'; 4478execute stmt1 using @arg00; 4479select a,b from t1 where b = @arg00; 4480a b 44816 six 4482execute stmt1 using @arg00; 4483ERROR 23000: Duplicate entry '6' for key 'PRIMARY' 4484set @arg00=NULL ; 4485prepare stmt1 from 'insert into t1 values(0, ? )'; 4486execute stmt1 using @arg00; 4487select a,b from t1 where b is NULL; 4488a b 44890 NULL 4490set @arg00=8 ; 4491set @arg01='eight' ; 4492prepare stmt1 from 'insert into t1 values(?, ? )'; 4493execute stmt1 using @arg00, @arg01 ; 4494select a,b from t1 where b = @arg01; 4495a b 44968 eight 4497set @NULL= null ; 4498set @arg00= 'abc' ; 4499execute stmt1 using @NULL, @NULL ; 4500ERROR 23000: Column 'a' cannot be null 4501execute stmt1 using @NULL, @NULL ; 4502ERROR 23000: Column 'a' cannot be null 4503execute stmt1 using @NULL, @arg00 ; 4504ERROR 23000: Column 'a' cannot be null 4505execute stmt1 using @NULL, @arg00 ; 4506ERROR 23000: Column 'a' cannot be null 4507set @arg01= 10000 + 2 ; 4508execute stmt1 using @arg01, @arg00 ; 4509set @arg01= 10000 + 1 ; 4510execute stmt1 using @arg01, @arg00 ; 4511select * from t1 where a > 10000 order by a ; 4512a b 451310001 abc 451410002 abc 4515delete from t1 where a > 10000 ; 4516set @arg01= 10000 + 2 ; 4517execute stmt1 using @arg01, @NULL ; 4518set @arg01= 10000 + 1 ; 4519execute stmt1 using @arg01, @NULL ; 4520select * from t1 where a > 10000 order by a ; 4521a b 452210001 NULL 452310002 NULL 4524delete from t1 where a > 10000 ; 4525set @arg01= 10000 + 10 ; 4526execute stmt1 using @arg01, @arg01 ; 4527set @arg01= 10000 + 9 ; 4528execute stmt1 using @arg01, @arg01 ; 4529set @arg01= 10000 + 8 ; 4530execute stmt1 using @arg01, @arg01 ; 4531set @arg01= 10000 + 7 ; 4532execute stmt1 using @arg01, @arg01 ; 4533set @arg01= 10000 + 6 ; 4534execute stmt1 using @arg01, @arg01 ; 4535set @arg01= 10000 + 5 ; 4536execute stmt1 using @arg01, @arg01 ; 4537set @arg01= 10000 + 4 ; 4538execute stmt1 using @arg01, @arg01 ; 4539set @arg01= 10000 + 3 ; 4540execute stmt1 using @arg01, @arg01 ; 4541set @arg01= 10000 + 2 ; 4542execute stmt1 using @arg01, @arg01 ; 4543set @arg01= 10000 + 1 ; 4544execute stmt1 using @arg01, @arg01 ; 4545select * from t1 where a > 10000 order by a ; 4546a b 454710001 10001 454810002 10002 454910003 10003 455010004 10004 455110005 10005 455210006 10006 455310007 10007 455410008 10008 455510009 10009 455610010 10010 4557delete from t1 where a > 10000 ; 4558set @arg00=81 ; 4559set @arg01='8-1' ; 4560set @arg02=82 ; 4561set @arg03='8-2' ; 4562prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; 4563execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; 4564select a,b from t1 where a in (@arg00,@arg02) ; 4565a b 456681 8-1 456782 8-2 4568set @arg00=9 ; 4569set @arg01='nine' ; 4570prepare stmt1 from 'insert into t1 set a=?, b=? '; 4571execute stmt1 using @arg00, @arg01 ; 4572select a,b from t1 where a = @arg00 ; 4573a b 45749 nine 4575set @arg00=6 ; 4576set @arg01=1 ; 4577prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' 4578 on duplicate key update a=a + ?, b=concat(b,''modified'') '; 4579execute stmt1 using @arg00, @arg01; 4580select * from t1 order by a; 4581a b 45820 NULL 45831 one 45842 two 45853 three 45864 four 45875 five 45887 sixmodified 45898 eight 45909 nine 459181 8-1 459282 8-2 4593set @arg00=81 ; 4594set @arg01=1 ; 4595execute stmt1 using @arg00, @arg01; 4596ERROR 23000: Duplicate entry '82' for key 'PRIMARY' 4597drop table if exists t2 ; 4598create table t2 (id int auto_increment primary key) 4599ENGINE= 'MYISAM' ; 4600prepare stmt1 from ' select last_insert_id() ' ; 4601insert into t2 values (NULL) ; 4602execute stmt1 ; 4603last_insert_id() 46041 4605insert into t2 values (NULL) ; 4606execute stmt1 ; 4607last_insert_id() 46082 4609drop table t2 ; 4610set @1000=1000 ; 4611set @x1000_2="x1000_2" ; 4612set @x1000_3="x1000_3" ; 4613set @x1000="x1000" ; 4614set @1100=1100 ; 4615set @x1100="x1100" ; 4616set @100=100 ; 4617set @updated="updated" ; 4618insert into t1 values(1000,'x1000_1') ; 4619insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) 4620on duplicate key update a = a + @100, b = concat(b,@updated) ; 4621select a,b from t1 where a >= 1000 order by a ; 4622a b 46231000 x1000_3 46241100 x1000_1updated 4625delete from t1 where a >= 1000 ; 4626insert into t1 values(1000,'x1000_1') ; 4627prepare stmt1 from ' insert into t1 values(?,?),(?,?) 4628 on duplicate key update a = a + ?, b = concat(b,?) '; 4629execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; 4630select a,b from t1 where a >= 1000 order by a ; 4631a b 46321000 x1000_3 46331100 x1000_1updated 4634delete from t1 where a >= 1000 ; 4635insert into t1 values(1000,'x1000_1') ; 4636execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; 4637select a,b from t1 where a >= 1000 order by a ; 4638a b 46391200 x1000_1updatedupdated 4640delete from t1 where a >= 1000 ; 4641prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; 4642execute stmt1; 4643execute stmt1; 4644execute stmt1; 4645test_sequence 4646------ multi table tests ------ 4647delete from t1 ; 4648delete from t9 ; 4649insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; 4650insert into t9 (c1,c21) 4651values (1, 'one'), (2, 'two'), (3, 'three') ; 4652prepare stmt_delete from " delete t1, t9 4653 from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; 4654prepare stmt_update from " update t1, t9 4655 set t1.b='updated', t9.c21='updated' 4656 where t1.a=t9.c1 and t1.a=? "; 4657prepare stmt_select1 from " select a, b from t1 order by a" ; 4658prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; 4659set @arg00= 1 ; 4660execute stmt_update using @arg00 ; 4661execute stmt_delete ; 4662execute stmt_select1 ; 4663a b 46642 two 46653 three 4666execute stmt_select2 ; 4667c1 c21 46682 two 46693 three 4670set @arg00= @arg00 + 1 ; 4671execute stmt_update using @arg00 ; 4672execute stmt_delete ; 4673execute stmt_select1 ; 4674a b 46753 three 4676execute stmt_select2 ; 4677c1 c21 46783 three 4679set @arg00= @arg00 + 1 ; 4680execute stmt_update using @arg00 ; 4681execute stmt_delete ; 4682execute stmt_select1 ; 4683a b 4684execute stmt_select2 ; 4685c1 c21 4686set @arg00= @arg00 + 1 ; 4687drop table if exists t5 ; 4688set @arg01= 8; 4689set @arg02= 8.0; 4690set @arg03= 80.00000000000e-1; 4691set @arg04= 'abc' ; 4692set @arg05= CAST('abc' as binary) ; 4693set @arg06= '1991-08-05' ; 4694set @arg07= CAST('1991-08-05' as date); 4695set @arg08= '1991-08-05 01:01:01' ; 4696set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; 4697set @arg10= unix_timestamp('1991-01-01 01:01:01'); 4698set @arg11= YEAR('1991-01-01 01:01:01'); 4699set @arg12= 8 ; 4700set @arg12= NULL ; 4701set @arg13= 8.0 ; 4702set @arg13= NULL ; 4703set @arg14= 'abc'; 4704set @arg14= NULL ; 4705set @arg15= CAST('abc' as binary) ; 4706set @arg15= NULL ; 4707create table t5 as select 47088 as const01, @arg01 as param01, 47098.0 as const02, @arg02 as param02, 471080.00000000000e-1 as const03, @arg03 as param03, 4711'abc' as const04, @arg04 as param04, 4712CAST('abc' as binary) as const05, @arg05 as param05, 4713'1991-08-05' as const06, @arg06 as param06, 4714CAST('1991-08-05' as date) as const07, @arg07 as param07, 4715'1991-08-05 01:01:01' as const08, @arg08 as param08, 4716CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, 4717unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, 4718YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, 4719NULL as const12, @arg12 as param12, 4720@arg13 as param13, 4721@arg14 as param14, 4722@arg15 as param15; 4723show create table t5 ; 4724Table Create Table 4725t5 CREATE TABLE `t5` ( 4726 `const01` int(1) NOT NULL DEFAULT '0', 4727 `param01` bigint(20) DEFAULT NULL, 4728 `const02` decimal(2,1) NOT NULL DEFAULT '0.0', 4729 `param02` decimal(65,30) DEFAULT NULL, 4730 `const03` double NOT NULL DEFAULT '0', 4731 `param03` double DEFAULT NULL, 4732 `const04` varchar(3) NOT NULL DEFAULT '', 4733 `param04` longtext, 4734 `const05` varbinary(3) NOT NULL DEFAULT '', 4735 `param05` longblob, 4736 `const06` varchar(10) NOT NULL DEFAULT '', 4737 `param06` longtext, 4738 `const07` date DEFAULT NULL, 4739 `param07` longtext, 4740 `const08` varchar(19) NOT NULL DEFAULT '', 4741 `param08` longtext, 4742 `const09` datetime DEFAULT NULL, 4743 `param09` longtext, 4744 `const10` int(11) NOT NULL DEFAULT '0', 4745 `param10` bigint(20) DEFAULT NULL, 4746 `const11` int(4) DEFAULT NULL, 4747 `param11` bigint(20) DEFAULT NULL, 4748 `const12` binary(0) DEFAULT NULL, 4749 `param12` bigint(20) DEFAULT NULL, 4750 `param13` decimal(65,30) DEFAULT NULL, 4751 `param14` longtext, 4752 `param15` longblob 4753) ENGINE=MyISAM DEFAULT CHARSET=latin1 4754select * from t5 ; 4755Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 4756def test t5 t5 const01 const01 3 1 1 N 32769 0 63 4757def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 4758def test t5 t5 const02 const02 246 4 3 N 32769 1 63 4759def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 4760def test t5 t5 const03 const03 5 17 1 N 32769 31 63 4761def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 4762def test t5 t5 const04 const04 253 3 3 N 1 0 8 4763def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 4764def test t5 t5 const05 const05 253 3 3 N 129 0 63 4765def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 4766def test t5 t5 const06 const06 253 10 10 N 1 0 8 4767def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 4768def test t5 t5 const07 const07 10 10 10 Y 128 0 63 4769def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 4770def test t5 t5 const08 const08 253 19 19 N 1 0 8 4771def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 4772def test t5 t5 const09 const09 12 19 19 Y 128 0 63 4773def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 4774def test t5 t5 const10 const10 3 11 9 N 32769 0 63 4775def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 4776def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 4777def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 4778def test t5 t5 const12 const12 254 0 0 Y 128 0 63 4779def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 4780def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 4781def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 4782def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 4783const01 8 4784param01 8 4785const02 8.0 4786param02 8.000000000000000000000000000000 4787const03 8 4788param03 8 4789const04 abc 4790param04 abc 4791const05 abc 4792param05 abc 4793const06 1991-08-05 4794param06 1991-08-05 4795const07 1991-08-05 4796param07 1991-08-05 4797const08 1991-08-05 01:01:01 4798param08 1991-08-05 01:01:01 4799const09 1991-08-05 01:01:01 4800param09 1991-08-05 01:01:01 4801const10 662680861 4802param10 662680861 4803const11 1991 4804param11 1991 4805const12 NULL 4806param12 NULL 4807param13 NULL 4808param14 NULL 4809param15 NULL 4810drop table t5 ; 4811test_sequence 4812------ data type conversion tests ------ 4813delete from t1 ; 4814insert into t1 values (1,'one'); 4815insert into t1 values (2,'two'); 4816insert into t1 values (3,'three'); 4817insert into t1 values (4,'four'); 4818commit ; 4819delete from t9 ; 4820insert into t9 4821set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, 4822c10= 1, c11= 1, c12 = 1, 4823c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4824c16= '11:11:11', c17= '2004', 4825c18= 1, c19=true, c20= 'a', c21= '123456789a', 4826c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4827c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4828c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; 4829insert into t9 4830set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, 4831c10= 9, c11= 9, c12 = 9, 4832c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', 4833c16= '11:11:11', c17= '2004', 4834c18= 1, c19=false, c20= 'a', c21= '123456789a', 4835c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', 4836c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', 4837c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; 4838commit ; 4839insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; 4840select * from t9 order by c1 ; 4841c1 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 48420 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 48431 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 48449 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 4845test_sequence 4846------ select @parameter:= column ------ 4847prepare full_info from "select @arg01, @arg02, @arg03, @arg04, 4848 @arg05, @arg06, @arg07, @arg08, 4849 @arg09, @arg10, @arg11, @arg12, 4850 @arg13, @arg14, @arg15, @arg16, 4851 @arg17, @arg18, @arg19, @arg20, 4852 @arg21, @arg22, @arg23, @arg24, 4853 @arg25, @arg26, @arg27, @arg28, 4854 @arg29, @arg30, @arg31, @arg32" ; 4855select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 4856@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 4857@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 4858@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 4859@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 4860@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 4861@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 4862@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 4863from t9 where c1= 1 ; 4864@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 48651 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 4866execute full_info ; 4867Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 4868def @arg01 8 20 1 Y 32896 0 63 4869def @arg02 8 20 1 Y 32896 0 63 4870def @arg03 8 20 1 Y 32896 0 63 4871def @arg04 8 20 1 Y 32896 0 63 4872def @arg05 8 20 1 Y 32896 0 63 4873def @arg06 8 20 1 Y 32896 0 63 4874def @arg07 5 23 1 Y 32896 31 63 4875def @arg08 5 23 1 Y 32896 31 63 4876def @arg09 5 23 1 Y 32896 31 63 4877def @arg10 5 23 1 Y 32896 31 63 4878def @arg11 246 83 6 Y 32896 30 63 4879def @arg12 246 83 6 Y 32896 30 63 4880def @arg13 250 16777215 10 Y 0 31 8 4881def @arg14 250 16777215 19 Y 0 31 8 4882def @arg15 250 16777215 19 Y 0 31 8 4883def @arg16 250 16777215 8 Y 0 31 8 4884def @arg17 8 20 4 Y 32928 0 63 4885def @arg18 8 20 1 Y 32896 0 63 4886def @arg19 8 20 1 Y 32896 0 63 4887def @arg20 250 16777215 1 Y 0 31 8 4888def @arg21 250 16777215 10 Y 0 31 8 4889def @arg22 250 16777215 30 Y 0 31 8 4890def @arg23 250 16777215 8 Y 128 31 63 4891def @arg24 250 16777215 8 Y 0 31 8 4892def @arg25 250 16777215 4 Y 128 31 63 4893def @arg26 250 16777215 4 Y 0 31 8 4894def @arg27 250 16777215 10 Y 128 31 63 4895def @arg28 250 16777215 10 Y 0 31 8 4896def @arg29 250 16777215 8 Y 128 31 63 4897def @arg30 250 16777215 8 Y 0 31 8 4898def @arg31 250 16777215 3 Y 0 31 8 4899def @arg32 250 16777215 6 Y 0 31 8 4900@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 49011 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 4902select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 4903@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 4904@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 4905@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 4906@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 4907@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 4908@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 4909@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 4910from t9 where c1= 0 ; 4911@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 49120 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 4913execute full_info ; 4914Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 4915def @arg01 8 20 1 Y 32896 0 63 4916def @arg02 8 20 0 Y 32896 0 63 4917def @arg03 8 20 0 Y 32896 0 63 4918def @arg04 8 20 0 Y 32896 0 63 4919def @arg05 8 20 0 Y 32896 0 63 4920def @arg06 8 20 0 Y 32896 0 63 4921def @arg07 5 23 0 Y 32896 31 63 4922def @arg08 5 23 0 Y 32896 31 63 4923def @arg09 5 23 0 Y 32896 31 63 4924def @arg10 5 23 0 Y 32896 31 63 4925def @arg11 246 83 0 Y 32896 30 63 4926def @arg12 246 83 0 Y 32896 30 63 4927def @arg13 250 16777215 0 Y 0 31 8 4928def @arg14 250 16777215 0 Y 0 31 8 4929def @arg15 250 16777215 19 Y 0 31 8 4930def @arg16 250 16777215 0 Y 0 31 8 4931def @arg17 8 20 0 Y 32928 0 63 4932def @arg18 8 20 0 Y 32896 0 63 4933def @arg19 8 20 0 Y 32896 0 63 4934def @arg20 250 16777215 0 Y 0 31 8 4935def @arg21 250 16777215 0 Y 0 31 8 4936def @arg22 250 16777215 0 Y 0 31 8 4937def @arg23 250 16777215 0 Y 128 31 63 4938def @arg24 250 16777215 0 Y 0 31 8 4939def @arg25 250 16777215 0 Y 128 31 63 4940def @arg26 250 16777215 0 Y 0 31 8 4941def @arg27 250 16777215 0 Y 128 31 63 4942def @arg28 250 16777215 0 Y 0 31 8 4943def @arg29 250 16777215 0 Y 128 31 63 4944def @arg30 250 16777215 0 Y 0 31 8 4945def @arg31 250 16777215 0 Y 0 31 8 4946def @arg32 250 16777215 0 Y 0 31 8 4947@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 49480 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 4949prepare stmt1 from "select 4950 @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, 4951 @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, 4952 @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, 4953 @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, 4954 @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, 4955 @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, 4956 @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, 4957 @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 4958from t9 where c1= ?" ; 4959set @my_key= 1 ; 4960execute stmt1 using @my_key ; 4961@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 49621 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 4963execute full_info ; 4964Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 4965def @arg01 8 20 1 Y 32896 0 63 4966def @arg02 8 20 1 Y 32896 0 63 4967def @arg03 8 20 1 Y 32896 0 63 4968def @arg04 8 20 1 Y 32896 0 63 4969def @arg05 8 20 1 Y 32896 0 63 4970def @arg06 8 20 1 Y 32896 0 63 4971def @arg07 5 23 1 Y 32896 31 63 4972def @arg08 5 23 1 Y 32896 31 63 4973def @arg09 5 23 1 Y 32896 31 63 4974def @arg10 5 23 1 Y 32896 31 63 4975def @arg11 246 83 6 Y 32896 30 63 4976def @arg12 246 83 6 Y 32896 30 63 4977def @arg13 250 16777215 10 Y 0 31 8 4978def @arg14 250 16777215 19 Y 0 31 8 4979def @arg15 250 16777215 19 Y 0 31 8 4980def @arg16 250 16777215 8 Y 0 31 8 4981def @arg17 8 20 4 Y 32928 0 63 4982def @arg18 8 20 1 Y 32896 0 63 4983def @arg19 8 20 1 Y 32896 0 63 4984def @arg20 250 16777215 1 Y 0 31 8 4985def @arg21 250 16777215 10 Y 0 31 8 4986def @arg22 250 16777215 30 Y 0 31 8 4987def @arg23 250 16777215 8 Y 128 31 63 4988def @arg24 250 16777215 8 Y 0 31 8 4989def @arg25 250 16777215 4 Y 128 31 63 4990def @arg26 250 16777215 4 Y 0 31 8 4991def @arg27 250 16777215 10 Y 128 31 63 4992def @arg28 250 16777215 10 Y 0 31 8 4993def @arg29 250 16777215 8 Y 128 31 63 4994def @arg30 250 16777215 8 Y 0 31 8 4995def @arg31 250 16777215 3 Y 0 31 8 4996def @arg32 250 16777215 6 Y 0 31 8 4997@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 49981 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 4999set @my_key= 0 ; 5000execute stmt1 using @my_key ; 5001@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 50020 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 5003execute full_info ; 5004Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 5005def @arg01 8 20 1 Y 32896 0 63 5006def @arg02 8 20 0 Y 32896 0 63 5007def @arg03 8 20 0 Y 32896 0 63 5008def @arg04 8 20 0 Y 32896 0 63 5009def @arg05 8 20 0 Y 32896 0 63 5010def @arg06 8 20 0 Y 32896 0 63 5011def @arg07 5 23 0 Y 32896 31 63 5012def @arg08 5 23 0 Y 32896 31 63 5013def @arg09 5 23 0 Y 32896 31 63 5014def @arg10 5 23 0 Y 32896 31 63 5015def @arg11 246 83 0 Y 32896 30 63 5016def @arg12 246 83 0 Y 32896 30 63 5017def @arg13 250 16777215 0 Y 0 31 8 5018def @arg14 250 16777215 0 Y 0 31 8 5019def @arg15 250 16777215 19 Y 0 31 8 5020def @arg16 250 16777215 0 Y 0 31 8 5021def @arg17 8 20 0 Y 32928 0 63 5022def @arg18 8 20 0 Y 32896 0 63 5023def @arg19 8 20 0 Y 32896 0 63 5024def @arg20 250 16777215 0 Y 0 31 8 5025def @arg21 250 16777215 0 Y 0 31 8 5026def @arg22 250 16777215 0 Y 0 31 8 5027def @arg23 250 16777215 0 Y 128 31 63 5028def @arg24 250 16777215 0 Y 0 31 8 5029def @arg25 250 16777215 0 Y 128 31 63 5030def @arg26 250 16777215 0 Y 0 31 8 5031def @arg27 250 16777215 0 Y 128 31 63 5032def @arg28 250 16777215 0 Y 0 31 8 5033def @arg29 250 16777215 0 Y 128 31 63 5034def @arg30 250 16777215 0 Y 0 31 8 5035def @arg31 250 16777215 0 Y 0 31 8 5036def @arg32 250 16777215 0 Y 0 31 8 5037@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 50380 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 5039prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; 5040ERROR 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 5041test_sequence 5042------ select column, .. into @parm,.. ------ 5043select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 5044c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 5045c25, c26, c27, c28, c29, c30, c31, c32 5046into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 5047@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 5048@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 5049@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 5050from t9 where c1= 1 ; 5051execute full_info ; 5052Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 5053def @arg01 8 20 1 Y 32896 0 63 5054def @arg02 8 20 1 Y 32896 0 63 5055def @arg03 8 20 1 Y 32896 0 63 5056def @arg04 8 20 1 Y 32896 0 63 5057def @arg05 8 20 1 Y 32896 0 63 5058def @arg06 8 20 1 Y 32896 0 63 5059def @arg07 5 23 1 Y 32896 31 63 5060def @arg08 5 23 1 Y 32896 31 63 5061def @arg09 5 23 1 Y 32896 31 63 5062def @arg10 5 23 1 Y 32896 31 63 5063def @arg11 246 83 6 Y 32896 30 63 5064def @arg12 246 83 6 Y 32896 30 63 5065def @arg13 250 16777215 10 Y 0 31 8 5066def @arg14 250 16777215 19 Y 0 31 8 5067def @arg15 250 16777215 19 Y 0 31 8 5068def @arg16 250 16777215 8 Y 0 31 8 5069def @arg17 8 20 4 Y 32928 0 63 5070def @arg18 8 20 1 Y 32896 0 63 5071def @arg19 8 20 1 Y 32896 0 63 5072def @arg20 250 16777215 1 Y 0 31 8 5073def @arg21 250 16777215 10 Y 0 31 8 5074def @arg22 250 16777215 30 Y 0 31 8 5075def @arg23 250 16777215 8 Y 128 31 63 5076def @arg24 250 16777215 8 Y 0 31 8 5077def @arg25 250 16777215 4 Y 128 31 63 5078def @arg26 250 16777215 4 Y 0 31 8 5079def @arg27 250 16777215 10 Y 128 31 63 5080def @arg28 250 16777215 10 Y 0 31 8 5081def @arg29 250 16777215 8 Y 128 31 63 5082def @arg30 250 16777215 8 Y 0 31 8 5083def @arg31 250 16777215 3 Y 0 31 8 5084def @arg32 250 16777215 6 Y 0 31 8 5085@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 50861 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 5087select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 5088c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 5089c25, c26, c27, c28, c29, c30, c31, c32 5090into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 5091@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 5092@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 5093@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 5094from t9 where c1= 0 ; 5095execute full_info ; 5096Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 5097def @arg01 8 20 1 Y 32896 0 63 5098def @arg02 8 20 0 Y 32896 0 63 5099def @arg03 8 20 0 Y 32896 0 63 5100def @arg04 8 20 0 Y 32896 0 63 5101def @arg05 8 20 0 Y 32896 0 63 5102def @arg06 8 20 0 Y 32896 0 63 5103def @arg07 5 23 0 Y 32896 31 63 5104def @arg08 5 23 0 Y 32896 31 63 5105def @arg09 5 23 0 Y 32896 31 63 5106def @arg10 5 23 0 Y 32896 31 63 5107def @arg11 246 83 0 Y 32896 30 63 5108def @arg12 246 83 0 Y 32896 30 63 5109def @arg13 250 16777215 0 Y 0 31 8 5110def @arg14 250 16777215 0 Y 0 31 8 5111def @arg15 250 16777215 19 Y 0 31 8 5112def @arg16 250 16777215 0 Y 0 31 8 5113def @arg17 8 20 0 Y 32928 0 63 5114def @arg18 8 20 0 Y 32896 0 63 5115def @arg19 8 20 0 Y 32896 0 63 5116def @arg20 250 16777215 0 Y 0 31 8 5117def @arg21 250 16777215 0 Y 0 31 8 5118def @arg22 250 16777215 0 Y 0 31 8 5119def @arg23 250 16777215 0 Y 128 31 63 5120def @arg24 250 16777215 0 Y 0 31 8 5121def @arg25 250 16777215 0 Y 128 31 63 5122def @arg26 250 16777215 0 Y 0 31 8 5123def @arg27 250 16777215 0 Y 128 31 63 5124def @arg28 250 16777215 0 Y 0 31 8 5125def @arg29 250 16777215 0 Y 128 31 63 5126def @arg30 250 16777215 0 Y 0 31 8 5127def @arg31 250 16777215 0 Y 0 31 8 5128def @arg32 250 16777215 0 Y 0 31 8 5129@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 51300 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 5131prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 5132 c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, 5133 c25, c26, c27, c28, c29, c30, c31, c32 5134into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, 5135 @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, 5136 @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, 5137 @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 5138from t9 where c1= ?" ; 5139set @my_key= 1 ; 5140execute stmt1 using @my_key ; 5141execute full_info ; 5142Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 5143def @arg01 8 20 1 Y 32896 0 63 5144def @arg02 8 20 1 Y 32896 0 63 5145def @arg03 8 20 1 Y 32896 0 63 5146def @arg04 8 20 1 Y 32896 0 63 5147def @arg05 8 20 1 Y 32896 0 63 5148def @arg06 8 20 1 Y 32896 0 63 5149def @arg07 5 23 1 Y 32896 31 63 5150def @arg08 5 23 1 Y 32896 31 63 5151def @arg09 5 23 1 Y 32896 31 63 5152def @arg10 5 23 1 Y 32896 31 63 5153def @arg11 246 83 6 Y 32896 30 63 5154def @arg12 246 83 6 Y 32896 30 63 5155def @arg13 250 16777215 10 Y 0 31 8 5156def @arg14 250 16777215 19 Y 0 31 8 5157def @arg15 250 16777215 19 Y 0 31 8 5158def @arg16 250 16777215 8 Y 0 31 8 5159def @arg17 8 20 4 Y 32928 0 63 5160def @arg18 8 20 1 Y 32896 0 63 5161def @arg19 8 20 1 Y 32896 0 63 5162def @arg20 250 16777215 1 Y 0 31 8 5163def @arg21 250 16777215 10 Y 0 31 8 5164def @arg22 250 16777215 30 Y 0 31 8 5165def @arg23 250 16777215 8 Y 128 31 63 5166def @arg24 250 16777215 8 Y 0 31 8 5167def @arg25 250 16777215 4 Y 128 31 63 5168def @arg26 250 16777215 4 Y 0 31 8 5169def @arg27 250 16777215 10 Y 128 31 63 5170def @arg28 250 16777215 10 Y 0 31 8 5171def @arg29 250 16777215 8 Y 128 31 63 5172def @arg30 250 16777215 8 Y 0 31 8 5173def @arg31 250 16777215 3 Y 0 31 8 5174def @arg32 250 16777215 6 Y 0 31 8 5175@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 51761 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 5177set @my_key= 0 ; 5178execute stmt1 using @my_key ; 5179execute full_info ; 5180Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr 5181def @arg01 8 20 1 Y 32896 0 63 5182def @arg02 8 20 0 Y 32896 0 63 5183def @arg03 8 20 0 Y 32896 0 63 5184def @arg04 8 20 0 Y 32896 0 63 5185def @arg05 8 20 0 Y 32896 0 63 5186def @arg06 8 20 0 Y 32896 0 63 5187def @arg07 5 23 0 Y 32896 31 63 5188def @arg08 5 23 0 Y 32896 31 63 5189def @arg09 5 23 0 Y 32896 31 63 5190def @arg10 5 23 0 Y 32896 31 63 5191def @arg11 246 83 0 Y 32896 30 63 5192def @arg12 246 83 0 Y 32896 30 63 5193def @arg13 250 16777215 0 Y 0 31 8 5194def @arg14 250 16777215 0 Y 0 31 8 5195def @arg15 250 16777215 19 Y 0 31 8 5196def @arg16 250 16777215 0 Y 0 31 8 5197def @arg17 8 20 0 Y 32928 0 63 5198def @arg18 8 20 0 Y 32896 0 63 5199def @arg19 8 20 0 Y 32896 0 63 5200def @arg20 250 16777215 0 Y 0 31 8 5201def @arg21 250 16777215 0 Y 0 31 8 5202def @arg22 250 16777215 0 Y 0 31 8 5203def @arg23 250 16777215 0 Y 128 31 63 5204def @arg24 250 16777215 0 Y 0 31 8 5205def @arg25 250 16777215 0 Y 128 31 63 5206def @arg26 250 16777215 0 Y 0 31 8 5207def @arg27 250 16777215 0 Y 128 31 63 5208def @arg28 250 16777215 0 Y 0 31 8 5209def @arg29 250 16777215 0 Y 128 31 63 5210def @arg30 250 16777215 0 Y 0 31 8 5211def @arg31 250 16777215 0 Y 0 31 8 5212def @arg32 250 16777215 0 Y 0 31 8 5213@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 52140 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 5215prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; 5216ERROR 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 5217test_sequence 5218-- insert into numeric columns -- 5219insert into t9 5220( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5221values 5222( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; 5223set @arg00= 21 ; 5224insert into t9 5225( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5226values 5227( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5228@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5229prepare stmt1 from "insert into t9 5230 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5231values 5232 ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; 5233execute stmt1 ; 5234set @arg00= 23; 5235prepare stmt2 from "insert into t9 5236 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5237values 5238 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5239execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5240@arg00, @arg00, @arg00, @arg00 ; 5241insert into t9 5242( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5243values 5244( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 524530.0, 30.0, 30.0 ) ; 5246set @arg00= 31.0 ; 5247insert into t9 5248( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5249values 5250( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5251@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5252prepare stmt1 from "insert into t9 5253 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5254values 5255 ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 5256 32.0, 32.0, 32.0 )" ; 5257execute stmt1 ; 5258set @arg00= 33.0; 5259prepare stmt2 from "insert into t9 5260 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5261values 5262 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5263execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5264@arg00, @arg00, @arg00, @arg00 ; 5265insert into t9 5266( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5267values 5268( '40', '40', '40', '40', '40', '40', '40', '40', 5269'40', '40', '40' ) ; 5270set @arg00= '41' ; 5271insert into t9 5272( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5273values 5274( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5275@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5276prepare stmt1 from "insert into t9 5277 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5278values 5279 ( '42', '42', '42', '42', '42', '42', '42', '42', 5280 '42', '42', '42' )" ; 5281execute stmt1 ; 5282set @arg00= '43'; 5283prepare stmt2 from "insert into t9 5284 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5285values 5286 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5287execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5288@arg00, @arg00, @arg00, @arg00 ; 5289insert into t9 5290( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5291values 5292( CAST('50' as binary), CAST('50' as binary), 5293CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 5294CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), 5295CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; 5296set @arg00= CAST('51' as binary) ; 5297insert into t9 5298( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5299values 5300( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5301@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5302prepare stmt1 from "insert into t9 5303 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5304values 5305 ( CAST('52' as binary), CAST('52' as binary), 5306 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 5307 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), 5308 CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; 5309execute stmt1 ; 5310set @arg00= CAST('53' as binary) ; 5311prepare stmt2 from "insert into t9 5312 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5313values 5314 ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5315execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5316@arg00, @arg00, @arg00, @arg00 ; 5317set @arg00= 2 ; 5318set @arg00= NULL ; 5319insert into t9 5320( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5321values 5322( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 5323NULL, NULL, NULL ) ; 5324insert into t9 5325( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5326values 5327( 61, @arg00, @arg00, @arg00, @arg00, @arg00, 5328@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5329prepare stmt1 from "insert into t9 5330 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5331values 5332 ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 5333 NULL, NULL, NULL )" ; 5334execute stmt1 ; 5335prepare stmt2 from "insert into t9 5336 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5337values 5338 ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5339execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5340@arg00, @arg00, @arg00, @arg00 ; 5341set @arg00= 8.0 ; 5342set @arg00= NULL ; 5343insert into t9 5344( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5345values 5346( 71, @arg00, @arg00, @arg00, @arg00, @arg00, 5347@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5348prepare stmt2 from "insert into t9 5349 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5350values 5351 ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5352execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5353@arg00, @arg00, @arg00, @arg00 ; 5354set @arg00= 'abc' ; 5355set @arg00= NULL ; 5356insert into t9 5357( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5358values 5359( 81, @arg00, @arg00, @arg00, @arg00, @arg00, 5360@arg00, @arg00, @arg00, @arg00, @arg00 ) ; 5361prepare stmt2 from "insert into t9 5362 ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5363values 5364 ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5365execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5366@arg00, @arg00, @arg00, @arg00 ; 5367select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 5368from t9 where c1 >= 20 5369order by c1 ; 5370c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 537120 20 20 20 20 20 20 20 20 20 20.0000 537221 21 21 21 21 21 21 21 21 21 21.0000 537322 22 22 22 22 22 22 22 22 22 22.0000 537423 23 23 23 23 23 23 23 23 23 23.0000 537530 30 30 30 30 30 30 30 30 30 30.0000 537631 31 31 31 31 31 31 31 31 31 31.0000 537732 32 32 32 32 32 32 32 32 32 32.0000 537833 33 33 33 33 33 33 33 33 33 33.0000 537940 40 40 40 40 40 40 40 40 40 40.0000 538041 41 41 41 41 41 41 41 41 41 41.0000 538142 42 42 42 42 42 42 42 42 42 42.0000 538243 43 43 43 43 43 43 43 43 43 43.0000 538350 50 50 50 50 50 50 50 50 50 50.0000 538451 51 51 51 51 51 51 51 51 51 51.0000 538552 52 52 52 52 52 52 52 52 52 52.0000 538653 53 53 53 53 53 53 53 53 53 53.0000 538760 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 538861 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 538962 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 539063 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 539171 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 539273 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 539381 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 539483 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 5395test_sequence 5396-- select .. where numeric column = .. -- 5397set @arg00= 20; 5398select 'true' as found from t9 5399where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 5400and c8= 20 and c9= 20 and c10= 20 and c12= 20; 5401found 5402true 5403select 'true' as found from t9 5404where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 5405and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 5406and c12= @arg00; 5407found 5408true 5409prepare stmt1 from "select 'true' as found from t9 5410where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 5411 and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; 5412execute stmt1 ; 5413found 5414true 5415prepare stmt1 from "select 'true' as found from t9 5416where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 5417 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 5418 and c12= ? "; 5419execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5420@arg00, @arg00, @arg00, @arg00 ; 5421found 5422true 5423set @arg00= 20.0; 5424select 'true' as found from t9 5425where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 5426and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; 5427found 5428true 5429select 'true' as found from t9 5430where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 5431and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 5432and c12= @arg00; 5433found 5434true 5435prepare stmt1 from "select 'true' as found from t9 5436where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 5437 and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; 5438execute stmt1 ; 5439found 5440true 5441prepare stmt1 from "select 'true' as found from t9 5442where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 5443 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 5444 and c12= ? "; 5445execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5446@arg00, @arg00, @arg00, @arg00 ; 5447found 5448true 5449select 'true' as found from t9 5450where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' 5451 and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; 5452found 5453true 5454prepare stmt1 from "select 'true' as found from t9 5455where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' 5456 and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; 5457execute stmt1 ; 5458found 5459true 5460set @arg00= '20'; 5461select 'true' as found from t9 5462where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 5463and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 5464and c12= @arg00; 5465found 5466true 5467prepare stmt1 from "select 'true' as found from t9 5468where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 5469 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 5470 and c12= ? "; 5471execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5472@arg00, @arg00, @arg00, @arg00 ; 5473found 5474true 5475select 'true' as found from t9 5476where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 5477c3= CAST('20' as binary) and c4= CAST('20' as binary) and 5478c5= CAST('20' as binary) and c6= CAST('20' as binary) and 5479c7= CAST('20' as binary) and c8= CAST('20' as binary) and 5480c9= CAST('20' as binary) and c10= CAST('20' as binary) and 5481c12= CAST('20' as binary); 5482found 5483true 5484prepare stmt1 from "select 'true' as found from t9 5485where c1= CAST('20' as binary) and c2= CAST('20' as binary) and 5486 c3= CAST('20' as binary) and c4= CAST('20' as binary) and 5487 c5= CAST('20' as binary) and c6= CAST('20' as binary) and 5488 c7= CAST('20' as binary) and c8= CAST('20' as binary) and 5489 c9= CAST('20' as binary) and c10= CAST('20' as binary) and 5490 c12= CAST('20' as binary) "; 5491execute stmt1 ; 5492found 5493true 5494set @arg00= CAST('20' as binary) ; 5495select 'true' as found from t9 5496where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 5497and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 5498and c12= @arg00; 5499found 5500true 5501prepare stmt1 from "select 'true' as found from t9 5502where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? 5503 and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? 5504 and c12= ? "; 5505execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5506@arg00, @arg00, @arg00, @arg00 ; 5507found 5508true 5509delete from t9 ; 5510test_sequence 5511-- some numeric overflow experiments -- 5512prepare my_insert from "insert into t9 5513 ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) 5514values 5515 ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; 5516prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 5517from t9 where c21 = 'O' "; 5518prepare my_delete from "delete from t9 where c21 = 'O' "; 5519set @arg00= 9223372036854775807 ; 5520execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5521@arg00, @arg00, @arg00, @arg00, @arg00 ; 5522Warnings: 5523Warning 1264 Out of range value for column 'c1' at row 1 5524Warning 1264 Out of range value for column 'c2' at row 1 5525Warning 1264 Out of range value for column 'c3' at row 1 5526Warning 1264 Out of range value for column 'c4' at row 1 5527Warning 1264 Out of range value for column 'c5' at row 1 5528Warning 1264 Out of range value for column 'c12' at row 1 5529execute my_select ; 5530c1 127 5531c2 32767 5532c3 8388607 5533c4 2147483647 5534c5 2147483647 5535c6 9223372036854775807 5536c7 9.22337e18 5537c8 9.223372036854776e18 5538c9 9.223372036854776e18 5539c10 9.223372036854776e18 5540c12 9999.9999 5541execute my_delete ; 5542set @arg00= '9223372036854775807' ; 5543execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5544@arg00, @arg00, @arg00, @arg00, @arg00 ; 5545Warnings: 5546Warning 1264 Out of range value for column 'c1' at row 1 5547Warning 1264 Out of range value for column 'c2' at row 1 5548Warning 1264 Out of range value for column 'c3' at row 1 5549Warning 1264 Out of range value for column 'c4' at row 1 5550Warning 1264 Out of range value for column 'c5' at row 1 5551Warning 1264 Out of range value for column 'c12' at row 1 5552execute my_select ; 5553c1 127 5554c2 32767 5555c3 8388607 5556c4 2147483647 5557c5 2147483647 5558c6 9223372036854775807 5559c7 9.22337e18 5560c8 9.223372036854776e18 5561c9 9.223372036854776e18 5562c10 9.223372036854776e18 5563c12 9999.9999 5564execute my_delete ; 5565set @arg00= -9223372036854775808 ; 5566execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5567@arg00, @arg00, @arg00, @arg00, @arg00 ; 5568Warnings: 5569Warning 1264 Out of range value for column 'c1' at row 1 5570Warning 1264 Out of range value for column 'c2' at row 1 5571Warning 1264 Out of range value for column 'c3' at row 1 5572Warning 1264 Out of range value for column 'c4' at row 1 5573Warning 1264 Out of range value for column 'c5' at row 1 5574Warning 1264 Out of range value for column 'c12' at row 1 5575execute my_select ; 5576c1 -128 5577c2 -32768 5578c3 -8388608 5579c4 -2147483648 5580c5 -2147483648 5581c6 -9223372036854775808 5582c7 -9.22337e18 5583c8 -9.223372036854776e18 5584c9 -9.223372036854776e18 5585c10 -9.223372036854776e18 5586c12 -9999.9999 5587execute my_delete ; 5588set @arg00= '-9223372036854775808' ; 5589execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5590@arg00, @arg00, @arg00, @arg00, @arg00 ; 5591Warnings: 5592Warning 1264 Out of range value for column 'c1' at row 1 5593Warning 1264 Out of range value for column 'c2' at row 1 5594Warning 1264 Out of range value for column 'c3' at row 1 5595Warning 1264 Out of range value for column 'c4' at row 1 5596Warning 1264 Out of range value for column 'c5' at row 1 5597Warning 1264 Out of range value for column 'c12' at row 1 5598execute my_select ; 5599c1 -128 5600c2 -32768 5601c3 -8388608 5602c4 -2147483648 5603c5 -2147483648 5604c6 -9223372036854775808 5605c7 -9.22337e18 5606c8 -9.223372036854776e18 5607c9 -9.223372036854776e18 5608c10 -9.223372036854776e18 5609c12 -9999.9999 5610execute my_delete ; 5611set @arg00= 1.11111111111111111111e+50 ; 5612execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5613@arg00, @arg00, @arg00, @arg00, @arg00 ; 5614Warnings: 5615Warning 1264 Out of range value for column 'c1' at row 1 5616Warning 1264 Out of range value for column 'c2' at row 1 5617Warning 1264 Out of range value for column 'c3' at row 1 5618Warning 1264 Out of range value for column 'c4' at row 1 5619Warning 1264 Out of range value for column 'c5' at row 1 5620Warning 1264 Out of range value for column 'c6' at row 1 5621Warning 1264 Out of range value for column 'c7' at row 1 5622Warning 1264 Out of range value for column 'c12' at row 1 5623execute my_select ; 5624c1 127 5625c2 32767 5626c3 8388607 5627c4 2147483647 5628c5 2147483647 5629c6 9223372036854775807 5630c7 3.40282e38 5631c8 1.111111111111111e50 5632c9 1.111111111111111e50 5633c10 1.111111111111111e50 5634c12 9999.9999 5635execute my_delete ; 5636set @arg00= '1.11111111111111111111e+50' ; 5637execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5638@arg00, @arg00, @arg00, @arg00, @arg00 ; 5639Warnings: 5640Warning 1264 Out of range value for column 'c1' at row 1 5641Warning 1264 Out of range value for column 'c2' at row 1 5642Warning 1264 Out of range value for column 'c3' at row 1 5643Warning 1264 Out of range value for column 'c4' at row 1 5644Warning 1264 Out of range value for column 'c5' at row 1 5645Warning 1264 Out of range value for column 'c6' at row 1 5646Warning 1264 Out of range value for column 'c7' at row 1 5647Warning 1264 Out of range value for column 'c12' at row 1 5648execute my_select ; 5649c1 127 5650c2 32767 5651c3 8388607 5652c4 2147483647 5653c5 2147483647 5654c6 9223372036854775807 5655c7 3.40282e38 5656c8 1.111111111111111e50 5657c9 1.111111111111111e50 5658c10 1.111111111111111e50 5659c12 9999.9999 5660execute my_delete ; 5661set @arg00= -1.11111111111111111111e+50 ; 5662execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5663@arg00, @arg00, @arg00, @arg00, @arg00 ; 5664Warnings: 5665Warning 1264 Out of range value for column 'c1' at row 1 5666Warning 1264 Out of range value for column 'c2' at row 1 5667Warning 1264 Out of range value for column 'c3' at row 1 5668Warning 1264 Out of range value for column 'c4' at row 1 5669Warning 1264 Out of range value for column 'c5' at row 1 5670Warning 1264 Out of range value for column 'c6' at row 1 5671Warning 1264 Out of range value for column 'c7' at row 1 5672Warning 1264 Out of range value for column 'c12' at row 1 5673execute my_select ; 5674c1 -128 5675c2 -32768 5676c3 -8388608 5677c4 -2147483648 5678c5 -2147483648 5679c6 -9223372036854775808 5680c7 -3.40282e38 5681c8 -1.111111111111111e50 5682c9 -1.111111111111111e50 5683c10 -1.111111111111111e50 5684c12 -9999.9999 5685execute my_delete ; 5686set @arg00= '-1.11111111111111111111e+50' ; 5687execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5688@arg00, @arg00, @arg00, @arg00, @arg00 ; 5689Warnings: 5690Warning 1264 Out of range value for column 'c1' at row 1 5691Warning 1264 Out of range value for column 'c2' at row 1 5692Warning 1264 Out of range value for column 'c3' at row 1 5693Warning 1264 Out of range value for column 'c4' at row 1 5694Warning 1264 Out of range value for column 'c5' at row 1 5695Warning 1264 Out of range value for column 'c6' at row 1 5696Warning 1264 Out of range value for column 'c7' at row 1 5697Warning 1264 Out of range value for column 'c12' at row 1 5698execute my_select ; 5699c1 -128 5700c2 -32768 5701c3 -8388608 5702c4 -2147483648 5703c5 -2147483648 5704c6 -9223372036854775808 5705c7 -3.40282e38 5706c8 -1.111111111111111e50 5707c9 -1.111111111111111e50 5708c10 -1.111111111111111e50 5709c12 -9999.9999 5710execute my_delete ; 5711test_sequence 5712-- insert into string columns -- 5713Warnings: 5714Warning 1265 Data truncated for column 'c20' at row 1 5715Warnings: 5716Warning 1265 Data truncated for column 'c20' at row 1 5717Warnings: 5718Warning 1265 Data truncated for column 'c20' at row 1 5719Warnings: 5720Warning 1265 Data truncated for column 'c20' at row 1 5721Warnings: 5722Warning 1265 Data truncated for column 'c20' at row 1 5723Warnings: 5724Warning 1265 Data truncated for column 'c20' at row 1 5725Warnings: 5726Warning 1265 Data truncated for column 'c20' at row 1 5727Warnings: 5728Warning 1265 Data truncated for column 'c20' at row 1 5729Warnings: 5730Warning 1265 Data truncated for column 'c20' at row 1 5731Warnings: 5732Warning 1265 Data truncated for column 'c20' at row 1 5733Warnings: 5734Warning 1265 Data truncated for column 'c20' at row 1 5735Warnings: 5736Warning 1265 Data truncated for column 'c20' at row 1 5737Warnings: 5738Warning 1265 Data truncated for column 'c20' at row 1 5739Warnings: 5740Warning 1265 Data truncated for column 'c20' at row 1 5741Warnings: 5742Warning 1265 Data truncated for column 'c20' at row 1 5743Warnings: 5744Warning 1265 Data truncated for column 'c20' at row 1 5745Warnings: 5746Warning 1265 Data truncated for column 'c20' at row 1 5747Warnings: 5748Warning 1265 Data truncated for column 'c20' at row 1 5749Warnings: 5750Warning 1265 Data truncated for column 'c20' at row 1 5751Warnings: 5752Warning 1265 Data truncated for column 'c20' at row 1 5753select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 5754from t9 where c1 >= 20 5755order by c1 ; 5756c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 575720 2 20 20 20 20 20 20 20 20 20 20 575821 2 21 21 21 21 21 21 21 21 21 21 575922 2 22 22 22 22 22 22 22 22 22 22 576023 2 23 23 23 23 23 23 23 23 23 23 576130 3 30 30 30 30 30 30 30 30 30 30 576231 3 31 31 31 31 31 31 31 31 31 31 576332 3 32 32 32 32 32 32 32 32 32 32 576433 3 33 33 33 33 33 33 33 33 33 33 576540 4 40 40 40 40 40 40 40 40 40 40 576641 4 41 41 41 41 41 41 41 41 41 41 576742 4 42 42 42 42 42 42 42 42 42 42 576843 4 43 43 43 43 43 43 43 43 43 43 576950 5 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 577051 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 577152 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 577253 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 577354 5 54 54 54 54 54 54 54 54 54 54 577455 6 55 55 55 55 55 55 55 55 55 55 577556 6 56 56 56 56 56 56 56 56 56 56 577657 6 57 57 57 57 57 57 57 57 57 57 577760 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 577861 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 577962 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 578063 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 578171 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 578273 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 578381 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 578483 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 5785test_sequence 5786-- select .. where string column = .. -- 5787set @arg00= '20'; 5788select 'true' as found from t9 5789where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and 5790c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and 5791c27= '20' and c28= '20' and c29= '20' and c30= '20' ; 5792found 5793true 5794select 'true' as found from t9 5795where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 5796c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 5797c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 5798found 5799true 5800prepare stmt1 from "select 'true' as found from t9 5801where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and 5802 c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and 5803 c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; 5804execute stmt1 ; 5805found 5806true 5807prepare stmt1 from "select 'true' as found from t9 5808where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 5809 c21= ? and c22= ? and c23= ? and c25= ? and 5810 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 5811execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5812@arg00, @arg00, @arg00, @arg00, @arg00 ; 5813found 5814true 5815set @arg00= CAST('20' as binary); 5816select 'true' as found from t9 5817where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) 5818= CAST('20' as binary) and c21= CAST('20' as binary) 5819and c22= CAST('20' as binary) and c23= CAST('20' as binary) and 5820c24= CAST('20' as binary) and c25= CAST('20' as binary) and 5821c26= CAST('20' as binary) and c27= CAST('20' as binary) and 5822c28= CAST('20' as binary) and c29= CAST('20' as binary) and 5823c30= CAST('20' as binary) ; 5824found 5825true 5826select 'true' as found from t9 5827where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and 5828c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 5829c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and 5830c30= @arg00; 5831found 5832true 5833prepare stmt1 from "select 'true' as found from t9 5834where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) 5835 = CAST('20' as binary) and c21= CAST('20' as binary) 5836 and c22= CAST('20' as binary) and c23= CAST('20' as binary) and 5837 c24= CAST('20' as binary) and c25= CAST('20' as binary) and 5838 c26= CAST('20' as binary) and c27= CAST('20' as binary) and 5839 c28= CAST('20' as binary) and c29= CAST('20' as binary) and 5840 c30= CAST('20' as binary)" ; 5841execute stmt1 ; 5842found 5843true 5844prepare stmt1 from "select 'true' as found from t9 5845where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and 5846 c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and 5847 c29= ? and c30= ?"; 5848execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5849@arg00, @arg00, @arg00, @arg00, @arg00 ; 5850found 5851true 5852set @arg00= 20; 5853select 'true' as found from t9 5854where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and 5855c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and 5856c27= 20 and c28= 20 and c29= 20 and c30= 20 ; 5857found 5858true 5859select 'true' as found from t9 5860where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 5861c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 5862c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 5863found 5864true 5865prepare stmt1 from "select 'true' as found from t9 5866where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and 5867 c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and 5868 c27= 20 and c28= 20 and c29= 20 and c30= 20" ; 5869execute stmt1 ; 5870found 5871true 5872prepare stmt1 from "select 'true' as found from t9 5873where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 5874 c21= ? and c22= ? and c23= ? and c25= ? and 5875 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 5876execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5877@arg00, @arg00, @arg00, @arg00, @arg00 ; 5878found 5879true 5880set @arg00= 20.0; 5881select 'true' as found from t9 5882where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and 5883c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and 5884c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; 5885found 5886true 5887select 'true' as found from t9 5888where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and 5889c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and 5890c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; 5891found 5892true 5893prepare stmt1 from "select 'true' as found from t9 5894where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and 5895 c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and 5896 c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; 5897execute stmt1 ; 5898found 5899true 5900prepare stmt1 from "select 'true' as found from t9 5901where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and 5902 c21= ? and c22= ? and c23= ? and c25= ? and 5903 c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; 5904execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, 5905@arg00, @arg00, @arg00, @arg00, @arg00 ; 5906found 5907true 5908delete from t9 ; 5909test_sequence 5910-- insert into date/time columns -- 5911Warnings: 5912Note 1265 Data truncated for column 'c13' at row 1 5913Note 1265 Data truncated for column 'c16' at row 1 5914Warning 1265 Data truncated for column 'c17' at row 1 5915Warnings: 5916Note 1265 Data truncated for column 'c13' at row 1 5917Note 1265 Data truncated for column 'c16' at row 1 5918Warning 1265 Data truncated for column 'c17' at row 1 5919Warnings: 5920Note 1265 Data truncated for column 'c13' at row 1 5921Note 1265 Data truncated for column 'c16' at row 1 5922Warning 1265 Data truncated for column 'c17' at row 1 5923Warnings: 5924Note 1265 Data truncated for column 'c13' at row 1 5925Note 1265 Data truncated for column 'c16' at row 1 5926Warning 1265 Data truncated for column 'c17' at row 1 5927Warnings: 5928Note 1265 Data truncated for column 'c13' at row 1 5929Warnings: 5930Note 1265 Data truncated for column 'c13' at row 1 5931Note 1265 Data truncated for column 'c16' at row 1 5932Warning 1265 Data truncated for column 'c17' at row 1 5933Warnings: 5934Note 1265 Data truncated for column 'c13' at row 1 5935Warnings: 5936Note 1265 Data truncated for column 'c13' at row 1 5937Note 1265 Data truncated for column 'c16' at row 1 5938Warning 1265 Data truncated for column 'c17' at row 1 5939Warnings: 5940Warning 1265 Data truncated for column 'c13' at row 1 5941Warning 1265 Data truncated for column 'c14' at row 1 5942Warning 1265 Data truncated for column 'c15' at row 1 5943Warning 1264 Out of range value for column 'c16' at row 1 5944Warning 1264 Out of range value for column 'c17' at row 1 5945Warnings: 5946Warning 1265 Data truncated for column 'c13' at row 1 5947Warning 1265 Data truncated for column 'c14' at row 1 5948Warning 1265 Data truncated for column 'c15' at row 1 5949Warning 1264 Out of range value for column 'c16' at row 1 5950Warning 1264 Out of range value for column 'c17' at row 1 5951Warnings: 5952Warning 1265 Data truncated for column 'c13' at row 1 5953Warning 1265 Data truncated for column 'c14' at row 1 5954Warning 1265 Data truncated for column 'c15' at row 1 5955Warning 1264 Out of range value for column 'c16' at row 1 5956Warning 1264 Out of range value for column 'c17' at row 1 5957Warnings: 5958Warning 1265 Data truncated for column 'c13' at row 1 5959Warning 1265 Data truncated for column 'c14' at row 1 5960Warning 1265 Data truncated for column 'c15' at row 1 5961Warning 1264 Out of range value for column 'c16' at row 1 5962Warning 1264 Out of range value for column 'c17' at row 1 5963Warnings: 5964Warning 1265 Data truncated for column 'c15' at row 1 5965Warning 1264 Out of range value for column 'c16' at row 1 5966Warning 1264 Out of range value for column 'c17' at row 1 5967Warnings: 5968Warning 1265 Data truncated for column 'c15' at row 1 5969Warning 1264 Out of range value for column 'c16' at row 1 5970Warning 1264 Out of range value for column 'c17' at row 1 5971Warnings: 5972Warning 1265 Data truncated for column 'c15' at row 1 5973Warning 1264 Out of range value for column 'c16' at row 1 5974Warning 1264 Out of range value for column 'c17' at row 1 5975Warnings: 5976Warning 1265 Data truncated for column 'c15' at row 1 5977Warning 1264 Out of range value for column 'c16' at row 1 5978Warning 1264 Out of range value for column 'c17' at row 1 5979select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; 5980c1 c13 c14 c15 c16 c17 598120 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598221 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598322 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598423 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598530 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598631 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598732 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598833 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 598940 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599041 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599142 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599243 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599350 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599451 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599552 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599653 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 599760 NULL NULL 1991-01-01 01:01:01 NULL NULL 599861 NULL NULL 1991-01-01 01:01:01 NULL NULL 599962 NULL NULL 1991-01-01 01:01:01 NULL NULL 600063 NULL NULL 1991-01-01 01:01:01 NULL NULL 600171 NULL NULL 1991-01-01 01:01:01 NULL NULL 600273 NULL NULL 1991-01-01 01:01:01 NULL NULL 600381 NULL NULL 1991-01-01 01:01:01 NULL NULL 600483 NULL NULL 1991-01-01 01:01:01 NULL NULL 6005test_sequence 6006-- select .. where date/time column = .. -- 6007set @arg00= '1991-01-01 01:01:01' ; 6008select 'true' as found from t9 6009where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and 6010c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and 6011c17= '1991-01-01 01:01:01' ; 6012found 6013true 6014select 'true' as found from t9 6015where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 6016and c17= @arg00 ; 6017found 6018true 6019prepare stmt1 from "select 'true' as found from t9 6020where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and 6021 c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and 6022 c17= '1991-01-01 01:01:01'" ; 6023execute stmt1 ; 6024found 6025true 6026prepare stmt1 from "select 'true' as found from t9 6027where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; 6028execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; 6029found 6030true 6031set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; 6032select 'true' as found from t9 6033where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and 6034c14= CAST('1991-01-01 01:01:01' as datetime) and 6035c15= CAST('1991-01-01 01:01:01' as datetime) and 6036c16= CAST('1991-01-01 01:01:01' as datetime) and 6037c17= CAST('1991-01-01 01:01:01' as datetime) ; 6038found 6039true 6040select 'true' as found from t9 6041where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 6042and c17= @arg00 ; 6043found 6044true 6045prepare stmt1 from "select 'true' as found from t9 6046where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and 6047 c14= CAST('1991-01-01 01:01:01' as datetime) and 6048 c15= CAST('1991-01-01 01:01:01' as datetime) and 6049 c16= CAST('1991-01-01 01:01:01' as datetime) and 6050 c17= CAST('1991-01-01 01:01:01' as datetime)" ; 6051execute stmt1 ; 6052found 6053true 6054prepare stmt1 from "select 'true' as found from t9 6055where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; 6056execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; 6057found 6058true 6059set @arg00= 1991 ; 6060select 'true' as found from t9 6061where c1= 20 and c17= 1991 ; 6062found 6063true 6064select 'true' as found from t9 6065where c1= 20 and c17= @arg00 ; 6066found 6067true 6068prepare stmt1 from "select 'true' as found from t9 6069where c1= 20 and c17= 1991" ; 6070execute stmt1 ; 6071found 6072true 6073prepare stmt1 from "select 'true' as found from t9 6074where c1= 20 and c17= ?" ; 6075execute stmt1 using @arg00 ; 6076found 6077true 6078set @arg00= 1.991e+3 ; 6079select 'true' as found from t9 6080where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; 6081found 6082true 6083select 'true' as found from t9 6084where c1= 20 and abs(c17 - @arg00) < 0.01 ; 6085found 6086true 6087prepare stmt1 from "select 'true' as found from t9 6088where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; 6089execute stmt1 ; 6090found 6091true 6092prepare stmt1 from "select 'true' as found from t9 6093where c1= 20 and abs(c17 - ?) < 0.01" ; 6094execute stmt1 using @arg00 ; 6095found 6096true 6097drop table t1, t1_1, t1_2, 6098t9_1, t9_2, t9; 6099