1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/opt/local/work/mysql-5.0-7306-final


sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
This commit is contained in:
unknown
2005-06-07 16:28:08 +04:00
25 changed files with 202 additions and 131 deletions

View File

@ -174,11 +174,8 @@ where a=2
limit 1';
execute stmt1 ;
select a,b from t1 where b = 'bla' ;
# currently (May 2004, Version 4.1) it is impossible
-- error 1064
prepare stmt1 from 'update t1 set b=''bla''
where a=2
limit ?';
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
--disable_query_log
select '------ insert tests ------' as test_sequence ;

View File

@ -300,10 +300,8 @@ set @arg00=1;
prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
# currently (May 2004, Version 4.1) it is impossible
-- error 1064
prepare stmt1 from ' select a,b from t1
limit ? ';
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
##### parameter used in many places
set @arg00='b' ;

View File

@ -634,3 +634,44 @@ id
3
deallocate prepare stmt;
drop table t1, t2;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
prepare stmt from "select * from t1 limit ?, ?";
set @offset=0, @limit=1;
execute stmt using @offset, @limit;
a
1
select * from t1 limit 0, 1;
a
1
set @offset=3, @limit=2;
execute stmt using @offset, @limit;
a
4
5
select * from t1 limit 3, 2;
a
4
5
prepare stmt from "select * from t1 limit ?";
execute stmt using @limit;
a
1
2
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
set @offset=9;
set @limit=2;
execute stmt using @offset, @limit;
a
10
1
prepare stmt from "(select * from t1 limit ?, ?) union all
(select * from t1 limit ?, ?) order by a limit ?";
execute stmt using @offset, @limit, @offset, @limit, @limit;
a
10
10
drop table t1;
deallocate prepare stmt;

View File

@ -444,9 +444,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1381,10 +1382,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -444,9 +444,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1364,10 +1365,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -445,9 +445,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1365,10 +1366,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -487,9 +487,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1407,10 +1408,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;
@ -3500,9 +3499,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -4420,10 +4420,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -444,9 +444,10 @@ limit 1 ';
execute stmt1 ;
a b
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
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
1 one
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1364,10 +1365,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -1,6 +1,4 @@
use test;
drop table if exists t1, t9 ;
create table t1
use test; drop table if exists t1, t9 ; create table t1
(
a int, b varchar(30),
primary key(a)
@ -1364,10 +1362,8 @@ execute stmt1 ;
select a,b from t1 where b = 'bla' ;
a b
2 bla
prepare stmt1 from 'update t1 set b=''bla''
where a=2
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 3
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
execute stmt1 using @arg00;
test_sequence
------ insert tests ------
delete from t1 ;

View File

@ -664,3 +664,32 @@ select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
deallocate prepare stmt;
drop table t1, t2;
#
# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
# support for placeholders in LIMIT clause."
# Add basic test coverage for the feature.
#
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
prepare stmt from "select * from t1 limit ?, ?";
set @offset=0, @limit=1;
execute stmt using @offset, @limit;
select * from t1 limit 0, 1;
set @offset=3, @limit=2;
execute stmt using @offset, @limit;
select * from t1 limit 3, 2;
prepare stmt from "select * from t1 limit ?";
execute stmt using @limit;
--error 1235
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
set @offset=9;
set @limit=2;
execute stmt using @offset, @limit;
prepare stmt from "(select * from t1 limit ?, ?) union all
(select * from t1 limit ?, ?) order by a limit ?";
execute stmt using @offset, @limit, @offset, @limit, @limit;
drop table t1;
deallocate prepare stmt;