mirror of
https://github.com/vrana/adminer.git
synced 2025-08-13 18:14:07 +02:00
Don't drop original view and routine before creating the new one
This commit is contained in:
@@ -1,26 +1,30 @@
|
||||
<?php
|
||||
$TABLE = $_GET["view"];
|
||||
$row = ($TABLE == "" ? array() : view($TABLE));
|
||||
$row["name"] = $TABLE;
|
||||
$row = $_POST;
|
||||
|
||||
if ($_POST) {
|
||||
if (!$error) {
|
||||
$name = trim($_POST["name"]);
|
||||
drop_create(
|
||||
"DROP VIEW " . table($TABLE),
|
||||
"CREATE VIEW " . table($name) . " AS\n$_POST[select]",
|
||||
"CREATE VIEW " . table($TABLE) . " AS\n$row[select]",
|
||||
($_POST["drop"] ? substr(ME, 0, -1) : ME . "table=" . urlencode($name)),
|
||||
lang('View has been dropped.'),
|
||||
lang('View has been altered.'),
|
||||
lang('View has been created.'),
|
||||
$TABLE
|
||||
);
|
||||
}
|
||||
$row = $_POST;
|
||||
if ($_POST && !$error) {
|
||||
$name = trim($row["name"]);
|
||||
$temp_name = $name . "_adminer_" . uniqid();
|
||||
$as = " AS\n$row[select]";
|
||||
drop_create(
|
||||
"DROP VIEW " . table($TABLE),
|
||||
"CREATE VIEW " . table($name) . $as,
|
||||
"CREATE VIEW " . table($temp_name) . $as,
|
||||
"DROP VIEW " . table($temp_name),
|
||||
($_POST["drop"] ? substr(ME, 0, -1) : ME . "table=" . urlencode($name)),
|
||||
lang('View has been dropped.'),
|
||||
lang('View has been altered.'),
|
||||
lang('View has been created.'),
|
||||
$TABLE
|
||||
);
|
||||
}
|
||||
|
||||
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
|
||||
|
||||
if (!$_POST && $TABLE != "") {
|
||||
$row = view($TABLE);
|
||||
$row["name"] = $TABLE;
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
|
Reference in New Issue
Block a user