mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -2313,6 +2313,8 @@ static bool check_prepared_statement(Prepared_statement *stmt)
|
||||
case SQLCOM_SHOW_TABLE_STATUS:
|
||||
case SQLCOM_SHOW_STATUS_PROC:
|
||||
case SQLCOM_SHOW_STATUS_FUNC:
|
||||
case SQLCOM_SHOW_STATUS_PACKAGE:
|
||||
case SQLCOM_SHOW_STATUS_PACKAGE_BODY:
|
||||
case SQLCOM_SELECT:
|
||||
res= mysql_test_select(stmt, tables);
|
||||
if (res == 2)
|
||||
@ -2385,6 +2387,21 @@ static bool check_prepared_statement(Prepared_statement *stmt)
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
break;
|
||||
case SQLCOM_SHOW_CREATE_PACKAGE:
|
||||
if ((res= mysql_test_show_create_routine(stmt, &sp_handler_package_spec)) == 2)
|
||||
{
|
||||
/* Statement and field info has already been sent */
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
break;
|
||||
case SQLCOM_SHOW_CREATE_PACKAGE_BODY:
|
||||
if ((res= mysql_test_show_create_routine(stmt,
|
||||
&sp_handler_package_body)) == 2)
|
||||
{
|
||||
/* Statement and field info has already been sent */
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
break;
|
||||
case SQLCOM_CREATE_VIEW:
|
||||
if (lex->create_view->mode == VIEW_ALTER)
|
||||
{
|
||||
@ -2589,6 +2606,8 @@ void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length)
|
||||
|
||||
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_package_spec_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_package_body_cache, stored_program_cache_size);
|
||||
|
||||
/* check_prepared_statemnt sends the metadata packet in case of success */
|
||||
end:
|
||||
@ -3155,6 +3174,8 @@ static void mysql_stmt_execute_common(THD *thd,
|
||||
|
||||
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_package_spec_cache, stored_program_cache_size);
|
||||
sp_cache_enforce_limit(thd->sp_package_body_cache, stored_program_cache_size);
|
||||
|
||||
/* Close connection socket; for use with client testing (Bug#43560). */
|
||||
DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio););
|
||||
|
Reference in New Issue
Block a user