summaryrefslogtreecommitdiff
path: root/client/mysqldump.c
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-08-18 23:36:42 +0400
committerAlexander Barkov <bar@mariadb.org>2018-02-25 21:08:19 +0400
commit583eb96c2492adb87e88a014b24eb0724fb00257 (patch)
tree501cb4e5e3855400e79df8911ac43ef1f89300b3 /client/mysqldump.c
parent83ea839fb15dd5ed616d2b3152ccc5472ee5e5e6 (diff)
downloadmariadb-git-bb-10.3-compatibility.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 'client/mysqldump.c')
-rw-r--r--client/mysqldump.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2c55fc381b1..9ea19855f0b 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2482,7 +2482,14 @@ static void print_blob_as_hex(FILE *output_file, const char *str, ulong len)
static uint dump_routines_for_db(char *db)
{
char query_buff[QUERY_LENGTH];
- const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
+ const char *routine_type[]= {"FUNCTION",
+ "PROCEDURE",
+ "PACKAGE",
+ "PACKAGE BODY"};
+ const char *create_caption_xml[]= {"Create Function",
+ "Create Procedure",
+ "Create Package",
+ "Create Package Body"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
int i;
@@ -2520,8 +2527,8 @@ static uint dump_routines_for_db(char *db)
if (opt_xml)
fputs("\t<routines>\n", sql_file);
- /* 0, retrieve and dump functions, 1, procedures */
- for (i= 0; i <= 1; i++)
+ /* 0, retrieve and dump functions, 1, procedures, etc. */
+ for (i= 0; i < 4; i++)
{
my_snprintf(query_buff, sizeof(query_buff),
"SHOW %s STATUS WHERE Db = '%s'",
@@ -2571,12 +2578,8 @@ static uint dump_routines_for_db(char *db)
{
if (opt_xml)
{
- if (i) /* Procedures. */
- print_xml_row(sql_file, "routine", routine_res, &row,
- "Create Procedure");
- else /* Functions. */
- print_xml_row(sql_file, "routine", routine_res, &row,
- "Create Function");
+ print_xml_row(sql_file, "routine", routine_res, &row,
+ create_caption_xml[i]);
continue;
}
if (opt_drop)