mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Allow SQLCOM_CALL in prepared mode.
mysql-test/r/ps.result: Test results: adding tests for CALL statement in prepared mode. mysql-test/t/ps.test: Adding tests for CALL statement in prepared mode.
This commit is contained in:
@ -542,3 +542,31 @@ execute my_stmt;
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
37
|
37
|
||||||
deallocate prepare my_stmt;
|
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|
|
||||||
|
@ -561,3 +561,29 @@ while ($exec_loop_count)
|
|||||||
dec $exec_loop_count;
|
dec $exec_loop_count;
|
||||||
}
|
}
|
||||||
deallocate prepare my_stmt;
|
deallocate prepare my_stmt;
|
||||||
|
|
||||||
|
# Test CALL in prepared mode
|
||||||
|
delimiter |;
|
||||||
|
--disable_warnings
|
||||||
|
drop procedure if exists p1|
|
||||||
|
drop table if exists t1|
|
||||||
|
--enable_warnings
|
||||||
|
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|
|
||||||
|
deallocate prepare stmt|
|
||||||
|
drop procedure p1|
|
||||||
|
drop table t1|
|
||||||
|
delimiter ;|
|
||||||
|
@ -1654,6 +1654,7 @@ static int check_prepared_statement(Prepared_statement *stmt,
|
|||||||
case SQLCOM_DROP_INDEX:
|
case SQLCOM_DROP_INDEX:
|
||||||
case SQLCOM_ROLLBACK:
|
case SQLCOM_ROLLBACK:
|
||||||
case SQLCOM_TRUNCATE:
|
case SQLCOM_TRUNCATE:
|
||||||
|
case SQLCOM_CALL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user