mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
A clean-up for MDEV-10654 add support IN, OUT, INOUT parameter qualifiers for stored functions
Changes: 1. Enabling IN/OUT/INOUT mode for sql_mode=DEFAULT, adding tests for sql_mode=DEFAULT based by mostly translating compat/oracle.sp-inout.test to SQL/PSM with minor changes (e.g. testing trigger OLD.column and NEW.column as IN/OUT parameters). 2. Removing duplicate grammar: sp_pdparam and sp_fdparam implemented exactly the same syntax after - the first patch for MDEV-10654 (for sql_mode=ORACLE) - the change #1 from this patch (for sql_mode=DEFAULT) Removing separate rules and adding a single "sp_param" rule instead, which now covers both PRDEDURE and FUNCTION parameters (and CURSOR parameters as well!). 3. Adding a helper rule sp_param_name_and_mode, which is a combination of the parameter name and the IN/OUT/INOUT mode. It allows to simplify the grammer a bit. 4. The first patch unintentionally allowed IN/OUT/INOUT mode to be specified in CURSOR parameters. This is good for the IN keyword - it is allowed in PL/SQL CURSORs. This is not good the the OUT/INOUT keywords - they should not be allowed. Adding a additional symantic post-check.
This commit is contained in:
@ -744,3 +744,54 @@ DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.8 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE va INT;
|
||||
DECLARE cur CURSOR (IN a INT) FOR SELECT a FROM dual;
|
||||
OPEN cur(1);
|
||||
FETCH cur INTO va;
|
||||
CLOSE cur;
|
||||
SELECT va;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE va INT;
|
||||
DECLARE cur CURSOR (OUT a INT) FOR SELECT a FROM dual;
|
||||
OPEN cur(1);
|
||||
FETCH cur INTO va;
|
||||
CLOSE cur;
|
||||
SELECT va;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE va INT;
|
||||
DECLARE cur CURSOR (INOUT a INT) FOR SELECT a FROM dual;
|
||||
OPEN cur(1);
|
||||
FETCH cur INTO va;
|
||||
CLOSE cur;
|
||||
SELECT va;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.8 tests
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user