1drop table if exists t1, t2; 2CREATE TABLE t1(session_id char(9) NOT NULL); 3INSERT INTO t1 VALUES ("abc"); 4SELECT * FROM t1; 5session_id 6abc 7prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"'; 8set @arg1= 'abc'; 9execute st_1180 using @arg1; 10session_id 11set @arg1= '1111'; 12execute st_1180 using @arg1; 13session_id 14abc 15set @arg1= 'abc'; 16execute st_1180 using @arg1; 17session_id 18drop table t1; 19create table t1 ( 20c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20), 21c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time, 22c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20), 23c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text); 24prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 25set @arg01= 'row_1'; 26set @arg02= 1; 27set @arg03= 1.1; 28set @arg04= 111; 29set @arg05= 'row_one'; 30set @arg06= '2004-10-12'; 31set @arg07= '1'; 32set @arg08= 1.1; 33set @arg09= '100100100'; 34set @arg10= '12:34:56'; 35set @arg11= 'row_1'; 36set @arg12= 1; 37set @arg13= 1.1; 38set @arg14= 111; 39set @arg15= 'row_one'; 40set @arg16= '2004-10-12'; 41set @arg17= '1'; 42set @arg18= 1.1; 43set @arg19= '100100100'; 44set @arg20= '12:34:56'; 45execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10, 46@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20; 47set @arg01= NULL; 48set @arg02= NULL; 49set @arg03= NULL; 50set @arg04= NULL; 51set @arg05= NULL; 52set @arg06= NULL; 53set @arg07= NULL; 54set @arg08= NULL; 55set @arg09= NULL; 56set @arg10= NULL; 57set @arg11= NULL; 58set @arg12= NULL; 59set @arg13= NULL; 60set @arg14= NULL; 61set @arg15= NULL; 62set @arg16= NULL; 63set @arg17= NULL; 64set @arg18= NULL; 65set @arg19= NULL; 66set @arg20= NULL; 67execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10, 68@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20; 69set @arg01= 'row_3'; 70set @arg02= 3; 71set @arg03= 3.3; 72set @arg04= 333; 73set @arg05= 'row_three'; 74set @arg06= '2004-10-12'; 75set @arg07= '3'; 76set @arg08= 3.3; 77set @arg09= '300300300'; 78set @arg10= '12:34:56'; 79set @arg11= 'row_3'; 80set @arg12= 3; 81set @arg13= 3.3; 82set @arg14= 333; 83set @arg15= 'row_three'; 84set @arg16= '2004-10-12'; 85set @arg17= '3'; 86set @arg18= 3.3; 87set @arg19= '300300300'; 88set @arg20= '12:34:56'; 89execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10, 90@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20; 91select * from t1; 92c_01 c_02 c_03 c_04 c_05 c_06 c_07 c_08 c_09 c_10 c_11 c_12 c_13 c_14 c_15 c_16 c_17 c_18 c_19 c_20 93row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56 row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56 94NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 95row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56 row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56 96drop table t1; 97create table t1( 98cola varchar(50) not null, 99colb varchar(8) not null, 100colc varchar(12) not null, 101cold varchar(2) not null, 102primary key (cola, colb, cold)); 103create table t2( 104cola varchar(50) not null, 105colb varchar(8) not null, 106colc varchar(2) not null, 107cold float, 108primary key (cold)); 109insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R'); 110insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201); 111prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold'; 112set @arg0= "aaaa"; 113set @arg1= "yyyy"; 114set @arg2= "R"; 115execute st_1676 using @arg0, @arg1, @arg2; 116cola colb cold 117aaaa yyyy R 118drop table t1, t2; 119create table t1 (a int primary key); 120insert into t1 values (1); 121explain select * from t1 where 3 in (select (1+1) union select 1); 122id select_type table type possible_keys key key_len ref rows Extra 1231 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 1242 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 1253 UNION NULL NULL NULL NULL NULL NULL NULL No tables used 126NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 127select * from t1 where 3 in (select (1+1) union select 1); 128a 129prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; 130execute st_18492; 131a 132drop table t1; 133create table t1 (a int, b varchar(4)); 134create table t2 (a int, b varchar(4), primary key(a)); 135prepare stmt1 from 'insert into t1 (a, b) values (?, ?)'; 136prepare stmt2 from 'insert into t2 (a, b) values (?, ?)'; 137set @intarg= 11; 138set @varchararg= '2222'; 139execute stmt1 using @intarg, @varchararg; 140execute stmt2 using @intarg, @varchararg; 141set @intarg= 12; 142execute stmt1 using @intarg, @UNDEFINED; 143execute stmt2 using @intarg, @UNDEFINED; 144set @intarg= 13; 145execute stmt1 using @UNDEFINED, @varchararg; 146execute stmt2 using @UNDEFINED, @varchararg; 147ERROR 23000: Column 'a' cannot be null 148set @intarg= 14; 149set @nullarg= Null; 150execute stmt1 using @UNDEFINED, @nullarg; 151execute stmt2 using @nullarg, @varchararg; 152ERROR 23000: Column 'a' cannot be null 153select * from t1; 154a b 15511 2222 15612 NULL 157NULL 2222 158NULL NULL 159select * from t2; 160a b 16111 2222 16212 NULL 163drop table t1; 164drop table t2; 165CREATE TABLE t1 (a INT); 166PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))'; 167EXECUTE stmt; 1681 169DEALLOCATE PREPARE stmt; 170DROP TABLE t1; 171CREATE TABLE t2 (a INT PRIMARY KEY); 172INSERT INTO t2 VALUES (400000), (400001); 173SET @@sort_buffer_size=400000; 174CREATE FUNCTION p1(i INT) RETURNS INT 175BEGIN 176SET @@sort_buffer_size= i; 177RETURN i + 1; 178END| 179SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1; 180a 181400000 182DROP TABLE t2; 183DROP FUNCTION p1; 184SELECT CONCAT(@@sort_buffer_size); 185CONCAT(@@sort_buffer_size) 186400001 187SELECT LEFT("12345", @@ft_boolean_syntax); 188LEFT("12345", @@ft_boolean_syntax) 189 190Warnings: 191Warning 1292 Truncated incorrect INTEGER value: '+ -><()~*:""&|' 192SET @@sort_buffer_size=DEFAULT; 193End of 5.0 tests. 194