From 583eb96c2492adb87e88a014b24eb0724fb00257 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 18 Aug 2017 23:36:42 +0400 Subject: MDEV-11952 Oracle-style packages: stage#5 - CREATE PACKAGE [BODY] statements are now entirely written to mysql.proc with type='PACKAGE' and type='PACKAGE BODY'. - CREATE PACKAGE BODY now supports IF NOT EXISTS - DROP PACKAGE BODY now supports IF EXISTS - CREATE OR REPLACE PACKAGE [BODY] is now supported - CREATE PACKAGE [BODY] now support the DEFINER clause: CREATE DEFINER user@host PACKAGE pkg ... END; CREATE DEFINER user@host PACKAGE BODY pkg ... END; - CREATE PACKAGE [BODY] now supports SQL SECURITY and COMMENT clauses, e.g.: CREATE PACKAGE p1 SQL SECURITY INVOKER COMMENT "comment" AS ... END; - Package routines are now created from the package CREATE PACKAGE BODY statement and don't produce individual records in mysql.proc. - CREATE PACKAGE BODY now supports package-wide variables. Package variables can be read and set inside package routines. Package variables are stored in a separate sp_rcontext, which is cached in THD on the first packate routine call. - CREATE PACKAGE BODY now supports the initialization section. - All public routines (i.e. declared in CREATE PACKAGE) must have implementations in CREATE PACKAGE BODY - Only public package routines are available outside of the package - {CREATE|DROP} PACKAGE [BODY] now respects CREATE ROUTINE and ALTER ROUTINE privileges - "GRANT EXECUTE ON PACKAGE BODY pkg" is now supported - SHOW CREATE PACKAGE [BODY] is now supported - SHOW PACKAGE [BODY] STATUS is now supported - CREATE and DROP for PACKAGE [BODY] now works for non-current databases - mysqldump now supports packages - "SHOW {PROCEDURE|FUNCTION) CODE pkg.routine" now works for package routines - "SHOW PACKAGE BODY CODE pkg" now works (the package initialization section) - A new package body level MDL was added - Recursive calls for package procedures are now possible - Routine forward declarations in CREATE PACKATE BODY are now supported. - Package body variables now work as SP OUT parameters - Package body variables now work as SELECT INTO targets - Package body variables now support ROW, %ROWTYPE, %TYPE --- sql/sql_cmd.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sql/sql_cmd.h') diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index d95b1c828b9..1c4c89eb132 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -99,6 +99,15 @@ enum enum_sql_command { SQLCOM_CREATE_SEQUENCE, SQLCOM_DROP_SEQUENCE, SQLCOM_ALTER_SEQUENCE, + SQLCOM_CREATE_PACKAGE, + SQLCOM_DROP_PACKAGE, + SQLCOM_CREATE_PACKAGE_BODY, + SQLCOM_DROP_PACKAGE_BODY, + SQLCOM_SHOW_CREATE_PACKAGE, + SQLCOM_SHOW_CREATE_PACKAGE_BODY, + SQLCOM_SHOW_STATUS_PACKAGE, + SQLCOM_SHOW_STATUS_PACKAGE_BODY, + SQLCOM_SHOW_PACKAGE_BODY_CODE, /* When a command is added here, be sure it's also added in mysqld.cc @@ -175,8 +184,10 @@ class Sql_cmd_call : public Sql_cmd { public: class sp_name *m_name; - Sql_cmd_call(class sp_name *name) - :m_name(name) + const class Sp_handler *m_handler; + Sql_cmd_call(class sp_name *name, const class Sp_handler *handler) + :m_name(name), + m_handler(handler) {} virtual ~Sql_cmd_call() -- cgit v1.2.1