diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-08-18 23:36:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-02-25 21:08:19 +0400 |
commit | 583eb96c2492adb87e88a014b24eb0724fb00257 (patch) | |
tree | 501cb4e5e3855400e79df8911ac43ef1f89300b3 /mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc | |
parent | 83ea839fb15dd5ed616d2b3152ccc5472ee5e5e6 (diff) | |
download | mariadb-git-583eb96c2492adb87e88a014b24eb0724fb00257.tar.gz |
MDEV-11952 Oracle-style packages: stage#5mariadb-10.3.5bb-10.3-compatibility
- CREATE PACKAGE [BODY] statements are now
entirely written to mysql.proc with type='PACKAGE' and type='PACKAGE BODY'.
- CREATE PACKAGE BODY now supports IF NOT EXISTS
- DROP PACKAGE BODY now supports IF EXISTS
- CREATE OR REPLACE PACKAGE [BODY] is now supported
- CREATE PACKAGE [BODY] now support the DEFINER clause:
CREATE DEFINER user@host PACKAGE pkg ... END;
CREATE DEFINER user@host PACKAGE BODY pkg ... END;
- CREATE PACKAGE [BODY] now supports SQL SECURITY and COMMENT clauses, e.g.:
CREATE PACKAGE p1 SQL SECURITY INVOKER COMMENT "comment" AS ... END;
- Package routines are now created from the package CREATE PACKAGE BODY
statement and don't produce individual records in mysql.proc.
- CREATE PACKAGE BODY now supports package-wide variables.
Package variables can be read and set inside package routines.
Package variables are stored in a separate sp_rcontext,
which is cached in THD on the first packate routine call.
- CREATE PACKAGE BODY now supports the initialization section.
- All public routines (i.e. declared in CREATE PACKAGE)
must have implementations in CREATE PACKAGE BODY
- Only public package routines are available outside of the package
- {CREATE|DROP} PACKAGE [BODY] now respects CREATE ROUTINE and ALTER ROUTINE
privileges
- "GRANT EXECUTE ON PACKAGE BODY pkg" is now supported
- SHOW CREATE PACKAGE [BODY] is now supported
- SHOW PACKAGE [BODY] STATUS is now supported
- CREATE and DROP for PACKAGE [BODY] now works for non-current databases
- mysqldump now supports packages
- "SHOW {PROCEDURE|FUNCTION) CODE pkg.routine" now works for package routines
- "SHOW PACKAGE BODY CODE pkg" now works (the package initialization section)
- A new package body level MDL was added
- Recursive calls for package procedures are now possible
- Routine forward declarations in CREATE PACKATE BODY are now supported.
- Package body variables now work as SP OUT parameters
- Package body variables now work as SELECT INTO targets
- Package body variables now support ROW, %ROWTYPE, %TYPE
Diffstat (limited to 'mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc')
-rw-r--r-- | mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc b/mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc new file mode 100644 index 00000000000..8ee96d1ee6a --- /dev/null +++ b/mysql-test/suite/compat/oracle/t/sp-package-concurrent-dml.inc @@ -0,0 +1,107 @@ +--echo # +--echo # Start of sp-package-concurrent-dml.inc +--echo # + +--source include/count_sessions.inc + +let $object_type= `SELECT @object_type`; + +SET sql_mode=ORACLE; +DELIMITER $$; +CREATE PACKAGE pkg1 AS + PROCEDURE p1; +END; +$$ +CREATE PACKAGE BODY pkg1 AS + PROCEDURE p2 AS + BEGIN + SELECT 'This is p2' AS msg; + END; + PROCEDURE p1 AS + BEGIN + SELECT 'This is p1' AS msg; + DO GET_LOCK('mdev15070',120); + CALL p2(); + DO RELEASE_LOCK('mdev15070'); + END; +END; +$$ +DELIMITER ;$$ + +connect (con2,localhost,root); +connection con2; +DO GET_LOCK('mdev15070', 120); + +connection default; +send CALL pkg1.p1; + +connection con2; +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE state = "User lock" AND info LIKE "%GET_LOCK%mdev15070%"; +--source include/wait_condition.inc + + +if ($object_type==view) +{ + CREATE VIEW v1 AS SELECT 1 AS c; + DROP VIEW v1; +} + + +if ($object_type==package_replace_pkg1) +{ + SET sql_mode=ORACLE; + DELIMITER $$; + CREATE OR REPLACE PACKAGE pkg1 AS + PROCEDURE p1; + END; + $$ + DELIMITER ;$$ + DROP PACKAGE pkg1; +} + + +if ($object_type==package_body_replace_pkg1) +{ + SET sql_mode=ORACLE; + DELIMITER $$; + CREATE OR REPLACE PACKAGE BODY pkg1 AS + PROCEDURE p1 AS + BEGIN + SELECT 'This is p1 version 2' AS msg; + END; + END; + $$ + DELIMITER ;$$ + DROP PACKAGE pkg1; +} + + +if ($object_type==trigger) +{ + CREATE TABLE t1 (a INT); + CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; + DROP TRIGGER tr1; + DROP TABLE t1; +} + + +if ($object_type=='db') +{ + CREATE DATABASE test1; + CREATE FUNCTION test1.f1() RETURNS INT RETURN 10; + DROP DATABASE test1; +} + + +DO RELEASE_LOCK('mdev15070'); + +disconnect con2; + +connection default; +reap; + +DROP PACKAGE IF EXISTS pkg1; + +--source include/wait_until_count_sessions.inc |