diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-08-18 23:36:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-02-25 21:08:19 +0400 |
commit | 583eb96c2492adb87e88a014b24eb0724fb00257 (patch) | |
tree | 501cb4e5e3855400e79df8911ac43ef1f89300b3 /sql/item_create.cc | |
parent | 83ea839fb15dd5ed616d2b3152ccc5472ee5e5e6 (diff) | |
download | mariadb-git-583eb96c2492adb87e88a014b24eb0724fb00257.tar.gz |
MDEV-11952 Oracle-style packages: stage#5mariadb-10.3.5bb-10.3-compatibility
- CREATE PACKAGE [BODY] statements are now
entirely written to mysql.proc with type='PACKAGE' and type='PACKAGE BODY'.
- CREATE PACKAGE BODY now supports IF NOT EXISTS
- DROP PACKAGE BODY now supports IF EXISTS
- CREATE OR REPLACE PACKAGE [BODY] is now supported
- CREATE PACKAGE [BODY] now support the DEFINER clause:
CREATE DEFINER user@host PACKAGE pkg ... END;
CREATE DEFINER user@host PACKAGE BODY pkg ... END;
- CREATE PACKAGE [BODY] now supports SQL SECURITY and COMMENT clauses, e.g.:
CREATE PACKAGE p1 SQL SECURITY INVOKER COMMENT "comment" AS ... END;
- Package routines are now created from the package CREATE PACKAGE BODY
statement and don't produce individual records in mysql.proc.
- CREATE PACKAGE BODY now supports package-wide variables.
Package variables can be read and set inside package routines.
Package variables are stored in a separate sp_rcontext,
which is cached in THD on the first packate routine call.
- CREATE PACKAGE BODY now supports the initialization section.
- All public routines (i.e. declared in CREATE PACKAGE)
must have implementations in CREATE PACKAGE BODY
- Only public package routines are available outside of the package
- {CREATE|DROP} PACKAGE [BODY] now respects CREATE ROUTINE and ALTER ROUTINE
privileges
- "GRANT EXECUTE ON PACKAGE BODY pkg" is now supported
- SHOW CREATE PACKAGE [BODY] is now supported
- SHOW PACKAGE [BODY] STATUS is now supported
- CREATE and DROP for PACKAGE [BODY] now works for non-current databases
- mysqldump now supports packages
- "SHOW {PROCEDURE|FUNCTION) CODE pkg.routine" now works for package routines
- "SHOW PACKAGE BODY CODE pkg" now works (the package initialization section)
- A new package body level MDL was added
- Recursive calls for package procedures are now possible
- Routine forward declarations in CREATE PACKATE BODY are now supported.
- Package body variables now work as SP OUT parameters
- Package body variables now work as SELECT INTO targets
- Package body variables now support ROW, %ROWTYPE, %TYPE
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index 548ce3bac94..385d8de98fc 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -3399,6 +3399,8 @@ Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, Item *func= NULL; LEX *lex= thd->lex; sp_name *qname; + const Sp_handler *sph= &sp_handler_function; + Database_qualified_name pkgname(&null_clex_str, &null_clex_str); if (has_named_parameters(item_list)) { @@ -3419,13 +3421,18 @@ Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, arg_count= item_list->elements; qname= new (thd->mem_root) sp_name(db, name, use_explicit_name); - sp_handler_function.add_used_routine(lex, thd, qname); - + if (sph->sp_resolve_package_routine(thd, thd->lex->sphead, + qname, &sph, &pkgname)) + return NULL; + sph->add_used_routine(lex, thd, qname); + if (pkgname.m_name.length) + sp_handler_package_body.add_used_routine(lex, thd, &pkgname); if (arg_count > 0) - func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), qname, - *item_list); + func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), + qname, sph, *item_list); else - func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), qname); + func= new (thd->mem_root) Item_func_sp(thd, lex->current_context(), + qname, sph); lex->safe_to_cache_query= 0; return func; |