mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
PostgreSQL: Export functions
This commit is contained in:
@@ -53,12 +53,12 @@ SET foreign_key_checks = 0;
|
|||||||
$out = "";
|
$out = "";
|
||||||
|
|
||||||
if ($_POST["routines"]) {
|
if ($_POST["routines"]) {
|
||||||
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
|
foreach (routines() as $row) {
|
||||||
foreach (get_rows("SHOW $routine STATUS WHERE Db = " . q($db), null, "-- ") as $row) {
|
$name = $row["ROUTINE_NAME"];
|
||||||
$create = remove_definer($connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2));
|
$routine = $row["ROUTINE_TYPE"];
|
||||||
set_utf8mb4($create);
|
$create = create_routine($routine, array("name" => $name) + routine($row["SPECIFIC_NAME"], $routine));
|
||||||
$out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n";
|
set_utf8mb4($create);
|
||||||
}
|
$out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($name) . ";;\n" : "") . "$create;\n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,9 +70,7 @@ SET foreign_key_checks = 0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($out) {
|
echo ($out && $jush == 'sql' ? "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n" : $out);
|
||||||
echo "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["table_style"] || $_POST["data_style"]) {
|
if ($_POST["table_style"] || $_POST["data_style"]) {
|
||||||
|
@@ -521,13 +521,13 @@ function create_routine($routine, $row) {
|
|||||||
$set[] = (preg_match("~^($inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
|
$set[] = (preg_match("~^($inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$definition = rtrim("\n$row[definition]", ";");
|
$definition = rtrim($row["definition"], ";");
|
||||||
return "CREATE $routine "
|
return "CREATE $routine "
|
||||||
. idf_escape(trim($row["name"]))
|
. idf_escape(trim($row["name"]))
|
||||||
. " (" . implode(", ", $set) . ")"
|
. " (" . implode(", ", $set) . ")"
|
||||||
. (isset($_GET["function"]) ? " RETURNS" . process_type($row["returns"], "CHARACTER SET") : "")
|
. ($routine == "FUNCTION" ? " RETURNS" . process_type($row["returns"], "CHARACTER SET") : "")
|
||||||
. ($row["language"] ? " LANGUAGE $row[language]" : "")
|
. ($row["language"] ? " LANGUAGE $row[language]" : "")
|
||||||
. ($jush == "pgsql" ? " AS " . q($definition) : "$definition;")
|
. ($jush == "pgsql" ? " AS " . q($definition) : "\n$definition;")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ MySQL: Show comments at routine call (bug #874)
|
|||||||
MySQL: Don't offer empty enum value in edit
|
MySQL: Don't offer empty enum value in edit
|
||||||
PostgreSQL: Link user defined types
|
PostgreSQL: Link user defined types
|
||||||
PostgreSQL: Constraint enum values in editing (bug #270)
|
PostgreSQL: Constraint enum values in editing (bug #270)
|
||||||
|
PostgreSQL: Export functions
|
||||||
SQLite: Show all supported pragmas in Variables
|
SQLite: Show all supported pragmas in Variables
|
||||||
MS SQL: Allow altering table in non-default schema (bug #405)
|
MS SQL: Allow altering table in non-default schema (bug #405)
|
||||||
MS SQL: Fix default values (bug #732, bug #733)
|
MS SQL: Fix default values (bug #732, bug #733)
|
||||||
|
Reference in New Issue
Block a user