mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 05:05:32 +02:00
MDEV-32101 CREATE PACKAGE [BODY] for sql_mode=DEFAULT
This patch adds PACKAGE support with SQL/PSM dialect for sql_mode=DEFAULT: - CREATE PACKAGE - DROP PACKAGE - CREATE PACKAGE BODY - DROP PACKAGE BODY - Package function and procedure invocation from outside of the package: -- using two step identifiers SELECT pkg.f1(); CALL pkg.p1() -- using three step identifiers SELECT db.pkg.f1(); CALL db.pkg.p1(); This is a non-standard MariaDB extension. However, later this code can be used to implement the SQL Standard and DB2 dialects of CREATE MODULE.
This commit is contained in:
parent
9bd95e914f
commit
aed9c656a9
21 changed files with 4866 additions and 3547 deletions
260
mysql-test/main/sp-package-code.result
Normal file
260
mysql-test/main/sp-package-code.result
Normal file
|
@ -0,0 +1,260 @@
|
|||
#
|
||||
# MDEV-32101 CREATE PACKAGE [BODY] for sql_mode=DEFAULT
|
||||
#
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1()
|
||||
BEGIN SELECT 1;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT RETURN 1;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
Pos Instruction
|
||||
0 stmt 0 "SELECT 1"
|
||||
SHOW FUNCTION CODE pkg1.f1;
|
||||
Pos Instruction
|
||||
0 freturn int 1
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
Pos Instruction
|
||||
DROP PACKAGE pkg1;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
PROCEDURE p2show();
|
||||
PROCEDURE p2public();
|
||||
FUNCTION f2public() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a INT DEFAULT 10;
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b INT DEFAULT 20;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
SET a=a+1;
|
||||
SET @a=@a+2;
|
||||
SELECT f1() FROM DUAL;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
PROCEDURE p2private()
|
||||
BEGIN
|
||||
SELECT 'This is p2private';
|
||||
END;
|
||||
PROCEDURE p2public()
|
||||
BEGIN
|
||||
SELECT 'This is p2public';
|
||||
END;
|
||||
FUNCTION f2private() RETURNS TEXT
|
||||
BEGIN
|
||||
RETURN 'This is f2private';
|
||||
END;
|
||||
FUNCTION f2public() RETURNS TEXT
|
||||
BEGIN
|
||||
RETURN 'This is f2public';
|
||||
END;
|
||||
PROCEDURE p2show()
|
||||
BEGIN
|
||||
SHOW FUNCTION CODE f2public;
|
||||
SHOW FUNCTION CODE f2private;
|
||||
SHOW PROCEDURE CODE p2public;
|
||||
SHOW PROCEDURE CODE p2private;
|
||||
SHOW PROCEDURE CODE p2show;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a=a+1;
|
||||
BEGIN
|
||||
DECLARE b INT;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
Pos Instruction
|
||||
0 set b@0 20
|
||||
1 set b@0 PACKAGE_BODY.a@0
|
||||
2 set b@0 PACKAGE_BODY.a@0 + 1
|
||||
3 set PACKAGE_BODY.a@0 b@0
|
||||
4 set PACKAGE_BODY.a@0 b@0 + 1
|
||||
5 set PACKAGE_BODY.a@0 PACKAGE_BODY.a@0 + 1
|
||||
6 stmt 31 "SET @a=@a+2"
|
||||
7 stmt 0 "SELECT f1() FROM DUAL"
|
||||
SHOW FUNCTION CODE pkg1.f1;
|
||||
Pos Instruction
|
||||
0 freturn int PACKAGE_BODY.a@0
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
Pos Instruction
|
||||
0 set a@0 10
|
||||
1 set a@0 a@0 + 1
|
||||
2 set b@1 NULL
|
||||
3 set b@1 a@0
|
||||
4 set b@1 a@0 + 1
|
||||
5 set a@0 b@1
|
||||
6 set a@0 b@1 + 1
|
||||
CALL pkg1.p2show;
|
||||
Pos Instruction
|
||||
0 freturn blob 'This is f2public'
|
||||
Pos Instruction
|
||||
0 freturn blob 'This is f2private'
|
||||
Pos Instruction
|
||||
0 stmt 0 "SELECT 'This is p2public'"
|
||||
Pos Instruction
|
||||
0 stmt 0 "SELECT 'This is p2private'"
|
||||
Pos Instruction
|
||||
0 stmt 110 "SHOW FUNCTION CODE f2public"
|
||||
1 stmt 110 "SHOW FUNCTION CODE f2private"
|
||||
2 stmt 109 "SHOW PROCEDURE CODE p2public"
|
||||
3 stmt 109 "SHOW PROCEDURE CODE p2private"
|
||||
4 stmt 109 "SHOW PROCEDURE CODE p2show"
|
||||
DROP PACKAGE pkg1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a TYPE OF t1.a DEFAULT 10;
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b TYPE OF t1.a DEFAULT 20;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET b=b+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
SET a=a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a=a+1;
|
||||
BEGIN
|
||||
DECLARE b TYPE OF t1.a;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
Pos Instruction
|
||||
0 set b@0 20
|
||||
1 set b@0 PACKAGE_BODY.a@0
|
||||
2 set b@0 PACKAGE_BODY.a@0 + 1
|
||||
3 set b@0 b@0 + 1
|
||||
4 set PACKAGE_BODY.a@0 b@0
|
||||
5 set PACKAGE_BODY.a@0 b@0 + 1
|
||||
6 set PACKAGE_BODY.a@0 PACKAGE_BODY.a@0 + 1
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
Pos Instruction
|
||||
0 set a@0 10
|
||||
1 set a@0 a@0 + 1
|
||||
2 set b@1 NULL
|
||||
3 set b@1 a@0
|
||||
4 set b@1 a@0 + 1
|
||||
5 set a@0 b@1
|
||||
6 set a@0 b@1 + 1
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a ROW(a INT,b TEXT) DEFAULT ROW(10,'x10');
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b ROW(a INT,b TEXT) DEFAULT ROW(20,'x20');
|
||||
SET b=a;
|
||||
SET a=b;
|
||||
SET b.a=a.a+1;
|
||||
SET a.a=b.a+1;
|
||||
SET a.a=a.a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a.a:=a.a+1;
|
||||
BEGIN
|
||||
DECLARE b ROW(a INT,b TEXT) DEFAULT ROW(30,'x30');
|
||||
SET b=a;
|
||||
SET b.a=a.a+1;
|
||||
SET a=b;
|
||||
SET a.a=b.a+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
Pos Instruction
|
||||
0 set b@0 (20,'x20')
|
||||
1 set b@0 PACKAGE_BODY.a@0
|
||||
2 set PACKAGE_BODY.a@0 b@0
|
||||
3 set b.a@0[0] PACKAGE_BODY.a.a@0[0] + 1
|
||||
4 set PACKAGE_BODY.a.a@0[0] b.a@0[0] + 1
|
||||
5 set PACKAGE_BODY.a.a@0[0] PACKAGE_BODY.a.a@0[0] + 1
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
Pos Instruction
|
||||
0 set a@0 (10,'x10')
|
||||
1 set a.a@0[0] a.a@0[0] + 1
|
||||
2 set b@1 (30,'x30')
|
||||
3 set b@1 a@0
|
||||
4 set b.a@1[0] a.a@0[0] + 1
|
||||
5 set a@0 b@1
|
||||
6 set a.a@0[0] b.a@1[0] + 1
|
||||
DROP PACKAGE pkg1;
|
||||
CREATE TABLE t1 (a INT, b TEXT);
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a ROW TYPE OF t1 DEFAULT ROW(10,'x10');
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b ROW TYPE OF t1 DEFAULT ROW(20,'x20');
|
||||
SET b=a;
|
||||
SET a=b;
|
||||
SET b.a=a.a+1;
|
||||
SET a.a=b.a+1;
|
||||
SET a.a=a.a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a.a=a.a+1;
|
||||
BEGIN
|
||||
DECLARE b ROW TYPE OF t1 DEFAULT ROW(30,'x30');
|
||||
SET b=a;
|
||||
SET b.a=a.a+1;
|
||||
SET a=b;
|
||||
SET a.a=b.a+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
Pos Instruction
|
||||
0 set b@0 (20,'x20')
|
||||
1 set b@0 PACKAGE_BODY.a@0
|
||||
2 set PACKAGE_BODY.a@0 b@0
|
||||
3 set b.a@0["a"] PACKAGE_BODY.a.a@0["a"] + 1
|
||||
4 set PACKAGE_BODY.a.a@0["a"] b.a@0["a"] + 1
|
||||
5 set PACKAGE_BODY.a.a@0["a"] PACKAGE_BODY.a.a@0["a"] + 1
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
Pos Instruction
|
||||
0 set a@0 (10,'x10')
|
||||
1 set a.a@0["a"] a.a@0["a"] + 1
|
||||
2 set b@1 (30,'x30')
|
||||
3 set b@1 a@0
|
||||
4 set b.a@1["a"] a.a@0["a"] + 1
|
||||
5 set a@0 b@1
|
||||
6 set a.a@0["a"] b.a@1["a"] + 1
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
200
mysql-test/main/sp-package-code.test
Normal file
200
mysql-test/main/sp-package-code.test
Normal file
|
@ -0,0 +1,200 @@
|
|||
-- source include/have_debug.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32101 CREATE PACKAGE [BODY] for sql_mode=DEFAULT
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1()
|
||||
BEGIN SELECT 1;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT RETURN 1;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
SHOW FUNCTION CODE pkg1.f1;
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
DROP PACKAGE pkg1;
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
PROCEDURE p2show();
|
||||
PROCEDURE p2public();
|
||||
FUNCTION f2public() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a INT DEFAULT 10;
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b INT DEFAULT 20;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
SET a=a+1;
|
||||
SET @a=@a+2;
|
||||
SELECT f1() FROM DUAL;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
PROCEDURE p2private()
|
||||
BEGIN
|
||||
SELECT 'This is p2private';
|
||||
END;
|
||||
PROCEDURE p2public()
|
||||
BEGIN
|
||||
SELECT 'This is p2public';
|
||||
END;
|
||||
FUNCTION f2private() RETURNS TEXT
|
||||
BEGIN
|
||||
RETURN 'This is f2private';
|
||||
END;
|
||||
FUNCTION f2public() RETURNS TEXT
|
||||
BEGIN
|
||||
RETURN 'This is f2public';
|
||||
END;
|
||||
PROCEDURE p2show()
|
||||
BEGIN
|
||||
SHOW FUNCTION CODE f2public;
|
||||
SHOW FUNCTION CODE f2private;
|
||||
SHOW PROCEDURE CODE p2public;
|
||||
SHOW PROCEDURE CODE p2private;
|
||||
SHOW PROCEDURE CODE p2show;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a=a+1;
|
||||
BEGIN
|
||||
DECLARE b INT;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
SHOW FUNCTION CODE pkg1.f1;
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
CALL pkg1.p2show;
|
||||
|
||||
DROP PACKAGE pkg1;
|
||||
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a TYPE OF t1.a DEFAULT 10;
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b TYPE OF t1.a DEFAULT 20;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET b=b+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
SET a=a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a=a+1;
|
||||
BEGIN
|
||||
DECLARE b TYPE OF t1.a;
|
||||
SET b=a;
|
||||
SET b=a+1;
|
||||
SET a=b;
|
||||
SET a=b+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a ROW(a INT,b TEXT) DEFAULT ROW(10,'x10');
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b ROW(a INT,b TEXT) DEFAULT ROW(20,'x20');
|
||||
SET b=a;
|
||||
SET a=b;
|
||||
SET b.a=a.a+1;
|
||||
SET a.a=b.a+1;
|
||||
SET a.a=a.a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a.a:=a.a+1;
|
||||
BEGIN
|
||||
DECLARE b ROW(a INT,b TEXT) DEFAULT ROW(30,'x30');
|
||||
SET b=a;
|
||||
SET b.a=a.a+1;
|
||||
SET a=b;
|
||||
SET a.a=b.a+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
DROP PACKAGE pkg1;
|
||||
|
||||
|
||||
CREATE TABLE t1 (a INT, b TEXT);
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE BODY pkg1
|
||||
DECLARE a ROW TYPE OF t1 DEFAULT ROW(10,'x10');
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE b ROW TYPE OF t1 DEFAULT ROW(20,'x20');
|
||||
SET b=a;
|
||||
SET a=b;
|
||||
SET b.a=a.a+1;
|
||||
SET a.a=b.a+1;
|
||||
SET a.a=a.a+1;
|
||||
END;
|
||||
-- Initialization section
|
||||
SET a.a=a.a+1;
|
||||
BEGIN
|
||||
DECLARE b ROW TYPE OF t1 DEFAULT ROW(30,'x30');
|
||||
SET b=a;
|
||||
SET b.a=a.a+1;
|
||||
SET a=b;
|
||||
SET a.a=b.a+1;
|
||||
END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW PROCEDURE CODE pkg1.p1;
|
||||
SHOW PACKAGE BODY CODE pkg1;
|
||||
DROP PACKAGE pkg1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
309
mysql-test/main/sp-package-security.result
Normal file
309
mysql-test/main/sp-package-security.result
Normal file
|
@ -0,0 +1,309 @@
|
|||
CREATE DATABASE db1;
|
||||
CREATE USER u1@localhost IDENTIFIED BY '';
|
||||
GRANT SELECT ON db1.* TO u1@localhost;
|
||||
connect conn1,localhost,u1,,db1;
|
||||
SELECT CURRENT_USER;
|
||||
CURRENT_USER
|
||||
u1@localhost
|
||||
#
|
||||
# User u1 cannot drop PROCEDURE, PACKAGE, PACKAGE BODY by default
|
||||
#
|
||||
DROP PROCEDURE p1;
|
||||
ERROR 42000: alter routine command denied to user 'u1'@'localhost' for routine 'db1.p1'
|
||||
DROP PACKAGE pkg1;
|
||||
ERROR 42000: alter routine command denied to user 'u1'@'localhost' for routine 'db1.pkg1'
|
||||
DROP PACKAGE BODY pkg1;
|
||||
ERROR 42000: alter routine command denied to user 'u1'@'localhost' for routine 'db1.pkg1'
|
||||
#
|
||||
# User u1 cannot create PROCEDURE, PACKAGE, PACKAGE BODY by default
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Access denied for user 'u1'@'localhost' to database 'db1'
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Access denied for user 'u1'@'localhost' to database 'db1'
|
||||
CREATE PACKAGE BODY pkg1 AS
|
||||
PROCEDURE p1() AS BEGIN END;
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: PACKAGE db1.pkg1 does not exist
|
||||
#
|
||||
# Now create a PACKAGE by root
|
||||
#
|
||||
connection default;
|
||||
USE db1;
|
||||
CREATE PROCEDURE p1root()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END;
|
||||
$$
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PACKAGE `pkg1` PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
#
|
||||
# u1 cannot SHOW yet:
|
||||
# - the standalone procedure earlier created by root
|
||||
# - the package specifications earlier create by root
|
||||
#
|
||||
connection conn1;
|
||||
SHOW CREATE PROCEDURE p1root;
|
||||
ERROR 42000: PROCEDURE p1root does not exist
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
ERROR 42000: PACKAGE pkg1 does not exist
|
||||
#
|
||||
# User u1 still cannot create a PACKAGE BODY
|
||||
#
|
||||
connection conn1;
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN END;
|
||||
FUNCTION f1() RETURNS TEXT BEGIN RETURN 'This is f1'; END;
|
||||
END;
|
||||
$$
|
||||
ERROR 42000: Access denied for user 'u1'@'localhost' to database 'db1'
|
||||
#
|
||||
# Now grant EXECUTE:
|
||||
# - on the standalone procedure earlier created by root
|
||||
# - on the package specification earlier created by root
|
||||
#
|
||||
connection default;
|
||||
GRANT EXECUTE ON PROCEDURE db1.p1root TO u1@localhost;
|
||||
GRANT EXECUTE ON PACKAGE db1.pkg1 TO u1@localhost;
|
||||
#
|
||||
# Now u1 can do SHOW for:
|
||||
# - the standalone procedure earlier created by root
|
||||
# - the package specification earlier created by root
|
||||
#
|
||||
disconnect conn1;
|
||||
connect conn1,localhost,u1,,db1;
|
||||
SHOW CREATE PROCEDURE db1.p1root;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
p1root STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW CREATE PACKAGE db1.pkg1;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
#
|
||||
# Now revoke EXECUTE and grant CREATE ROUTINE instead
|
||||
#
|
||||
connection default;
|
||||
REVOKE EXECUTE ON PROCEDURE db1.p1root FROM u1@localhost;
|
||||
REVOKE EXECUTE ON PACKAGE db1.pkg1 FROM u1@localhost;
|
||||
GRANT CREATE ROUTINE ON db1.* TO u1@localhost;
|
||||
#
|
||||
# Reconnect u1 to make new grants have effect
|
||||
#
|
||||
disconnect conn1;
|
||||
connect conn1,localhost,u1,,db1;
|
||||
#
|
||||
# Now u1 can SHOW:
|
||||
# - standalone routines earlier created by root
|
||||
# - package specifications earlier created by root
|
||||
#
|
||||
SHOW CREATE PROCEDURE p1root;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
p1root STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
#
|
||||
# Now u1 can CREATE, DROP and EXECUTE its own standalone procedures
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
$$
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `db1`.`p1` TO `u1`@`localhost`
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
#
|
||||
# Now u1 can also CREATE, DROP its own package specifications
|
||||
#
|
||||
CREATE PACKAGE pkg2
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
SHOW CREATE PACKAGE pkg2;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`u1`@`localhost` PACKAGE `pkg2` PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
GRANT EXECUTE, ALTER ROUTINE ON PACKAGE `db1`.`pkg2` TO `u1`@`localhost`
|
||||
DROP PACKAGE pkg2;
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
#
|
||||
# Now u1 can also CREATE, DROP package bodies and EXECUTE package body routines
|
||||
#
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN SELECT 'This is pkg1.p1' AS `comment`; END;
|
||||
FUNCTION f1() RETURNS TEXT BEGIN RETURN 'This is pkg1.f1'; END;
|
||||
END;
|
||||
$$
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW CREATE PACKAGE BODY pkg1;
|
||||
Package body sql_mode Create Package Body character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`u1`@`localhost` PACKAGE BODY `pkg1` PROCEDURE p1() BEGIN SELECT 'This is pkg1.p1' AS `comment`; END;
|
||||
FUNCTION f1() RETURNS TEXT BEGIN RETURN 'This is pkg1.f1'; END;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
GRANT EXECUTE, ALTER ROUTINE ON PACKAGE BODY `db1`.`pkg1` TO `u1`@`localhost`
|
||||
CALL pkg1.p1;
|
||||
comment
|
||||
This is pkg1.p1
|
||||
SELECT pkg1.f1();
|
||||
pkg1.f1()
|
||||
This is pkg1.f1
|
||||
DROP PACKAGE BODY pkg1;
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
#
|
||||
# Now create a PACKAGE BODY by root.
|
||||
# u1 does not have EXECUTE access by default.
|
||||
#
|
||||
connection default;
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN SELECT 'This is pkg1.p1' AS `comment`; END;
|
||||
FUNCTION f1() RETURNS TEXT RETURN 'This is pkg1.f1';
|
||||
END;
|
||||
$$
|
||||
connection conn1;
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW CREATE PACKAGE BODY pkg1;
|
||||
Package body sql_mode Create Package Body character_set_client collation_connection Database Collation
|
||||
pkg1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
CALL pkg1.p1;
|
||||
ERROR 42000: execute command denied to user 'u1'@'localhost' for routine 'db1.pkg1'
|
||||
SELECT pkg1.f1();
|
||||
ERROR 42000: execute command denied to user 'u1'@'localhost' for routine 'db1.pkg1'
|
||||
#
|
||||
# Now grant EXECUTE to u1 on the PACKAGE BODY created by root
|
||||
#
|
||||
connection default;
|
||||
GRANT EXECUTE ON PACKAGE BODY db1.pkg1 TO u1@localhost;
|
||||
disconnect conn1;
|
||||
connect conn1,localhost,u1,,db1;
|
||||
SELECT CURRENT_USER;
|
||||
CURRENT_USER
|
||||
u1@localhost
|
||||
SHOW GRANTS;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
GRANT SELECT, CREATE ROUTINE ON `db1`.* TO `u1`@`localhost`
|
||||
GRANT EXECUTE ON PACKAGE BODY `db1`.`pkg1` TO `u1`@`localhost`
|
||||
CALL pkg1.p1;
|
||||
comment
|
||||
This is pkg1.p1
|
||||
SELECT pkg1.f1();
|
||||
pkg1.f1()
|
||||
This is pkg1.f1
|
||||
connection default;
|
||||
DROP PACKAGE BODY pkg1;
|
||||
#
|
||||
# u1 still cannot DROP the package specification earlier created by root.
|
||||
#
|
||||
connection conn1;
|
||||
DROP PACKAGE pkg1;
|
||||
ERROR 42000: alter routine command denied to user 'u1'@'localhost' for routine 'db1.pkg1'
|
||||
#
|
||||
# Grant ALTER ROUTINE to u1
|
||||
#
|
||||
connection default;
|
||||
GRANT ALTER ROUTINE ON db1.* TO u1@localhost;
|
||||
#
|
||||
# Now u1 can DROP:
|
||||
# - the standalone procedure earlier created by root
|
||||
# - the package specification earlier created by root
|
||||
#
|
||||
disconnect conn1;
|
||||
connect conn1,localhost,u1,,db1;
|
||||
DROP PACKAGE pkg1;
|
||||
DROP PROCEDURE p1root;
|
||||
disconnect conn1;
|
||||
connection default;
|
||||
DROP USER u1@localhost;
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
#
|
||||
# Creator=root, definer=xxx
|
||||
#
|
||||
CREATE USER xxx@localhost;
|
||||
CREATE DEFINER=xxx@localhost PACKAGE p1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE DEFINER=xxx@localhost PACKAGE BODY p1
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'p1.p1' AS msg;
|
||||
END;
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'package body p1' AS msg;
|
||||
END;
|
||||
$$
|
||||
CALL p1.p1;
|
||||
ERROR 42000: execute command denied to user 'xxx'@'localhost' for routine 'test.p1'
|
||||
GRANT EXECUTE ON PACKAGE BODY test.p1 TO xxx@localhost;
|
||||
CALL p1.p1;
|
||||
SESSION_USER() CURRENT_USER() msg
|
||||
root@localhost xxx@localhost package body p1
|
||||
SESSION_USER() CURRENT_USER() msg
|
||||
root@localhost xxx@localhost p1.p1
|
||||
DROP PACKAGE p1;
|
||||
DROP USER xxx@localhost;
|
||||
#
|
||||
# Creator=root, definer=xxx, SQL SECURITY INVOKER
|
||||
#
|
||||
CREATE USER xxx@localhost;
|
||||
CREATE DEFINER=xxx@localhost PACKAGE p1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 SQL SECURITY INVOKER
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'p1.p1' AS msg;
|
||||
END;
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'package body p1' AS msg;
|
||||
END;
|
||||
$$
|
||||
CALL p1.p1;
|
||||
SESSION_USER() CURRENT_USER() msg
|
||||
root@localhost root@localhost package body p1
|
||||
SESSION_USER() CURRENT_USER() msg
|
||||
root@localhost root@localhost p1.p1
|
||||
DROP PACKAGE p1;
|
||||
DROP USER xxx@localhost;
|
322
mysql-test/main/sp-package-security.test
Normal file
322
mysql-test/main/sp-package-security.test
Normal file
|
@ -0,0 +1,322 @@
|
|||
--source include/not_embedded.inc
|
||||
--source include/default_charset.inc
|
||||
|
||||
CREATE DATABASE db1;
|
||||
CREATE USER u1@localhost IDENTIFIED BY '';
|
||||
GRANT SELECT ON db1.* TO u1@localhost;
|
||||
|
||||
connect (conn1,localhost,u1,,db1);
|
||||
SELECT CURRENT_USER;
|
||||
|
||||
--echo #
|
||||
--echo # User u1 cannot drop PROCEDURE, PACKAGE, PACKAGE BODY by default
|
||||
--echo #
|
||||
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
DROP PROCEDURE p1;
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
DROP PACKAGE pkg1;
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
DROP PACKAGE BODY pkg1;
|
||||
|
||||
--echo #
|
||||
--echo # User u1 cannot create PROCEDURE, PACKAGE, PACKAGE BODY by default
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
# TODO: this should probably return ER_DBACCESS_DENIED_ERROR
|
||||
# here, and in the same place in compat/oracle.sp-package-security.test
|
||||
DELIMITER $$;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
CREATE PACKAGE BODY pkg1 AS
|
||||
PROCEDURE p1() AS BEGIN END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Now create a PACKAGE by root
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
USE db1;
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1root()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg1
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
|
||||
--echo #
|
||||
--echo # u1 cannot SHOW yet:
|
||||
--echo # - the standalone procedure earlier created by root
|
||||
--echo # - the package specifications earlier create by root
|
||||
--echo #
|
||||
|
||||
connection conn1;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
SHOW CREATE PROCEDURE p1root;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # User u1 still cannot create a PACKAGE BODY
|
||||
--echo #
|
||||
|
||||
connection conn1;
|
||||
DELIMITER $$;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN END;
|
||||
FUNCTION f1() RETURNS TEXT BEGIN RETURN 'This is f1'; END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Now grant EXECUTE:
|
||||
--echo # - on the standalone procedure earlier created by root
|
||||
--echo # - on the package specification earlier created by root
|
||||
--echo #
|
||||
connection default;
|
||||
GRANT EXECUTE ON PROCEDURE db1.p1root TO u1@localhost;
|
||||
GRANT EXECUTE ON PACKAGE db1.pkg1 TO u1@localhost;
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can do SHOW for:
|
||||
--echo # - the standalone procedure earlier created by root
|
||||
--echo # - the package specification earlier created by root
|
||||
--echo #
|
||||
|
||||
disconnect conn1;
|
||||
connect (conn1,localhost,u1,,db1);
|
||||
SHOW CREATE PROCEDURE db1.p1root;
|
||||
SHOW CREATE PACKAGE db1.pkg1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Now revoke EXECUTE and grant CREATE ROUTINE instead
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
REVOKE EXECUTE ON PROCEDURE db1.p1root FROM u1@localhost;
|
||||
REVOKE EXECUTE ON PACKAGE db1.pkg1 FROM u1@localhost;
|
||||
GRANT CREATE ROUTINE ON db1.* TO u1@localhost;
|
||||
|
||||
--echo #
|
||||
--echo # Reconnect u1 to make new grants have effect
|
||||
--echo #
|
||||
|
||||
disconnect conn1;
|
||||
connect (conn1,localhost,u1,,db1);
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can SHOW:
|
||||
--echo # - standalone routines earlier created by root
|
||||
--echo # - package specifications earlier created by root
|
||||
--echo #
|
||||
SHOW CREATE PROCEDURE p1root;
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can CREATE, DROP and EXECUTE its own standalone procedures
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW GRANTS;
|
||||
CALL p1;
|
||||
DROP PROCEDURE p1;
|
||||
SHOW GRANTS;
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can also CREATE, DROP its own package specifications
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE pkg2
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS TEXT;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW CREATE PACKAGE pkg2;
|
||||
SHOW GRANTS;
|
||||
DROP PACKAGE pkg2;
|
||||
SHOW GRANTS;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can also CREATE, DROP package bodies and EXECUTE package body routines
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN SELECT 'This is pkg1.p1' AS `comment`; END;
|
||||
FUNCTION f1() RETURNS TEXT BEGIN RETURN 'This is pkg1.f1'; END;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
SHOW CREATE PACKAGE BODY pkg1;
|
||||
SHOW GRANTS;
|
||||
CALL pkg1.p1;
|
||||
SELECT pkg1.f1();
|
||||
DROP PACKAGE BODY pkg1;
|
||||
SHOW GRANTS;
|
||||
|
||||
--echo #
|
||||
--echo # Now create a PACKAGE BODY by root.
|
||||
--echo # u1 does not have EXECUTE access by default.
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
DELIMITER $$;
|
||||
CREATE PACKAGE BODY pkg1
|
||||
PROCEDURE p1() BEGIN SELECT 'This is pkg1.p1' AS `comment`; END;
|
||||
FUNCTION f1() RETURNS TEXT RETURN 'This is pkg1.f1';
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
connection conn1;
|
||||
SHOW CREATE PACKAGE pkg1;
|
||||
SHOW CREATE PACKAGE BODY pkg1;
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
CALL pkg1.p1;
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
SELECT pkg1.f1();
|
||||
|
||||
--echo #
|
||||
--echo # Now grant EXECUTE to u1 on the PACKAGE BODY created by root
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
GRANT EXECUTE ON PACKAGE BODY db1.pkg1 TO u1@localhost;
|
||||
disconnect conn1;
|
||||
connect (conn1,localhost,u1,,db1);
|
||||
SELECT CURRENT_USER;
|
||||
SHOW GRANTS;
|
||||
CALL pkg1.p1;
|
||||
SELECT pkg1.f1();
|
||||
|
||||
connection default;
|
||||
DROP PACKAGE BODY pkg1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # u1 still cannot DROP the package specification earlier created by root.
|
||||
--echo #
|
||||
|
||||
connection conn1;
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
DROP PACKAGE pkg1;
|
||||
|
||||
--echo #
|
||||
--echo # Grant ALTER ROUTINE to u1
|
||||
--echo #
|
||||
|
||||
connection default;
|
||||
GRANT ALTER ROUTINE ON db1.* TO u1@localhost;
|
||||
|
||||
--echo #
|
||||
--echo # Now u1 can DROP:
|
||||
--echo # - the standalone procedure earlier created by root
|
||||
--echo # - the package specification earlier created by root
|
||||
--echo #
|
||||
|
||||
disconnect conn1;
|
||||
connect (conn1,localhost,u1,,db1);
|
||||
DROP PACKAGE pkg1;
|
||||
DROP PROCEDURE p1root;
|
||||
|
||||
disconnect conn1;
|
||||
connection default;
|
||||
|
||||
DROP USER u1@localhost;
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Creator=root, definer=xxx
|
||||
--echo #
|
||||
|
||||
CREATE USER xxx@localhost;
|
||||
DELIMITER $$;
|
||||
CREATE DEFINER=xxx@localhost PACKAGE p1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE DEFINER=xxx@localhost PACKAGE BODY p1
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'p1.p1' AS msg;
|
||||
END;
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'package body p1' AS msg;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
CALL p1.p1;
|
||||
GRANT EXECUTE ON PACKAGE BODY test.p1 TO xxx@localhost;
|
||||
CALL p1.p1;
|
||||
DROP PACKAGE p1;
|
||||
DROP USER xxx@localhost;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Creator=root, definer=xxx, SQL SECURITY INVOKER
|
||||
--echo #
|
||||
|
||||
CREATE USER xxx@localhost;
|
||||
DELIMITER $$;
|
||||
CREATE DEFINER=xxx@localhost PACKAGE p1
|
||||
PROCEDURE p1();
|
||||
END;
|
||||
$$
|
||||
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 SQL SECURITY INVOKER
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'p1.p1' AS msg;
|
||||
END;
|
||||
SELECT SESSION_USER(), CURRENT_USER(), 'package body p1' AS msg;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL p1.p1;
|
||||
DROP PACKAGE p1;
|
||||
DROP USER xxx@localhost;
|
51
mysql-test/main/sp-package.result
Normal file
51
mysql-test/main/sp-package.result
Normal file
|
@ -0,0 +1,51 @@
|
|||
SET sql_mode='';
|
||||
CREATE OR REPLACE PACKAGE pkg
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
END;
|
||||
$$
|
||||
CREATE OR REPLACE PACKAGE BODY pkg
|
||||
-- variable declarations
|
||||
DECLARE a INT DEFAULT 11;
|
||||
DECLARE b INT DEFAULT 10;
|
||||
-- routine declarations
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT CURRENT_USER;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
-- initialization section
|
||||
SET a=a-b;
|
||||
END;
|
||||
$$
|
||||
SHOW CREATE PACKAGE pkg;
|
||||
Package sql_mode Create Package character_set_client collation_connection Database Collation
|
||||
pkg CREATE DEFINER=`root`@`localhost` PACKAGE `pkg` PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
SHOW CREATE PACKAGE BODY pkg;
|
||||
Package body sql_mode Create Package Body character_set_client collation_connection Database Collation
|
||||
pkg CREATE DEFINER=`root`@`localhost` PACKAGE BODY `pkg` DECLARE a INT DEFAULT 11;
|
||||
DECLARE b INT DEFAULT 10;
|
||||
-- routine declarations
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT CURRENT_USER;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
-- initialization section
|
||||
SET a=a-b;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
CALL pkg.p1();
|
||||
CURRENT_USER
|
||||
root@localhost
|
||||
SELECT pkg.f1();
|
||||
pkg.f1()
|
||||
1
|
||||
DROP PACKAGE pkg;
|
46
mysql-test/main/sp-package.test
Normal file
46
mysql-test/main/sp-package.test
Normal file
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# CREATE PACKAGE for sql_mode='';
|
||||
# Resebmles SQL Standard 'CREATE MODULE'.
|
||||
#
|
||||
|
||||
SET sql_mode='';
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE OR REPLACE PACKAGE pkg
|
||||
PROCEDURE p1();
|
||||
FUNCTION f1() RETURNS INT;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE OR REPLACE PACKAGE BODY pkg
|
||||
-- variable declarations
|
||||
DECLARE a INT DEFAULT 11;
|
||||
DECLARE b INT DEFAULT 10;
|
||||
|
||||
-- routine declarations
|
||||
PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT CURRENT_USER;
|
||||
END;
|
||||
FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
RETURN a;
|
||||
END;
|
||||
|
||||
-- initialization section
|
||||
SET a=a-b;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
SHOW CREATE PACKAGE pkg;
|
||||
SHOW CREATE PACKAGE BODY pkg;
|
||||
|
||||
CALL pkg.p1();
|
||||
SELECT pkg.f1();
|
||||
|
||||
DROP PACKAGE pkg;
|
|
@ -3148,7 +3148,24 @@ collation_connection latin1_swedish_ci
|
|||
DROP VIEW v_test;
|
||||
SET sql_mode=DEFAULT;
|
||||
CREATE VIEW v_test AS SELECT 1 AS c1 FROM DUAL WHERE 1=test1.f_test();
|
||||
ERROR 42000: FUNCTION test1.f_test does not exist
|
||||
SELECT * FROM v_test;
|
||||
c1
|
||||
1
|
||||
SHOW CREATE VIEW v_test;
|
||||
View v_test
|
||||
Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_test` AS select 1 AS `c1` from DUAL where 1 = `test`.`test1`.`f_test`()
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
SET sql_mode=ORACLE;
|
||||
SELECT * FROM v_test;
|
||||
c1
|
||||
1
|
||||
SHOW CREATE VIEW v_test;
|
||||
View v_test
|
||||
Create View CREATE VIEW "v_test" AS select 1 AS "c1" from DUAL where 1 = "test"."test1"."f_test"()
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
DROP VIEW v_test;
|
||||
SET sql_mode=ORACLE;
|
||||
CREATE VIEW v_test AS SELECT 1 AS c1 FROM DUAL WHERE 1=test.test1.f_test();
|
||||
SELECT * FROM v_test;
|
||||
|
|
|
@ -2854,13 +2854,18 @@ END test1;
|
|||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
#
|
||||
# A VIEW created with sql_mode=ORACLE, calling a package routine
|
||||
#
|
||||
SET sql_mode=ORACLE;
|
||||
CREATE VIEW v_test AS SELECT 1 AS c1 FROM DUAL WHERE 1=test1.f_test();
|
||||
SELECT * FROM v_test;
|
||||
--vertical_results
|
||||
SHOW CREATE VIEW v_test;
|
||||
--horizontal_results
|
||||
#
|
||||
# It also works with sql_mode=DEFALT
|
||||
#
|
||||
SET sql_mode=DEFAULT;
|
||||
SELECT * FROM v_test;
|
||||
--vertical_results
|
||||
|
@ -2868,10 +2873,24 @@ SHOW CREATE VIEW v_test;
|
|||
--horizontal_results
|
||||
DROP VIEW v_test;
|
||||
|
||||
|
||||
#
|
||||
# A VIEW created with sql_mode=DEFAULT, calling a package routine
|
||||
#
|
||||
SET sql_mode=DEFAULT;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
CREATE VIEW v_test AS SELECT 1 AS c1 FROM DUAL WHERE 1=test1.f_test();
|
||||
SELECT * FROM v_test;
|
||||
--vertical_results
|
||||
SHOW CREATE VIEW v_test;
|
||||
#
|
||||
# It also works with sql_mode=ORACLE
|
||||
#
|
||||
--horizontal_results
|
||||
SET sql_mode=ORACLE;
|
||||
SELECT * FROM v_test;
|
||||
--vertical_results
|
||||
SHOW CREATE VIEW v_test;
|
||||
--horizontal_results
|
||||
DROP VIEW v_test;
|
||||
|
||||
|
||||
SET sql_mode=ORACLE;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -188,16 +188,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 4
|
||||
stage/sql/closing tables 11
|
||||
stage/sql/closing tables 12
|
||||
stage/sql/init 3
|
||||
stage/sql/Opening tables 7
|
||||
stage/sql/Opening tables 8
|
||||
stage/sql/starting 6
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 4
|
||||
stage/sql/closing tables 11
|
||||
stage/sql/closing tables 12
|
||||
stage/sql/init 3
|
||||
stage/sql/Opening tables 7
|
||||
stage/sql/Opening tables 8
|
||||
stage/sql/starting 6
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -225,10 +225,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 2
|
||||
transaction 3
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 2
|
||||
transaction 3
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -272,16 +272,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 4
|
||||
stage/sql/closing tables 11
|
||||
stage/sql/closing tables 12
|
||||
stage/sql/init 3
|
||||
stage/sql/Opening tables 7
|
||||
stage/sql/Opening tables 8
|
||||
stage/sql/starting 6
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 4
|
||||
stage/sql/closing tables 11
|
||||
stage/sql/closing tables 12
|
||||
stage/sql/init 3
|
||||
stage/sql/Opening tables 7
|
||||
stage/sql/Opening tables 8
|
||||
stage/sql/starting 6
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -309,10 +309,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 2
|
||||
transaction 3
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 2
|
||||
transaction 3
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -368,16 +368,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 8
|
||||
stage/sql/closing tables 21
|
||||
stage/sql/closing tables 23
|
||||
stage/sql/init 6
|
||||
stage/sql/Opening tables 13
|
||||
stage/sql/Opening tables 15
|
||||
stage/sql/starting 12
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 8
|
||||
stage/sql/closing tables 21
|
||||
stage/sql/closing tables 23
|
||||
stage/sql/init 6
|
||||
stage/sql/Opening tables 13
|
||||
stage/sql/Opening tables 15
|
||||
stage/sql/starting 12
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -405,10 +405,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 4
|
||||
transaction 6
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 4
|
||||
transaction 6
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -453,16 +453,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 8
|
||||
stage/sql/closing tables 21
|
||||
stage/sql/closing tables 23
|
||||
stage/sql/init 6
|
||||
stage/sql/Opening tables 13
|
||||
stage/sql/Opening tables 15
|
||||
stage/sql/starting 12
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 8
|
||||
stage/sql/closing tables 21
|
||||
stage/sql/closing tables 23
|
||||
stage/sql/init 6
|
||||
stage/sql/Opening tables 13
|
||||
stage/sql/Opening tables 15
|
||||
stage/sql/starting 12
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -490,10 +490,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 4
|
||||
transaction 6
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 4
|
||||
transaction 6
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -550,16 +550,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 12
|
||||
stage/sql/closing tables 31
|
||||
stage/sql/closing tables 34
|
||||
stage/sql/init 9
|
||||
stage/sql/Opening tables 19
|
||||
stage/sql/Opening tables 22
|
||||
stage/sql/starting 18
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 12
|
||||
stage/sql/closing tables 31
|
||||
stage/sql/closing tables 34
|
||||
stage/sql/init 9
|
||||
stage/sql/Opening tables 19
|
||||
stage/sql/Opening tables 22
|
||||
stage/sql/starting 18
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -587,10 +587,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 6
|
||||
transaction 9
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 6
|
||||
transaction 9
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -636,16 +636,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 12
|
||||
stage/sql/closing tables 31
|
||||
stage/sql/closing tables 34
|
||||
stage/sql/init 9
|
||||
stage/sql/Opening tables 19
|
||||
stage/sql/Opening tables 22
|
||||
stage/sql/starting 18
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 12
|
||||
stage/sql/closing tables 31
|
||||
stage/sql/closing tables 34
|
||||
stage/sql/init 9
|
||||
stage/sql/Opening tables 19
|
||||
stage/sql/Opening tables 22
|
||||
stage/sql/starting 18
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -673,10 +673,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 6
|
||||
transaction 9
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 6
|
||||
transaction 9
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -734,16 +734,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 24
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 24
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -771,10 +771,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -819,16 +819,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 25
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 25
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -857,10 +857,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -904,16 +904,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 26
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 26
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -942,10 +942,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -988,16 +988,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 27
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 27
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1026,10 +1026,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1071,16 +1071,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1109,10 +1109,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1155,16 +1155,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1193,10 +1193,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1238,16 +1238,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1276,10 +1276,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1321,16 +1321,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1359,10 +1359,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1404,16 +1404,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1442,10 +1442,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1487,16 +1487,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1525,10 +1525,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1570,16 +1570,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1608,10 +1608,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1653,16 +1653,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1691,10 +1691,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1736,16 +1736,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1774,10 +1774,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1819,16 +1819,16 @@ host event_name count_star
|
|||
execute dump_stages_global;
|
||||
event_name count_star
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1857,10 +1857,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1909,9 +1909,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -1940,10 +1940,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -1992,9 +1992,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2023,10 +2023,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2075,9 +2075,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2106,10 +2106,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2158,9 +2158,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2189,10 +2189,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2241,9 +2241,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2272,10 +2272,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2324,9 +2324,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2355,10 +2355,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2407,9 +2407,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2438,10 +2438,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2490,9 +2490,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2521,10 +2521,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2573,9 +2573,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2604,10 +2604,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2656,9 +2656,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2687,10 +2687,10 @@ execute dump_transactions_host;
|
|||
host event_name count_star
|
||||
execute dump_transactions_global;
|
||||
event_name count_star
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2739,9 +2739,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2773,7 +2773,7 @@ event_name count_star
|
|||
transaction 0
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2822,9 +2822,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2856,7 +2856,7 @@ event_name count_star
|
|||
transaction 0
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2905,9 +2905,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -2939,7 +2939,7 @@ event_name count_star
|
|||
transaction 0
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
@ -2988,9 +2988,9 @@ stage/sql/starting 0
|
|||
execute dump_stages_history;
|
||||
event_name count(event_name)
|
||||
stage/sql/checking permissions 16
|
||||
stage/sql/closing tables 41
|
||||
stage/sql/closing tables 45
|
||||
stage/sql/init 12
|
||||
stage/sql/Opening tables 25
|
||||
stage/sql/Opening tables 29
|
||||
stage/sql/starting 28
|
||||
execute dump_statements_account;
|
||||
user host event_name count_star
|
||||
|
@ -3022,7 +3022,7 @@ event_name count_star
|
|||
transaction 0
|
||||
execute dump_transactions_history;
|
||||
event_name count(event_name)
|
||||
transaction 8
|
||||
transaction 12
|
||||
execute dump_accounts;
|
||||
USER HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS
|
||||
execute dump_users;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -2628,7 +2628,7 @@ Sp_handler::sp_resolve_package_routine(THD *thd,
|
|||
const Sp_handler **pkg_routine_handler,
|
||||
Database_qualified_name *pkgname) const
|
||||
{
|
||||
if (!thd->db.length || !(thd->variables.sql_mode & MODE_ORACLE))
|
||||
if (!thd->db.length)
|
||||
return false;
|
||||
|
||||
return name->m_explicit_name ?
|
||||
|
|
6
sql/sp.h
6
sql/sp.h
|
@ -157,6 +157,7 @@ public:
|
|||
}
|
||||
virtual enum_sp_type type() const= 0;
|
||||
virtual LEX_CSTRING type_lex_cstring() const= 0;
|
||||
virtual enum_sql_command sqlcom_create() const= 0;
|
||||
virtual enum_sql_command sqlcom_drop() const= 0;
|
||||
virtual LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const
|
||||
{
|
||||
|
@ -257,6 +258,7 @@ public:
|
|||
static LEX_CSTRING m_type_str= { STRING_WITH_LEN("PROCEDURE")};
|
||||
return m_type_str;
|
||||
}
|
||||
enum_sql_command sqlcom_create() const { return SQLCOM_CREATE_PROCEDURE; }
|
||||
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PROCEDURE; }
|
||||
LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const;
|
||||
const char *show_create_routine_col1_caption() const
|
||||
|
@ -308,6 +310,7 @@ public:
|
|||
static LEX_CSTRING m_type_str= { STRING_WITH_LEN("FUNCTION")};
|
||||
return m_type_str;
|
||||
}
|
||||
enum_sql_command sqlcom_create() const { return SQLCOM_CREATE_FUNCTION; }
|
||||
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_FUNCTION; }
|
||||
LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const;
|
||||
const char *show_create_routine_col1_caption() const
|
||||
|
@ -378,6 +381,7 @@ public:
|
|||
static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE")};
|
||||
return m_type_str;
|
||||
}
|
||||
enum_sql_command sqlcom_create() const { return SQLCOM_CREATE_PACKAGE; }
|
||||
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PACKAGE; }
|
||||
LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const
|
||||
{
|
||||
|
@ -412,6 +416,7 @@ public:
|
|||
static LEX_CSTRING m_type_str= {STRING_WITH_LEN("PACKAGE BODY")};
|
||||
return m_type_str;
|
||||
}
|
||||
enum_sql_command sqlcom_create() const { return SQLCOM_CREATE_PACKAGE_BODY; }
|
||||
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_PACKAGE_BODY; }
|
||||
LEX_CSTRING empty_body_lex_cstring(sql_mode_t mode) const
|
||||
{
|
||||
|
@ -446,6 +451,7 @@ public:
|
|||
static LEX_CSTRING m_type_str= { STRING_WITH_LEN("TRIGGER")};
|
||||
return m_type_str;
|
||||
}
|
||||
enum_sql_command sqlcom_create() const { return SQLCOM_CREATE_TRIGGER; }
|
||||
enum_sql_command sqlcom_drop() const { return SQLCOM_DROP_TRIGGER; }
|
||||
MDL_key::enum_mdl_namespace get_mdl_type() const
|
||||
{
|
||||
|
|
|
@ -7370,6 +7370,35 @@ sp_name *LEX::make_sp_name(THD *thd, const Lex_ident_sys_st &name1,
|
|||
}
|
||||
|
||||
|
||||
sp_lex_local *LEX::package_routine_start(THD *thd,
|
||||
const Sp_handler *sph,
|
||||
const Lex_ident_sys_st &name)
|
||||
{
|
||||
DBUG_ASSERT(sphead);
|
||||
DBUG_ASSERT(sphead->get_package());
|
||||
thd->m_parser_state->m_yacc.reset_before_substatement();
|
||||
|
||||
sp_lex_local *sublex= new (thd->mem_root) sp_lex_local(thd, this);
|
||||
if (!unlikely(sublex))
|
||||
return NULL;
|
||||
|
||||
sublex->sql_command= sph->sqlcom_create();
|
||||
sp_name *spname= make_sp_name_package_routine(thd, name);
|
||||
if (unlikely(!spname))
|
||||
return NULL;
|
||||
|
||||
if (sublex->sql_command == SQLCOM_CREATE_FUNCTION)
|
||||
(void) is_native_function_with_warn(thd, &name);
|
||||
|
||||
enum_sp_aggregate_type atype= sublex->sql_command == SQLCOM_CREATE_FUNCTION ?
|
||||
NOT_AGGREGATE : DEFAULT_AGGREGATE;
|
||||
if (unlikely(!sublex->make_sp_head_no_recursive(thd, spname, sph, atype)))
|
||||
return NULL;
|
||||
sphead->get_package()->m_current_routine= sublex;
|
||||
return sublex;
|
||||
}
|
||||
|
||||
|
||||
sp_head *LEX::make_sp_head(THD *thd, const sp_name *name,
|
||||
const Sp_handler *sph,
|
||||
enum_sp_aggregate_type agg_type)
|
||||
|
@ -9311,10 +9340,10 @@ sp_package *LEX::get_sp_package() const
|
|||
|
||||
|
||||
sp_package *LEX::create_package_start(THD *thd,
|
||||
enum_sql_command command,
|
||||
const Sp_handler *sph,
|
||||
const sp_name *name_arg,
|
||||
DDL_options_st options)
|
||||
DDL_options_st options,
|
||||
const st_sp_chistics &chistics)
|
||||
{
|
||||
sp_package *pkg;
|
||||
|
||||
|
@ -9323,7 +9352,7 @@ sp_package *LEX::create_package_start(THD *thd,
|
|||
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), sph->type_str());
|
||||
return NULL;
|
||||
}
|
||||
if (unlikely(set_command_with_check(command, options)))
|
||||
if (unlikely(set_command_with_check(sph->sqlcom_create(), options)))
|
||||
return NULL;
|
||||
if (sph->type() == SP_TYPE_PACKAGE_BODY)
|
||||
{
|
||||
|
@ -9359,6 +9388,7 @@ sp_package *LEX::create_package_start(THD *thd,
|
|||
pkg->reset_thd_mem_root(thd);
|
||||
pkg->init(this);
|
||||
pkg->make_qname(pkg->get_main_mem_root(), &pkg->m_qname);
|
||||
pkg->set_c_chistics(chistics);
|
||||
sphead= pkg;
|
||||
return pkg;
|
||||
}
|
||||
|
|
|
@ -3201,6 +3201,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class sp_lex_local;
|
||||
class sp_lex_cursor;
|
||||
|
||||
struct LEX: public Query_tables_list
|
||||
|
@ -3904,6 +3905,9 @@ public:
|
|||
const Lex_ident_sys_st &name2);
|
||||
sp_name *make_sp_name_package_routine(THD *thd,
|
||||
const Lex_ident_sys_st &name);
|
||||
sp_lex_local *package_routine_start(THD *thd,
|
||||
const Sp_handler *sph,
|
||||
const Lex_ident_sys_st &name);
|
||||
sp_head *make_sp_head(THD *thd, const sp_name *name, const Sp_handler *sph,
|
||||
enum_sp_aggregate_type agg_type);
|
||||
sp_head *make_sp_head_no_recursive(THD *thd, const sp_name *name,
|
||||
|
@ -3916,10 +3920,10 @@ public:
|
|||
bool sp_body_finalize_procedure(THD *);
|
||||
bool sp_body_finalize_procedure_standalone(THD *, const sp_name *end_name);
|
||||
sp_package *create_package_start(THD *thd,
|
||||
enum_sql_command command,
|
||||
const Sp_handler *sph,
|
||||
const sp_name *name,
|
||||
DDL_options_st options);
|
||||
DDL_options_st options,
|
||||
const st_sp_chistics &chistics);
|
||||
bool create_package_finalize(THD *thd,
|
||||
const sp_name *name,
|
||||
const sp_name *name2,
|
||||
|
|
417
sql/sql_yacc.yy
417
sql/sql_yacc.yy
|
@ -1288,7 +1288,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||
%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER COMMENT_SYM
|
||||
|
||||
%left PREC_BELOW_SP_OBJECT_TYPE
|
||||
%left FUNCTION_SYM
|
||||
%left PACKAGE_MARIADB_SYM FUNCTION_SYM
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1314,7 +1314,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||
ALTER TABLE t1 ADD SYSTEM VERSIONING;
|
||||
*/
|
||||
%left PREC_BELOW_CONTRACTION_TOKEN2
|
||||
%left TEXT_STRING '(' ')' VALUE_SYM VERSIONING_SYM
|
||||
%left TEXT_STRING '(' ')' VALUE_SYM VERSIONING_SYM BODY_MARIADB_SYM
|
||||
%left EMPTY_FROM_CLAUSE
|
||||
%right INTO
|
||||
|
||||
|
@ -1395,6 +1395,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||
remember_cpp_ptr
|
||||
wild_and_where
|
||||
remember_start_opt
|
||||
remember_end_opt
|
||||
|
||||
%type <const_simple_string>
|
||||
field_length_str
|
||||
|
@ -1406,6 +1407,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||
%type <type_handler> int_type real_type
|
||||
|
||||
%type <sp_handler> sp_handler
|
||||
sp_handler_package_spec
|
||||
sp_handler_package_body
|
||||
|
||||
%type <json_on_response> json_on_response
|
||||
|
||||
|
@ -1908,6 +1911,28 @@ rule:
|
|||
%type <vers_column_versioning> with_or_without_system
|
||||
%type <engine_option_value_ptr> engine_defined_option;
|
||||
|
||||
%type <lex>
|
||||
remember_lex
|
||||
package_specification_function
|
||||
package_specification_procedure
|
||||
%type <spname> opt_trailing_sp_name
|
||||
%type <lex_str> opt_package_routine_end_name
|
||||
|
||||
%type <spblock>
|
||||
package_implementation_declare_section
|
||||
package_implementation_declare_section_list
|
||||
package_implementation_routine_definition
|
||||
package_implementation_item_declaration
|
||||
package_implementation_declare_section_list1
|
||||
package_implementation_declare_section_list2
|
||||
|
||||
%type <spblock_handlers> package_implementation_executable_section
|
||||
|
||||
%type <NONE>
|
||||
sp_package_function_body
|
||||
sp_package_procedure_body
|
||||
|
||||
|
||||
%ifdef MARIADB
|
||||
%type <NONE> sp_tail_standalone
|
||||
%type <NONE> sp_unlabeled_block_not_atomic
|
||||
|
@ -1925,14 +1950,11 @@ rule:
|
|||
%type <spvar_mode> sp_opt_inout
|
||||
%type <NONE> sp_tail_standalone
|
||||
%type <NONE> sp_labelable_stmt
|
||||
%type <simple_string> remember_end_opt
|
||||
%type <lex_str> opt_package_routine_end_name
|
||||
%type <lex_str> label_declaration_oracle
|
||||
%type <lex_str> labels_declaration_oracle
|
||||
%type <kwd> keyword_directly_assignable
|
||||
%type <ident_sys> ident_directly_assignable
|
||||
%type <ident_cli> ident_cli_directly_assignable
|
||||
%type <spname> opt_sp_name
|
||||
%type <spblock> sp_decl_body_list
|
||||
%type <spblock> opt_sp_decl_body_list
|
||||
%type <spblock> sp_decl_variable_list
|
||||
|
@ -1942,19 +1964,9 @@ rule:
|
|||
%type <spblock> sp_decl_handler
|
||||
%type <spblock> sp_decl_handler_list
|
||||
%type <spblock> opt_sp_decl_handler_list
|
||||
%type <spblock> package_implementation_routine_definition
|
||||
%type <spblock> package_implementation_item_declaration
|
||||
%type <spblock> package_implementation_declare_section
|
||||
%type <spblock> package_implementation_declare_section_list1
|
||||
%type <spblock> package_implementation_declare_section_list2
|
||||
%type <spblock_handlers> sp_block_statements_and_exceptions
|
||||
%type <spblock_handlers> package_implementation_executable_section
|
||||
%type <sp_instr_addr> sp_instr_addr
|
||||
%type <num> opt_exception_clause exception_handlers
|
||||
%type <lex> remember_lex
|
||||
%type <lex> package_routine_lex
|
||||
%type <lex> package_specification_function
|
||||
%type <lex> package_specification_procedure
|
||||
%endif ORACLE
|
||||
|
||||
%%
|
||||
|
@ -3052,10 +3064,19 @@ opt_aggregate:
|
|||
sp_handler:
|
||||
FUNCTION_SYM { $$= &sp_handler_function; }
|
||||
| PROCEDURE_SYM { $$= &sp_handler_procedure; }
|
||||
| PACKAGE_ORACLE_SYM { $$= &sp_handler_package_spec; }
|
||||
| PACKAGE_ORACLE_SYM BODY_ORACLE_SYM { $$= &sp_handler_package_body; }
|
||||
| sp_handler_package_spec
|
||||
| sp_handler_package_body
|
||||
;
|
||||
|
||||
sp_handler_package_spec:
|
||||
PACKAGE_ORACLE_SYM { $$= &sp_handler_package_spec; }
|
||||
| PACKAGE_MARIADB_SYM { $$= &sp_handler_package_spec; }
|
||||
;
|
||||
|
||||
sp_handler_package_body:
|
||||
PACKAGE_ORACLE_SYM BODY_ORACLE_SYM { $$= &sp_handler_package_body; }
|
||||
| PACKAGE_MARIADB_SYM BODY_MARIADB_SYM { $$= &sp_handler_package_body; }
|
||||
;
|
||||
|
||||
drop_routine:
|
||||
DROP sp_handler opt_if_exists ident '.' ident
|
||||
|
@ -5382,7 +5403,7 @@ opt_if_not_exists_table_element:
|
|||
;
|
||||
|
||||
opt_if_not_exists:
|
||||
/* empty */
|
||||
/* empty */ %prec PREC_BELOW_CONTRACTION_TOKEN2
|
||||
{
|
||||
$$.init();
|
||||
}
|
||||
|
@ -9244,6 +9265,21 @@ remember_start_opt:
|
|||
}
|
||||
;
|
||||
|
||||
remember_end_opt:
|
||||
{
|
||||
if (yychar == YYEMPTY)
|
||||
$$= (char*) YYLIP->get_cpp_ptr_rtrim();
|
||||
else
|
||||
$$= (char*) YYLIP->get_cpp_tok_end_rtrim();
|
||||
}
|
||||
;
|
||||
|
||||
remember_lex:
|
||||
{
|
||||
$$= thd->lex;
|
||||
}
|
||||
;
|
||||
|
||||
select_alias:
|
||||
/* empty */ { $$=null_clex_str;}
|
||||
| AS ident { $$=$2; }
|
||||
|
@ -13176,7 +13212,7 @@ opt_if_exists_table_element:
|
|||
;
|
||||
|
||||
opt_if_exists:
|
||||
/* empty */
|
||||
/* empty */ %prec PREC_BELOW_CONTRACTION_TOKEN2
|
||||
{
|
||||
$$.set(DDL_options_st::OPT_NONE);
|
||||
}
|
||||
|
@ -16194,7 +16230,7 @@ keyword_sp_var_and_label:
|
|||
| ONLY_SYM
|
||||
| ORDINALITY_SYM
|
||||
| OVERLAPS_SYM
|
||||
| PACKAGE_MARIADB_SYM
|
||||
| PACKAGE_MARIADB_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
|
||||
| PACK_KEYS_SYM
|
||||
| PAGE_SYM
|
||||
| PARTIAL
|
||||
|
@ -18165,6 +18201,28 @@ sf_return_type:
|
|||
}
|
||||
;
|
||||
|
||||
create_package_chistic:
|
||||
COMMENT_SYM TEXT_STRING_sys
|
||||
{ Lex->sp_chistics.comment= $2; }
|
||||
| sp_suid
|
||||
{ Lex->sp_chistics.suid= $1; }
|
||||
;
|
||||
|
||||
create_package_chistics:
|
||||
create_package_chistic {}
|
||||
| create_package_chistics create_package_chistic { }
|
||||
;
|
||||
|
||||
opt_create_package_chistics:
|
||||
/*empty*/ { }
|
||||
| create_package_chistics { }
|
||||
;
|
||||
|
||||
opt_create_package_chistics_init:
|
||||
{ Lex->sp_chistics.init(); }
|
||||
opt_create_package_chistics
|
||||
;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
xa:
|
||||
|
@ -18325,6 +18383,66 @@ sp_case_then_statements:
|
|||
sp_proc_stmts1
|
||||
;
|
||||
|
||||
sp_tail_is:
|
||||
/*empty*/ { }
|
||||
;
|
||||
|
||||
sp_package_function_body:
|
||||
sp_proc_stmt_in_returns_clause
|
||||
;
|
||||
|
||||
sp_package_procedure_body:
|
||||
sp_proc_stmt
|
||||
;
|
||||
|
||||
opt_trailing_sp_name:
|
||||
/*empty*/ { $$= NULL; }
|
||||
;
|
||||
|
||||
opt_package_routine_end_name:
|
||||
/*empty*/ { $$= null_clex_str; }
|
||||
| FORCE_LOOKAHEAD { $$= null_clex_str; }
|
||||
;
|
||||
|
||||
sf_parameters:
|
||||
sp_parenthesized_fdparam_list
|
||||
;
|
||||
|
||||
sp_parameters:
|
||||
sp_parenthesized_pdparam_list
|
||||
;
|
||||
|
||||
sf_returned_type_clause:
|
||||
RETURNS_SYM sf_return_type
|
||||
;
|
||||
|
||||
package_implementation_item_declaration:
|
||||
DECLARE_MARIADB_SYM sp_decl_variable_list ';' { $$= $2; }
|
||||
;
|
||||
|
||||
// Inside CREATE PACKAGE BODY, package-wide items (e.g. variables)
|
||||
// must be declared before routine definitions.
|
||||
|
||||
package_implementation_declare_section_list:
|
||||
package_implementation_declare_section_list1 %prec PREC_BELOW_SP_OBJECT_TYPE
|
||||
| package_implementation_declare_section_list2 %prec PREC_BELOW_SP_OBJECT_TYPE
|
||||
| package_implementation_declare_section_list1
|
||||
package_implementation_declare_section_list2 %prec PREC_BELOW_SP_OBJECT_TYPE
|
||||
{ $$.join($1, $2); }
|
||||
;
|
||||
|
||||
package_implementation_declare_section:
|
||||
package_implementation_declare_section_list
|
||||
;
|
||||
|
||||
package_implementation_executable_section:
|
||||
sp_proc_stmts END
|
||||
{
|
||||
$$.init(0);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
reserved_keyword_udt_param_type:
|
||||
INOUT_SYM
|
||||
| IN_SYM
|
||||
|
@ -18544,49 +18662,6 @@ sp_tail_standalone:
|
|||
}
|
||||
;
|
||||
|
||||
create_routine:
|
||||
create_or_replace definer_opt PROCEDURE_SYM opt_if_not_exists
|
||||
{
|
||||
if (Lex->stmt_create_procedure_start($1 | $4))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
sp_tail_standalone
|
||||
{
|
||||
Lex->stmt_create_routine_finalize();
|
||||
}
|
||||
| create_or_replace definer opt_aggregate FUNCTION_SYM opt_if_not_exists
|
||||
sp_name
|
||||
{
|
||||
if (Lex->stmt_create_stored_function_start($1 | $5, $3, $6))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
sp_parenthesized_fdparam_list
|
||||
RETURNS_SYM sf_return_type
|
||||
sf_c_chistics_and_body_standalone
|
||||
{
|
||||
Lex->stmt_create_routine_finalize();
|
||||
}
|
||||
| create_or_replace no_definer opt_aggregate FUNCTION_SYM opt_if_not_exists
|
||||
sp_name
|
||||
{
|
||||
if (Lex->stmt_create_stored_function_start($1 | $5, $3, $6))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
sp_parenthesized_fdparam_list
|
||||
RETURNS_SYM sf_return_type
|
||||
sf_c_chistics_and_body_standalone
|
||||
{
|
||||
Lex->stmt_create_routine_finalize();
|
||||
}
|
||||
| create_or_replace no_definer opt_aggregate FUNCTION_SYM opt_if_not_exists
|
||||
ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
|
||||
{
|
||||
if (Lex->stmt_create_udf_function($1 | $5, $3, $6,
|
||||
(Item_result) $8, $10))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
sp_decls:
|
||||
_empty
|
||||
|
@ -18778,6 +18853,30 @@ sp_case_then_statements:
|
|||
sp_proc_stmts1_implicit_block { }
|
||||
;
|
||||
|
||||
sp_parameters:
|
||||
opt_sp_parenthesized_pdparam_list
|
||||
;
|
||||
|
||||
sf_parameters:
|
||||
opt_sp_parenthesized_fdparam_list
|
||||
;
|
||||
|
||||
sf_returned_type_clause:
|
||||
RETURN_ORACLE_SYM sf_return_type
|
||||
;
|
||||
|
||||
package_implementation_item_declaration:
|
||||
sp_decl_variable_list ';'
|
||||
;
|
||||
|
||||
sp_package_function_body:
|
||||
sp_body { }
|
||||
;
|
||||
|
||||
sp_package_procedure_body:
|
||||
sp_body { }
|
||||
;
|
||||
|
||||
reserved_keyword_udt:
|
||||
reserved_keyword_udt_not_param_type
|
||||
;
|
||||
|
@ -18864,15 +18963,6 @@ sp_block_label:
|
|||
;
|
||||
|
||||
|
||||
remember_end_opt:
|
||||
{
|
||||
if (yychar == YYEMPTY)
|
||||
$$= (char*) YYLIP->get_cpp_ptr_rtrim();
|
||||
else
|
||||
$$= (char*) YYLIP->get_cpp_tok_end_rtrim();
|
||||
}
|
||||
;
|
||||
|
||||
sp_opt_default:
|
||||
_empty { $$= { nullptr, empty_clex_str}; }
|
||||
| DEFAULT remember_cpp_ptr expr remember_end
|
||||
|
@ -18921,12 +19011,6 @@ sp_proc_stmts1_implicit_block:
|
|||
;
|
||||
|
||||
|
||||
remember_lex:
|
||||
{
|
||||
$$= thd->lex;
|
||||
}
|
||||
;
|
||||
|
||||
keyword_directly_assignable:
|
||||
keyword_data_type
|
||||
| keyword_cast_type
|
||||
|
@ -19072,7 +19156,7 @@ opt_sp_parenthesized_pdparam_list:
|
|||
;
|
||||
|
||||
|
||||
opt_sp_name:
|
||||
opt_trailing_sp_name:
|
||||
_empty { $$= NULL; }
|
||||
| sp_name { $$= $1; }
|
||||
;
|
||||
|
@ -19111,32 +19195,38 @@ sp_body:
|
|||
END
|
||||
;
|
||||
|
||||
create_package_chistic:
|
||||
COMMENT_SYM TEXT_STRING_sys
|
||||
{ Lex->sp_chistics.comment= $2; }
|
||||
| sp_suid
|
||||
{ Lex->sp_chistics.suid= $1; }
|
||||
// Inside CREATE PACKAGE BODY, package-wide items (e.g. variables)
|
||||
// must be declared before routine definitions.
|
||||
|
||||
package_implementation_declare_section_list:
|
||||
package_implementation_declare_section_list1
|
||||
| package_implementation_declare_section_list2
|
||||
| package_implementation_declare_section_list1
|
||||
package_implementation_declare_section_list2
|
||||
{ $$.join($1, $2); }
|
||||
;
|
||||
|
||||
create_package_chistics:
|
||||
create_package_chistic {}
|
||||
| create_package_chistics create_package_chistic { }
|
||||
package_implementation_declare_section:
|
||||
package_implementation_declare_section_list
|
||||
{
|
||||
/*
|
||||
Add a jump "end of declarations -> start of exceptions"
|
||||
(over the executable sectition).
|
||||
*/
|
||||
if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
opt_create_package_chistics:
|
||||
_empty
|
||||
| create_package_chistics { }
|
||||
;
|
||||
|
||||
opt_create_package_chistics_init:
|
||||
{ Lex->sp_chistics.init(); }
|
||||
opt_create_package_chistics
|
||||
;
|
||||
|
||||
|
||||
package_implementation_executable_section:
|
||||
END
|
||||
{
|
||||
/*
|
||||
Backpatch the jump generated in
|
||||
package_implementation_declare_section
|
||||
and generate a backward jump:
|
||||
"end of exceptions -> start of the executable section".
|
||||
*/
|
||||
if (unlikely(Lex->sp_block_with_exceptions_add_empty(thd)))
|
||||
MYSQL_YYABORT;
|
||||
$$.init(0);
|
||||
|
@ -19144,17 +19234,8 @@ package_implementation_executable_section:
|
|||
| BEGIN_ORACLE_SYM sp_block_statements_and_exceptions END { $$= $2; }
|
||||
;
|
||||
|
||||
%endif ORACLE
|
||||
|
||||
// Inside CREATE PACKAGE BODY, package-wide items (e.g. variables)
|
||||
// must be declared before routine definitions.
|
||||
|
||||
package_implementation_declare_section:
|
||||
package_implementation_declare_section_list1
|
||||
| package_implementation_declare_section_list2
|
||||
| package_implementation_declare_section_list1
|
||||
package_implementation_declare_section_list2
|
||||
{ $$.join($1, $2); }
|
||||
;
|
||||
|
||||
package_implementation_declare_section_list1:
|
||||
package_implementation_item_declaration
|
||||
|
@ -19170,65 +19251,43 @@ package_implementation_declare_section_list2:
|
|||
{ $$.join($1, $2); }
|
||||
;
|
||||
|
||||
package_routine_lex:
|
||||
{
|
||||
if (unlikely(!($$= new (thd->mem_root)
|
||||
sp_lex_local(thd, thd->lex))))
|
||||
MYSQL_YYABORT;
|
||||
thd->m_parser_state->m_yacc.reset_before_substatement();
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
package_specification_function:
|
||||
remember_lex package_routine_lex ident
|
||||
remember_lex ident
|
||||
{
|
||||
DBUG_ASSERT($1->sphead->get_package());
|
||||
$2->sql_command= SQLCOM_CREATE_FUNCTION;
|
||||
sp_name *spname= $1->make_sp_name_package_routine(thd, $3);
|
||||
if (unlikely(!spname))
|
||||
LEX *lex= thd->lex->package_routine_start(thd,
|
||||
&sp_handler_package_function, $2);
|
||||
if (!lex)
|
||||
MYSQL_YYABORT;
|
||||
thd->lex= $2;
|
||||
if (unlikely(!$2->make_sp_head_no_recursive(thd, spname,
|
||||
&sp_handler_package_function,
|
||||
NOT_AGGREGATE)))
|
||||
MYSQL_YYABORT;
|
||||
$1->sphead->get_package()->m_current_routine= $2;
|
||||
(void) is_native_function_with_warn(thd, &$3);
|
||||
thd->lex= lex;
|
||||
}
|
||||
opt_sp_parenthesized_fdparam_list
|
||||
RETURN_ORACLE_SYM sf_return_type
|
||||
sf_parameters
|
||||
sf_returned_type_clause
|
||||
sp_c_chistics
|
||||
{
|
||||
$$= thd->lex;
|
||||
sp_head *sp= thd->lex->sphead;
|
||||
sp->restore_thd_mem_root(thd);
|
||||
thd->lex= $1;
|
||||
$$= $2;
|
||||
}
|
||||
;
|
||||
|
||||
package_specification_procedure:
|
||||
remember_lex package_routine_lex ident
|
||||
remember_lex ident
|
||||
{
|
||||
DBUG_ASSERT($1->sphead->get_package());
|
||||
$2->sql_command= SQLCOM_CREATE_PROCEDURE;
|
||||
sp_name *spname= $1->make_sp_name_package_routine(thd, $3);
|
||||
if (unlikely(!spname))
|
||||
LEX *lex= thd->lex->package_routine_start(thd,
|
||||
&sp_handler_package_procedure, $2);
|
||||
if (!lex)
|
||||
MYSQL_YYABORT;
|
||||
thd->lex= $2;
|
||||
if (unlikely(!$2->make_sp_head_no_recursive(thd, spname,
|
||||
&sp_handler_package_procedure,
|
||||
DEFAULT_AGGREGATE)))
|
||||
MYSQL_YYABORT;
|
||||
$1->sphead->get_package()->m_current_routine= $2;
|
||||
thd->lex= lex;
|
||||
}
|
||||
opt_sp_parenthesized_pdparam_list
|
||||
sp_parameters
|
||||
sp_c_chistics
|
||||
{
|
||||
$$= thd->lex;
|
||||
sp_head *sp= thd->lex->sphead;
|
||||
sp->restore_thd_mem_root(thd);
|
||||
thd->lex= $1;
|
||||
$$= $2;
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -19266,7 +19325,7 @@ package_implementation_function_body:
|
|||
sp->set_c_chistics(thd->lex->sp_chistics);
|
||||
sp->set_body_start(thd, YYLIP->get_cpp_tok_start());
|
||||
}
|
||||
sp_body opt_package_routine_end_name
|
||||
sp_package_function_body opt_package_routine_end_name
|
||||
{
|
||||
if (unlikely(thd->lex->sp_body_finalize_function(thd) ||
|
||||
thd->lex->sphead->check_package_routine_end_name($5)))
|
||||
|
@ -19285,7 +19344,7 @@ package_implementation_procedure_body:
|
|||
sp->set_c_chistics(thd->lex->sp_chistics);
|
||||
sp->set_body_start(thd, YYLIP->get_cpp_tok_start());
|
||||
}
|
||||
sp_body opt_package_routine_end_name
|
||||
sp_package_procedure_body opt_package_routine_end_name
|
||||
{
|
||||
if (unlikely(thd->lex->sp_body_finalize_procedure(thd) ||
|
||||
thd->lex->sphead->check_package_routine_end_name($5)))
|
||||
|
@ -19295,10 +19354,6 @@ package_implementation_procedure_body:
|
|||
;
|
||||
|
||||
|
||||
package_implementation_item_declaration:
|
||||
sp_decl_variable_list ';'
|
||||
;
|
||||
|
||||
opt_package_specification_element_list:
|
||||
_empty
|
||||
| package_specification_element_list
|
||||
|
@ -19326,6 +19381,9 @@ package_specification_element:
|
|||
}
|
||||
;
|
||||
|
||||
|
||||
%ifdef ORACLE
|
||||
|
||||
sp_decl_variable_list_anchored:
|
||||
sp_decl_idents_init_vars
|
||||
optionally_qualified_column_ident PERCENT_ORACLE_SYM TYPE_SYM
|
||||
|
@ -19423,13 +19481,15 @@ sp_tail_standalone:
|
|||
}
|
||||
sp_tail_is
|
||||
sp_body
|
||||
opt_sp_name
|
||||
opt_trailing_sp_name
|
||||
{
|
||||
if (unlikely(Lex->sp_body_finalize_procedure_standalone(thd, $8)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
%endif ORACLE
|
||||
|
||||
|
||||
create_routine:
|
||||
create_or_replace definer_opt PROCEDURE_SYM opt_if_not_exists
|
||||
|
@ -19447,12 +19507,12 @@ create_routine:
|
|||
if (Lex->stmt_create_stored_function_start($1 | $5, $3, $6))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
opt_sp_parenthesized_fdparam_list
|
||||
RETURN_ORACLE_SYM sf_return_type
|
||||
sf_parameters
|
||||
sf_returned_type_clause
|
||||
sf_c_chistics_and_body_standalone
|
||||
opt_sp_name
|
||||
opt_trailing_sp_name
|
||||
{
|
||||
if (Lex->stmt_create_stored_function_finalize_standalone($12))
|
||||
if (Lex->stmt_create_stored_function_finalize_standalone($11))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| create_or_replace no_definer opt_aggregate FUNCTION_SYM opt_if_not_exists
|
||||
|
@ -19461,12 +19521,12 @@ create_routine:
|
|||
if (Lex->stmt_create_stored_function_start($1 | $5, $3, $6))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
opt_sp_parenthesized_fdparam_list
|
||||
RETURN_ORACLE_SYM sf_return_type
|
||||
sf_parameters
|
||||
sf_returned_type_clause
|
||||
sf_c_chistics_and_body_standalone
|
||||
opt_sp_name
|
||||
opt_trailing_sp_name
|
||||
{
|
||||
if (Lex->stmt_create_stored_function_finalize_standalone($12))
|
||||
if (Lex->stmt_create_stored_function_finalize_standalone($11))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| create_or_replace no_definer opt_aggregate FUNCTION_SYM opt_if_not_exists
|
||||
|
@ -19476,59 +19536,54 @@ create_routine:
|
|||
(Item_result) $8, $10))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| create_or_replace definer_opt PACKAGE_ORACLE_SYM
|
||||
| create_or_replace definer_opt sp_handler_package_spec
|
||||
opt_if_not_exists sp_name opt_create_package_chistics_init
|
||||
{
|
||||
sp_package *pkg;
|
||||
if (unlikely(!(pkg= Lex->
|
||||
create_package_start(thd,
|
||||
SQLCOM_CREATE_PACKAGE,
|
||||
&sp_handler_package_spec,
|
||||
$5, $1 | $4))))
|
||||
create_package_start(thd, &sp_handler_package_spec,
|
||||
$5, $1 | $4,
|
||||
Lex->sp_chistics))))
|
||||
MYSQL_YYABORT;
|
||||
pkg->set_c_chistics(Lex->sp_chistics);
|
||||
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
|
||||
}
|
||||
sp_tail_is
|
||||
opt_package_specification_element_list END
|
||||
remember_end_opt opt_sp_name
|
||||
remember_end_opt opt_trailing_sp_name
|
||||
{
|
||||
if (unlikely(Lex->create_package_finalize(thd, $5, $12, $11)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| create_or_replace definer_opt PACKAGE_ORACLE_SYM BODY_ORACLE_SYM
|
||||
| create_or_replace definer_opt sp_handler_package_body
|
||||
opt_if_not_exists sp_name opt_create_package_chistics_init
|
||||
{
|
||||
sp_package *pkg;
|
||||
if (unlikely(!(pkg= Lex->
|
||||
create_package_start(thd,
|
||||
SQLCOM_CREATE_PACKAGE_BODY,
|
||||
&sp_handler_package_body,
|
||||
$6, $1 | $5))))
|
||||
create_package_start(thd, &sp_handler_package_body,
|
||||
$5, $1 | $4,
|
||||
Lex->sp_chistics))))
|
||||
MYSQL_YYABORT;
|
||||
pkg->set_c_chistics(Lex->sp_chistics);
|
||||
Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
|
||||
Lex->sp_block_init(thd);
|
||||
}
|
||||
sp_tail_is
|
||||
package_implementation_declare_section
|
||||
{
|
||||
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
package_implementation_executable_section
|
||||
{
|
||||
$10.hndlrs+= $12.hndlrs;
|
||||
if (unlikely(Lex->sp_block_finalize(thd, $10)))
|
||||
$9.hndlrs+= $10.hndlrs;
|
||||
if (unlikely(Lex->sp_block_finalize(thd, $9)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
remember_end_opt opt_sp_name
|
||||
remember_end_opt opt_trailing_sp_name
|
||||
{
|
||||
if (unlikely(Lex->create_package_finalize(thd, $6, $15, $14)))
|
||||
if (unlikely(Lex->create_package_finalize(thd, $5, $13, $12)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
%ifdef ORACLE
|
||||
|
||||
opt_sp_decl_body_list:
|
||||
_empty
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue