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 bodhi.local:/opt/local/work/mysql-5.0-runtime-merge include/mysql.h: Auto merged include/sql_common.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/t/udf.test: Auto merged ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged sql/item.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/slave.cc: Auto merged sql/sp.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql-common/client.c: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged mysql-test/r/ps.result: Manual merge. mysql-test/r/sp.result: Manual merge. mysql-test/t/ps.test: Manual merge. mysql-test/t/sp.test: Manual merge. sql/sql_prepare.cc: Manual merge. sql/table.cc: Manual merge. tests/mysql_client_test.c: Manual merge.
This commit is contained in:
@ -485,20 +485,6 @@ execute stmt;
|
||||
pnum
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (a varchar(20));
|
||||
insert into t1 values ('foo');
|
||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||
@ -650,47 +636,6 @@ 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;
|
||||
create table t1 (id int);
|
||||
prepare stmt from "insert into t1 (id) select id from t1 union select id from t1";
|
||||
execute stmt;
|
||||
@ -791,15 +736,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
select ? from t1;
|
||||
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 '? from t1' at line 1
|
||||
drop table t1;
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
1
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
prepare stmt from "select @@time_zone";
|
||||
execute stmt;
|
||||
@@time_zone
|
||||
@ -1016,6 +952,147 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
|
||||
@@max_prepared_stmt_count @@prepared_stmt_count
|
||||
3 0
|
||||
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
End of 4.1 tests
|
||||
create table t1 (a varchar(20));
|
||||
insert into t1 values ('foo');
|
||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||
ERROR 42000: FUNCTION test.char_length does not exist
|
||||
drop table t1;
|
||||
create table t1 (a char(3) not null, b char(3) not null,
|
||||
c char(3) not null, primary key (a, b, c));
|
||||
create table t2 like t1;
|
||||
prepare stmt from
|
||||
"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
|
||||
where t1.a=1";
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
prepare stmt from
|
||||
"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
|
||||
(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
|
||||
left outer join t2 t3 on t3.a=? where t1.a=?";
|
||||
set @a:=1, @b:=1, @c:=1;
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
execute stmt using @a, @b, @c;
|
||||
a b c a b c
|
||||
deallocate prepare stmt;
|
||||
drop table t1,t2;
|
||||
SET @aux= "SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS A,
|
||||
INFORMATION_SCHEMA.COLUMNS B
|
||||
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
|
||||
AND A.TABLE_NAME = B.TABLE_NAME
|
||||
AND A.COLUMN_NAME = B.COLUMN_NAME AND
|
||||
A.TABLE_NAME = 'user'";
|
||||
prepare my_stmt from @aux;
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
37
|
||||
deallocate prepare my_stmt;
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
create table t1 (id int)|
|
||||
insert into t1 values(1)|
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare c int;
|
||||
select max(id)+1 into c from t1;
|
||||
insert into t1 select a+b;
|
||||
insert into t1 select a-b;
|
||||
insert into t1 select a-c;
|
||||
end|
|
||||
set @a= 3, @b= 4|
|
||||
prepare stmt from "call p1(?, ?)"|
|
||||
execute stmt using @a, @b|
|
||||
execute stmt using @a, @b|
|
||||
select * from t1|
|
||||
id
|
||||
1
|
||||
7
|
||||
-1
|
||||
1
|
||||
7
|
||||
-1
|
||||
-5
|
||||
deallocate prepare stmt|
|
||||
drop procedure p1|
|
||||
drop table t1|
|
||||
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;
|
||||
CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
|
||||
CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
|
||||
CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
|
||||
PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
|
||||
EXECUTE b12651;
|
||||
1
|
||||
DROP VIEW b12651_V1;
|
||||
DROP TABLE b12651_T1, b12651_T2;
|
||||
DEALLOCATE PREPARE b12651;
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
|
Reference in New Issue
Block a user