mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 19:44:00 +02:00
Use ALTER VIEW and don't use temporary object if changing name
This commit is contained in:
@@ -4,19 +4,28 @@ $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
|
||||
);
|
||||
$location = ME . "table=" . urlencode($name);
|
||||
$message = lang('View has been altered.');
|
||||
|
||||
if (!$_POST["drop"] && $TABLE == $name && $jush != "sqlite") {
|
||||
query_redirect(($jush == "mssql" ? "ALTER" : "CREATE OR REPLACE") . " VIEW " . table($name) . $as, $location, $message);
|
||||
} else {
|
||||
$temp_name = $name . "_adminer_" . uniqid();
|
||||
drop_create(
|
||||
"DROP VIEW " . table($TABLE),
|
||||
"CREATE VIEW " . table($name) . $as,
|
||||
"DROP VIEW " . table($name),
|
||||
"CREATE VIEW " . table($temp_name) . $as,
|
||||
"DROP VIEW " . table($temp_name),
|
||||
($_POST["drop"] ? substr(ME, 0, -1) : $location),
|
||||
lang('View has been dropped.'),
|
||||
$message,
|
||||
lang('View has been created.'),
|
||||
$TABLE,
|
||||
$name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
|
||||
|
Reference in New Issue
Block a user