Commit d36d5a29 authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-ndb

parents 4a618a35 1d7ae133
...@@ -104,13 +104,13 @@ prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; ...@@ -104,13 +104,13 @@ prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
# variations on 'concat' # variations on 'concat'
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
# BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result # BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
# #
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
# variations on 'group_concat' # variations on 'group_concat'
...@@ -147,7 +147,7 @@ create table t5 (id1 int(11) not null default '0', ...@@ -147,7 +147,7 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
...@@ -216,8 +216,8 @@ execute stmt1 using @arg00 ; ...@@ -216,8 +216,8 @@ execute stmt1 using @arg00 ;
# parameter in IN # parameter in IN
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; set @arg01=3 ;
select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a;
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; execute stmt1 using @arg00, @arg01;
# case derived from client_test.c: test_bug1500() # case derived from client_test.c: test_bug1500()
set @arg00= 'one' ; set @arg00= 'one' ;
...@@ -270,9 +270,9 @@ execute stmt1 using @arg00 ; ...@@ -270,9 +270,9 @@ execute stmt1 using @arg00 ;
##### parameter used in having clause ##### parameter used in having clause
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 ;
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
##### parameter used in order clause ##### parameter used in order clause
...@@ -297,7 +297,7 @@ execute stmt1 using @arg00; ...@@ -297,7 +297,7 @@ execute stmt1 using @arg00;
##### parameter used in limit clause ##### parameter used in limit clause
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
# currently (May 2004, Version 4.1) it is impossible # currently (May 2004, Version 4.1) it is impossible
...@@ -327,10 +327,10 @@ select '------ join tests ------' as test_sequence ; ...@@ -327,10 +327,10 @@ select '------ join tests ------' as test_sequence ;
# no parameter # no parameter
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
# some parameters # some parameters
...@@ -350,15 +350,15 @@ execute stmt1 using @arg00, @arg01, @arg02; ...@@ -350,15 +350,15 @@ execute stmt1 using @arg00, @arg01, @arg02;
drop table if exists t2 ; drop table if exists t2 ;
--enable_warnings --enable_warnings
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
let $1= 9 ; let $1= 9 ;
while ($1) while ($1)
{ {
...@@ -424,7 +424,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -424,7 +424,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
######## correlated subquery ######## correlated subquery
# no parameter # no parameter
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
# also Bug#4000 (only BDB tables) # also Bug#4000 (only BDB tables)
# Bug#4106 : ndb table, query with correlated subquery, wrong result # Bug#4106 : ndb table, query with correlated subquery, wrong result
execute stmt1 ; execute stmt1 ;
......
...@@ -10,7 +10,7 @@ explain select * from t2 where p NOT IN (select p from t1); ...@@ -10,7 +10,7 @@ explain select * from t2 where p NOT IN (select p from t1);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
select * from t2 where p NOT IN (select p from t1); select * from t2 where p NOT IN (select p from t1) order by p;
p u o p u o
4 4 4 4 4 4
5 5 5 5 5 5
...@@ -18,7 +18,7 @@ explain select * from t2 where p NOT IN (select u from t1); ...@@ -18,7 +18,7 @@ explain select * from t2 where p NOT IN (select u from t1);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func 1 Using index 2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func 1 Using index
select * from t2 where p NOT IN (select u from t1); select * from t2 where p NOT IN (select u from t1) order by p;
p u o p u o
4 4 4 4 4 4
5 5 5 5 5 5
...@@ -26,7 +26,7 @@ explain select * from t2 where p NOT IN (select o from t1); ...@@ -26,7 +26,7 @@ explain select * from t2 where p NOT IN (select o from t1);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func 1 Using index 2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func 1 Using index
select * from t2 where p NOT IN (select o from t1); select * from t2 where p NOT IN (select o from t1) order by p;
p u o p u o
4 4 4 4 4 4
5 5 5 5 5 5
...@@ -34,7 +34,7 @@ explain select * from t2 where p NOT IN (select p+0 from t1); ...@@ -34,7 +34,7 @@ explain select * from t2 where p NOT IN (select p+0 from t1);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
select * from t2 where p NOT IN (select p+0 from t1); select * from t2 where p NOT IN (select p+0 from t1) order by p;
p u o p u o
4 4 4 4 4 4
5 5 5 5 5 5
......
...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; ...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?) substr('MySQL',1,?)
MyS MyS
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b) a concat(@arg00,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(?,b) a concat(?,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00) a concat(b,@arg00)
1 oneMySQL 1 oneMySQL
2 twoMySQL 2 twoMySQL
3 threeMySQL 3 threeMySQL
4 fourMySQL 4 fourMySQL
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(b,?) a concat(b,?)
1 oneMySQL 1 oneMySQL
...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', ...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
id1 value1 id1 value1
1 hh 1 hh
2 hh
1 ii 1 ii
2 hh
drop table t5 ; drop table t5 ;
drop table if exists t5 ; drop table if exists t5 ;
create table t5(session_id char(9) not null) ; create table t5(session_id char(9) not null) ;
...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; ...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ;
a a
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; 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 a
2 2
3 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; execute stmt1 using @arg00, @arg01;
a a
2 2
...@@ -385,13 +385,13 @@ a b ...@@ -385,13 +385,13 @@ a b
4 four 4 four
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 a b
1 one 1 one
3 three 3 three
4 four 4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
a b a b
1 one 1 one
...@@ -439,7 +439,7 @@ set @arg00=0 ; ...@@ -439,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -470,7 +470,7 @@ test_sequence ...@@ -470,7 +470,7 @@ test_sequence
------ join tests ------ ------ join tests ------
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
a1 a2 a1 a2
1 1 1 1
2 2 2 2
...@@ -478,7 +478,7 @@ a1 a2 ...@@ -478,7 +478,7 @@ a1 a2
4 4 4 4
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
a1 a2 a1 a2
1 1 1 1
...@@ -517,17 +517,17 @@ a ? a ...@@ -517,17 +517,17 @@ a ? a
4 ABC 4 4 ABC 4
drop table if exists t2 ; drop table if exists t2 ;
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is: 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 ; prepare stmt1 from @query9 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -548,7 +548,7 @@ a b a b ...@@ -548,7 +548,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query8 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -569,7 +569,7 @@ a b a b ...@@ -569,7 +569,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query7 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -590,7 +590,7 @@ a b a b ...@@ -590,7 +590,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query6 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -611,7 +611,7 @@ a b a b ...@@ -611,7 +611,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query5 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -632,7 +632,7 @@ a b a b ...@@ -632,7 +632,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query4 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -653,7 +653,7 @@ a b a b ...@@ -653,7 +653,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query3 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -674,7 +674,7 @@ a b a b ...@@ -674,7 +674,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: the join statement is:
SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ; prepare stmt1 from @query2 ;
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -695,7 +695,7 @@ a b ...@@ -695,7 +695,7 @@ a b
3 three 3 three
4 four 4 four
the join statement is: 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
prepare stmt1 from @query1 ; prepare stmt1 from @query1 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b a ? b
2 1 two 2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ; execute stmt1 ;
a b a b
1 one 1 one
......
...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; ...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?) substr('MySQL',1,?)
MyS MyS
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b) a concat(@arg00,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(?,b) a concat(?,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00) a concat(b,@arg00)
1 oneMySQL 1 oneMySQL
2 twoMySQL 2 twoMySQL
3 threeMySQL 3 threeMySQL
4 fourMySQL 4 fourMySQL
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(b,?) a concat(b,?)
1 oneMySQL 1 oneMySQL
...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', ...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
id1 value1 id1 value1
1 hh 1 hh
2 hh
1 ii 1 ii
2 hh
drop table t5 ; drop table t5 ;
drop table if exists t5 ; drop table if exists t5 ;
create table t5(session_id char(9) not null) ; create table t5(session_id char(9) not null) ;
...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; ...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ;
a a
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; 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 a
2 2
3 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; execute stmt1 using @arg00, @arg01;
a a
2 2
...@@ -385,13 +385,13 @@ a b ...@@ -385,13 +385,13 @@ a b
4 four 4 four
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 a b
1 one 1 one
3 three 3 three
4 four 4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
a b a b
1 one 1 one
...@@ -439,7 +439,7 @@ set @arg00=0 ; ...@@ -439,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -470,7 +470,7 @@ test_sequence ...@@ -470,7 +470,7 @@ test_sequence
------ join tests ------ ------ join tests ------
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
a1 a2 a1 a2
1 1 1 1
2 2 2 2
...@@ -478,7 +478,7 @@ a1 a2 ...@@ -478,7 +478,7 @@ a1 a2
4 4 4 4
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
a1 a2 a1 a2
1 1 1 1
...@@ -517,17 +517,17 @@ a ? a ...@@ -517,17 +517,17 @@ a ? a
4 ABC 4 4 ABC 4
drop table if exists t2 ; drop table if exists t2 ;
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is: 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 ; prepare stmt1 from @query9 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -548,7 +548,7 @@ a b a b ...@@ -548,7 +548,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query8 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -569,7 +569,7 @@ a b a b ...@@ -569,7 +569,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query7 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -590,7 +590,7 @@ a b a b ...@@ -590,7 +590,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query6 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -611,7 +611,7 @@ a b a b ...@@ -611,7 +611,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query5 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -632,7 +632,7 @@ a b a b ...@@ -632,7 +632,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query4 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -653,7 +653,7 @@ a b a b ...@@ -653,7 +653,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query3 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -674,7 +674,7 @@ a b a b ...@@ -674,7 +674,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: the join statement is:
SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ; prepare stmt1 from @query2 ;
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -695,7 +695,7 @@ a b ...@@ -695,7 +695,7 @@ a b
3 three 3 three
4 four 4 four
the join statement is: 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
prepare stmt1 from @query1 ; prepare stmt1 from @query1 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b a ? b
2 1 two 2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ; execute stmt1 ;
a b a b
1 one 1 one
......
...@@ -166,26 +166,26 @@ execute stmt1 using @arg00 ; ...@@ -166,26 +166,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?) substr('MySQL',1,?)
MyS MyS
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b) a concat(@arg00,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(?,b) a concat(?,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00) a concat(b,@arg00)
1 oneMySQL 1 oneMySQL
2 twoMySQL 2 twoMySQL
3 threeMySQL 3 threeMySQL
4 fourMySQL 4 fourMySQL
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(b,?) a concat(b,?)
1 oneMySQL 1 oneMySQL
...@@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0', ...@@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
id1 value1 id1 value1
1 hh 1 hh
2 hh
1 ii 1 ii
2 hh
drop table t5 ; drop table t5 ;
drop table if exists t5 ; drop table if exists t5 ;
create table t5(session_id char(9) not null) ; create table t5(session_id char(9) not null) ;
...@@ -308,11 +308,11 @@ execute stmt1 using @arg00 ; ...@@ -308,11 +308,11 @@ execute stmt1 using @arg00 ;
a a
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; 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 a
2 2
3 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; execute stmt1 using @arg00, @arg01;
a a
2 2
...@@ -386,13 +386,13 @@ a b ...@@ -386,13 +386,13 @@ a b
4 four 4 four
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 a b
1 one 1 one
3 three 3 three
4 four 4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
a b a b
1 one 1 one
...@@ -440,7 +440,7 @@ set @arg00=0 ; ...@@ -440,7 +440,7 @@ set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -471,7 +471,7 @@ test_sequence ...@@ -471,7 +471,7 @@ test_sequence
------ join tests ------ ------ join tests ------
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
a1 a2 a1 a2
1 1 1 1
2 2 2 2
...@@ -479,7 +479,7 @@ a1 a2 ...@@ -479,7 +479,7 @@ a1 a2
4 4 4 4
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
a1 a2 a1 a2
1 1 1 1
...@@ -518,17 +518,17 @@ a ? a ...@@ -518,17 +518,17 @@ a ? a
4 ABC 4 4 ABC 4
drop table if exists t2 ; drop table if exists t2 ;
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is: 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 ; prepare stmt1 from @query9 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -549,7 +549,7 @@ a b a b ...@@ -549,7 +549,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query8 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -570,7 +570,7 @@ a b a b ...@@ -570,7 +570,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query7 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -591,7 +591,7 @@ a b a b ...@@ -591,7 +591,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query6 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -612,7 +612,7 @@ a b a b ...@@ -612,7 +612,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query5 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -633,7 +633,7 @@ a b a b ...@@ -633,7 +633,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query4 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -654,7 +654,7 @@ a b a b ...@@ -654,7 +654,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query3 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -675,7 +675,7 @@ a b a b ...@@ -675,7 +675,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: the join statement is:
SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ; prepare stmt1 from @query2 ;
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -696,7 +696,7 @@ a b ...@@ -696,7 +696,7 @@ a b
3 three 3 three
4 four 4 four
the join statement is: 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
prepare stmt1 from @query1 ; prepare stmt1 from @query1 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -770,7 +770,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -770,7 +770,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b a ? b
2 1 two 2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ; execute stmt1 ;
a b a b
1 one 1 one
......
This diff is collapsed.
...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; ...@@ -165,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?) substr('MySQL',1,?)
MyS MyS
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b) a concat(@arg00,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(?,b) a concat(?,b)
1 MySQLone 1 MySQLone
2 MySQLtwo 2 MySQLtwo
3 MySQLthree 3 MySQLthree
4 MySQLfour 4 MySQLfour
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00) a concat(b,@arg00)
1 oneMySQL 1 oneMySQL
2 twoMySQL 2 twoMySQL
3 threeMySQL 3 threeMySQL
4 fourMySQL 4 fourMySQL
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(b,?) a concat(b,?)
1 oneMySQL 1 oneMySQL
...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', ...@@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
id1 value1 id1 value1
1 hh 1 hh
2 hh
1 ii 1 ii
2 hh
drop table t5 ; drop table t5 ;
drop table if exists t5 ; drop table if exists t5 ;
create table t5(session_id char(9) not null) ; create table t5(session_id char(9) not null) ;
...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; ...@@ -307,11 +307,11 @@ execute stmt1 using @arg00 ;
a a
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; 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 a
2 2
3 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; execute stmt1 using @arg00, @arg01;
a a
2 2
...@@ -385,13 +385,13 @@ a b ...@@ -385,13 +385,13 @@ a b
4 four 4 four
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 a b
1 one 1 one
3 three 3 three
4 four 4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
a b a b
1 one 1 one
...@@ -439,7 +439,7 @@ set @arg00=0 ; ...@@ -439,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -470,7 +470,7 @@ test_sequence ...@@ -470,7 +470,7 @@ test_sequence
------ join tests ------ ------ join tests ------
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
a1 a2 a1 a2
1 1 1 1
2 2 2 2
...@@ -478,7 +478,7 @@ a1 a2 ...@@ -478,7 +478,7 @@ a1 a2
4 4 4 4
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
a1 a2 a1 a2
1 1 1 1
...@@ -517,17 +517,17 @@ a ? a ...@@ -517,17 +517,17 @@ a ? a
4 ABC 4 4 ABC 4
drop table if exists t2 ; drop table if exists t2 ;
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is: 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 ; prepare stmt1 from @query9 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -548,7 +548,7 @@ a b a b ...@@ -548,7 +548,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query8 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -569,7 +569,7 @@ a b a b ...@@ -569,7 +569,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query7 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -590,7 +590,7 @@ a b a b ...@@ -590,7 +590,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query6 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -611,7 +611,7 @@ a b a b ...@@ -611,7 +611,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query5 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -632,7 +632,7 @@ a b a b ...@@ -632,7 +632,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query4 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -653,7 +653,7 @@ a b a b ...@@ -653,7 +653,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query3 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -674,7 +674,7 @@ a b a b ...@@ -674,7 +674,7 @@ a b a b
3 three 3 three 3 three 3 three
4 four 4 four 4 four 4 four
the join statement is: the join statement is:
SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ; prepare stmt1 from @query2 ;
execute stmt1 ; execute stmt1 ;
a b a b
...@@ -695,7 +695,7 @@ a b ...@@ -695,7 +695,7 @@ a b
3 three 3 three
4 four 4 four
the join statement is: 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
prepare stmt1 from @query1 ; prepare stmt1 from @query1 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b a ? b
2 1 two 2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ; execute stmt1 ;
a b a b
1 one 1 one
......
...@@ -166,32 +166,32 @@ execute stmt1 using @arg00 ; ...@@ -166,32 +166,32 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?) substr('MySQL',1,?)
MyS MyS
set @arg00='MySQL' ; set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b) a concat(@arg00,b)
1 MySQLone
2 MySQLtwo 2 MySQLtwo
4 MySQLfour
3 MySQLthree 3 MySQLthree
1 MySQLone 4 MySQLfour
prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(?,b) a concat(?,b)
1 MySQLone
2 MySQLtwo 2 MySQLtwo
4 MySQLfour
3 MySQLthree 3 MySQLthree
1 MySQLone 4 MySQLfour
select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00) a concat(b,@arg00)
1 oneMySQL
2 twoMySQL 2 twoMySQL
4 fourMySQL
3 threeMySQL 3 threeMySQL
1 oneMySQL 4 fourMySQL
prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
a concat(b,?) a concat(b,?)
1 oneMySQL
2 twoMySQL 2 twoMySQL
4 fourMySQL
3 threeMySQL 3 threeMySQL
1 oneMySQL 4 fourMySQL
set @arg00='MySQL' ; set @arg00='MySQL' ;
select group_concat(@arg00,b) from t1 select group_concat(@arg00,b) from t1
group by 'a' ; group by 'a' ;
...@@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0', ...@@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ; value2 varchar(100), value1 varchar(100)) ;
insert into t5 values (1,'hh','hh'),(2,'hh','hh'), insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ; (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 @arg00=1 ;
set @arg01='hh' ; set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ; execute stmt1 using @arg00, @arg01 ;
id1 value1 id1 value1
1 hh 1 hh
2 hh
1 ii 1 ii
2 hh
drop table t5 ; drop table t5 ;
drop table if exists t5 ; drop table if exists t5 ;
create table t5(session_id char(9) not null) ; create table t5(session_id char(9) not null) ;
...@@ -308,11 +308,11 @@ execute stmt1 using @arg00 ; ...@@ -308,11 +308,11 @@ execute stmt1 using @arg00 ;
a a
set @arg00=2 ; set @arg00=2 ;
set @arg01=3 ; 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 a
2 2
3 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; execute stmt1 using @arg00, @arg01;
a a
2 2
...@@ -386,18 +386,18 @@ a b ...@@ -386,18 +386,18 @@ a b
4 four 4 four
set @arg00='two' ; set @arg00='two' ;
select a,b FROM t1 where a is not NULL 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 a b
4 four
3 three
1 one 1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL 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 ; execute stmt1 using @arg00 ;
a b a b
4 four
3 three
1 one 1 one
3 three
4 four
set @arg00=1 ; set @arg00=1 ;
select a,b FROM t1 where a is not NULL select a,b FROM t1 where a is not NULL
AND b is not NULL order by a - @arg00 ; AND b is not NULL order by a - @arg00 ;
...@@ -440,11 +440,11 @@ set @arg00=0 ; ...@@ -440,11 +440,11 @@ set @arg00=0 ;
execute stmt1 using @arg00; execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause' ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1; set @arg00=1;
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1 order by a
limit 1 '; limit 1 ';
execute stmt1 ; execute stmt1 ;
a b a b
2 two 1 one
prepare stmt1 from ' select a,b from t1 prepare stmt1 from ' select a,b from t1
limit ? '; 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 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 ...@@ -471,21 +471,21 @@ test_sequence
------ join tests ------ ------ join tests ------
select first.a as a1, second.a as a2 select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a ; where first.a = second.a order by a1 ;
a1 a2 a1 a2
1 1
2 2 2 2
4 4
3 3 3 3
1 1 4 4
prepare stmt1 from ' select first.a as a1, second.a as a2 prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second from t1 first, t1 second
where first.a = second.a '; where first.a = second.a order by a1 ';
execute stmt1 ; execute stmt1 ;
a1 a2 a1 a2
1 1
2 2 2 2
4 4
3 3 3 3
1 1 4 4
set @arg00='ABC'; set @arg00='ABC';
set @arg01='two'; set @arg01='two';
set @arg02='one'; set @arg02='one';
...@@ -518,204 +518,204 @@ a ? a ...@@ -518,204 +518,204 @@ a ? a
4 ABC 4 4 ABC 4
drop table if exists t2 ; drop table if exists t2 ;
create table t2 as select * from t1 ; create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.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 ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
set @query3= 'SELECT * FROM t2 join t1 using(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) ' ; 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 ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(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) ' ; 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 ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
the join statement is: 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 ; prepare stmt1 from @query9 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query8 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query7 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query6 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query5 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query4 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: 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 ; prepare stmt1 from @query3 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
the join statement is: the join statement is:
SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a
prepare stmt1 from @query2 ; prepare stmt1 from @query2 ;
execute stmt1 ; execute stmt1 ;
a b a b
1 one
2 two 2 two
4 four
3 three 3 three
1 one 4 four
execute stmt1 ; execute stmt1 ;
a b a b
1 one
2 two 2 two
4 four
3 three 3 three
1 one 4 four
execute stmt1 ; execute stmt1 ;
a b a b
1 one
2 two 2 two
4 four
3 three 3 three
1 one 4 four
the join statement is: 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
prepare stmt1 from @query1 ; prepare stmt1 from @query1 ;
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
execute stmt1 ; execute stmt1 ;
a b a b a b a b
1 one 1 one
2 two 2 two 2 two 2 two
4 four 4 four
3 three 3 three 3 three 3 three
1 one 1 one 4 four 4 four
drop table t2 ; drop table t2 ;
test_sequence test_sequence
------ subquery tests ------ ------ subquery tests ------
...@@ -770,13 +770,13 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ...@@ -770,13 +770,13 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b a ? b
2 1 two 2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ; execute stmt1 ;
a b a b
1 one
2 two 2 two
4 four
3 three 3 three
1 one 4 four
prepare stmt1 from ' SELECT a as ccc from t1 where a+1= prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ; execute stmt1 ;
...@@ -1188,7 +1188,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; ...@@ -1188,7 +1188,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ; commit ;
prepare stmt1 from 'delete from t1 where a=2' ; prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1; execute stmt1;
select a,b from t1 where a=2; select a,b from t1 where a=2 order by b;
a b a b
execute stmt1; execute stmt1;
insert into t1 values(0,NULL); insert into t1 values(0,NULL);
...@@ -1474,7 +1474,7 @@ set @arg02=82 ; ...@@ -1474,7 +1474,7 @@ set @arg02=82 ;
set @arg03='8-2' ; set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
select a,b from t1 where a in (@arg00,@arg02) ; select a,b from t1 where a in (@arg00,@arg02) order by a ;
a b a b
81 8-1 81 8-1
82 8-2 82 8-2
......
...@@ -18,19 +18,19 @@ insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5); ...@@ -18,19 +18,19 @@ insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
# Use pk # Use pk
explain select * from t2 where p NOT IN (select p from t1); explain select * from t2 where p NOT IN (select p from t1);
select * from t2 where p NOT IN (select p from t1); select * from t2 where p NOT IN (select p from t1) order by p;
# Use unique index # Use unique index
explain select * from t2 where p NOT IN (select u from t1); explain select * from t2 where p NOT IN (select u from t1);
select * from t2 where p NOT IN (select u from t1); select * from t2 where p NOT IN (select u from t1) order by p;
# Use ordered index # Use ordered index
explain select * from t2 where p NOT IN (select o from t1); explain select * from t2 where p NOT IN (select o from t1);
select * from t2 where p NOT IN (select o from t1); select * from t2 where p NOT IN (select o from t1) order by p;
# Use scan # Use scan
explain select * from t2 where p NOT IN (select p+0 from t1); explain select * from t2 where p NOT IN (select p+0 from t1);
select * from t2 where p NOT IN (select p+0 from t1); select * from t2 where p NOT IN (select p+0 from t1) order by p;
drop table t1; drop table t1;
drop table t2; drop table t2;
......
...@@ -55,7 +55,7 @@ select '------ delete tests ------' as test_sequence ; ...@@ -55,7 +55,7 @@ select '------ delete tests ------' as test_sequence ;
## delete without parameter ## delete without parameter
prepare stmt1 from 'delete from t1 where a=2' ; prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1; execute stmt1;
select a,b from t1 where a=2; select a,b from t1 where a=2 order by b;
# delete with row not found # delete with row not found
execute stmt1; execute stmt1;
...@@ -270,7 +270,7 @@ set @arg02=82 ; ...@@ -270,7 +270,7 @@ set @arg02=82 ;
set @arg03='8-2' ; set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
select a,b from t1 where a in (@arg00,@arg02) ; select a,b from t1 where a in (@arg00,@arg02) order by a ;
## insert with two parameter in the set part ## insert with two parameter in the set part
set @arg00=9 ; set @arg00=9 ;
......
This diff is collapsed.
...@@ -32,8 +32,10 @@ typedef struct st_archive_share { ...@@ -32,8 +32,10 @@ typedef struct st_archive_share {
uint table_name_length,use_count; uint table_name_length,use_count;
pthread_mutex_t mutex; pthread_mutex_t mutex;
THR_LOCK lock; THR_LOCK lock;
File meta_file; /* Meta file we use */
gzFile archive_write; /* Archive file we are working with */ gzFile archive_write; /* Archive file we are working with */
bool dirty; /* Flag for if a flush should occur */ bool dirty; /* Flag for if a flush should occur */
ulonglong rows_recorded; /* Number of rows in tables */
} ARCHIVE_SHARE; } ARCHIVE_SHARE;
/* /*
...@@ -50,7 +52,7 @@ class ha_archive: public handler ...@@ -50,7 +52,7 @@ class ha_archive: public handler
z_off_t current_position; /* The position of the row we just read */ z_off_t current_position; /* The position of the row we just read */
byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
String buffer; /* Buffer used for blob storage */ String buffer; /* Buffer used for blob storage */
unsigned int version; /* Used for recording version */ ulonglong scan_rows; /* Number of rows left in scan */
public: public:
ha_archive(TABLE *table): handler(table) ha_archive(TABLE *table): handler(table)
...@@ -104,7 +106,14 @@ public: ...@@ -104,7 +106,14 @@ public:
int rnd_init(bool scan=1); int rnd_init(bool scan=1);
int rnd_next(byte *buf); int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos); int rnd_pos(byte * buf, byte *pos);
int get_row(byte *buf); int get_row(gzFile file_to_read, byte *buf);
int read_meta_file(File meta_file, ulonglong *rows);
int write_meta_file(File meta_file, ulonglong rows, bool dirty);
ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table);
int free_share(ARCHIVE_SHARE *share);
int rebuild_meta_file(char *table_name, File meta_file);
int read_data_header(gzFile file_to_read);
int write_data_header(gzFile file_to_write);
void position(const byte *record); void position(const byte *record);
void info(uint); void info(uint);
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
......
...@@ -963,7 +963,7 @@ void clean_up(bool print_message) ...@@ -963,7 +963,7 @@ void clean_up(bool print_message)
if (print_message && errmesg) if (print_message && errmesg)
sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname); sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname);
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY) #if !defined(EMBEDDED_LIBRARY)
if (!opt_bootstrap) if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist (void) my_delete(pidfile_name,MYF(0)); // This may not always exist
#endif #endif
...@@ -1500,7 +1500,11 @@ static void init_signals(void) ...@@ -1500,7 +1500,11 @@ static void init_signals(void)
} }
static void start_signal_handler(void) static void start_signal_handler(void)
{} {
// Save vm id of this process
if (!opt_bootstrap)
create_pid_file();
}
static void check_data_home(const char *path) static void check_data_home(const char *path)
{} {}
...@@ -2934,10 +2938,10 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -2934,10 +2938,10 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#ifndef __NETWARE__ #ifndef __NETWARE__
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
#ifndef __WIN__
if (!opt_bootstrap) if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
#endif
if (unix_sock != INVALID_SOCKET) if (unix_sock != INVALID_SOCKET)
unlink(mysqld_unix_port); unlink(mysqld_unix_port);
exit(1); exit(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment