1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed BUG#9598: stored procedure call within stored procedure

overwrites IN variable
  and added error checking of variables for [IN]OUT parameters while
  rewriting the out parameter handling.


mysql-test/r/sp-error.result:
  New test case for non-variable argument for [IN]OUT parameters.
  (And changed to qualified names in some other error messages.)
mysql-test/r/sp.result:
  New test case for BUG#9598.
mysql-test/t/sp-error.test:
  New test case for non-variable argument for [IN]OUT parameters.
mysql-test/t/sp.test:
  New test case for BUG#9598.
sql/item.h:
  Need to distinguish between SP local variable items and other items,
  for error checking and [IN]OUT parameter handling.
sql/share/errmsg.txt:
  New error message for non-variable arguments for [IN]OUT parameters in stored procedures.
sql/sp_head.cc:
  Rewrote the [IN]OUT parameter handling in procedure invokation, to make
  it work properly when using user variables in sub-calls.
  Also added error checking for non-variable arguments for such parameters
  (and changed to qualified names for wrong number of arg. errors).
sql/sp_rcontext.cc:
  No need to keep track on the out index for an [IN]OUT parameter any more.
sql/sp_rcontext.h:
  No need to keep track on the out index for an [IN]OUT parameter any more.
This commit is contained in:
unknown
2005-04-14 14:52:35 +02:00
parent 1c2c6bba1c
commit e0fdbeba7e
9 changed files with 159 additions and 58 deletions

View File

@ -125,13 +125,13 @@ set @x = x|
create function f(x int) returns int
return x+42|
call p()|
ERROR 42000: Incorrect number of arguments for PROCEDURE p; expected 1, got 0
ERROR 42000: Incorrect number of arguments for PROCEDURE test.p; expected 1, got 0
call p(1, 2)|
ERROR 42000: Incorrect number of arguments for PROCEDURE p; expected 1, got 2
ERROR 42000: Incorrect number of arguments for PROCEDURE test.p; expected 1, got 2
select f()|
ERROR 42000: Incorrect number of arguments for FUNCTION f; expected 1, got 0
ERROR 42000: Incorrect number of arguments for FUNCTION test.f; expected 1, got 0
select f(1, 2)|
ERROR 42000: Incorrect number of arguments for FUNCTION f; expected 1, got 2
ERROR 42000: Incorrect number of arguments for FUNCTION test.f; expected 1, got 2
drop procedure p|
drop function f|
create procedure p(val int, out res int)
@ -318,6 +318,24 @@ select field from t1;
label L1;
end|
ERROR HY000: GOTO is not allowed in a stored procedure handler
drop procedure if exists p|
create procedure p(in x int, inout y int, out z int)
begin
set y = x+y;
set z = x+y;
end|
set @tmp_x = 42|
set @tmp_y = 3|
set @tmp_z = 0|
call p(@tmp_x, @tmp_y, @tmp_z)|
select @tmp_x, @tmp_y, @tmp_z|
@tmp_x @tmp_y @tmp_z
42 45 87
call p(42, 43, @tmp_z)|
ERROR 42000: OUT or INOUT argument 2 for routine test.p is not a variable
call p(42, @tmp_y, 43)|
ERROR 42000: OUT or INOUT argument 3 for routine test.p is not a variable
drop procedure p|
create procedure bug1965()
begin
declare c cursor for select val from t1 order by valname;