insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
2 hh
1 ii
2 hh
drop table t5 ;
drop table if exists t5 ;
create table t5(session_id char(9) not null) ;
...
...
@@ -308,11 +308,11 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
select a FROM t1 where a in (@arg00,@arg01);
select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
...
...
@@ -386,18 +386,18 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
AND b is not NULL having b <> @arg00 ;
AND b is not NULL having b <> @arg00 order by a ;
a b
4 four
3 three
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
AND b is not NULL having b <> ? ' ;
AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
4 four
3 three
1 one
3 three
4 four
set @arg00=1 ;
select a,b FROM t1 where a is not NULL
AND b is not NULL order by a - @arg00 ;
...
...
@@ -440,11 +440,11 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
prepare stmt1 from ' select a,b from t1
prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
2 two
1 one
prepare stmt1 from ' select a,b from t1
limit ? ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
...
...
@@ -471,21 +471,21 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
where first.a = second.a ;
where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
4 4
3 3
1 1
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
where first.a = second.a ';
where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
2 2
4 4
3 3
1 1
4 4
set @arg00='ABC';
set @arg01='two';
set @arg02='one';
...
...
@@ -518,204 +518,204 @@ a ? a
4 ABC 4
drop table if exists t2 ;
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is:
SELECT * FROM t2 right join t1 using(a)
SELECT * FROM t2 right join t1 using(a) order by t2.a
prepare stmt1 from @query9 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 natural right join t1
SELECT * FROM t2 natural right join t1 order by t2.a
prepare stmt1 from @query8 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 right join t1 on(t1.a=t2.a)
SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
prepare stmt1 from @query7 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 using(a)
SELECT * FROM t2 left join t1 using(a) order by t2.a
prepare stmt1 from @query6 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 natural left join t1
SELECT * FROM t2 natural left join t1 order by t2.a
prepare stmt1 from @query5 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 on(t1.a=t2.a)
SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
prepare stmt1 from @query4 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 join t1 using(a)
SELECT * FROM t2 join t1 using(a) order by t2.a
prepare stmt1 from @query3 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
4 four 4 four
3 three 3 three
1 one 1 one
4 four 4 four
the join statement is:
SELECT * FROM t2 natural join t1
SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ;
execute stmt1 ;
a b
1 one
2 two
4 four
3 three
1 one
4 four
execute stmt1 ;
a b
1 one
2 two
4 four
3 three
1 one
4 four
execute stmt1 ;
a b
1 one
2 two
4 four
3 three
1 one
4 four
the join statement is:
SELECT * FROM t2 join t1 on (t1.a=t2.a)
SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a