diff options
author | Alexander Barkov <bar@mariadb.com> | 2021-11-26 06:56:04 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2022-01-24 19:46:27 +0400 |
commit | 050508672cbf711356e236b492104d3b9a6b1fb8 (patch) | |
tree | ef7b1f3f3553303c63aae9d78dc0776fbf2555d7 /mysql-test/main/sp-cursor.result | |
parent | 4572dc23f7d83dfffc9cf2577cea96a034c5332c (diff) | |
download | mariadb-git-050508672cbf711356e236b492104d3b9a6b1fb8.tar.gz |
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.
Diffstat (limited to 'mysql-test/main/sp-cursor.result')
-rw-r--r-- | mysql-test/main/sp-cursor.result | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result index 110ae7be03a..dc38ad64069 100644 --- a/mysql-test/main/sp-cursor.result +++ b/mysql-test/main/sp-cursor.result @@ -737,3 +737,43 @@ rec.en1 c DROP PROCEDURE p1; DROP TABLE t1; +# +# Start of 10.8 tests +# +# +# MDEV-10654 IN, OUT, INOUT parameters in CREATE FUNCTION +# +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; +$$ +va +1 +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; +$$ +ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor parameter' +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; +$$ +ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor parameter' +# +# End of 10.8 tests +# |