1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 17:44:07 +02:00

Driver specific create and drop database

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1480 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2010-04-22 23:02:28 +00:00
parent 0acc0c297b
commit edb6401722
5 changed files with 65 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
restart_session();
if ($_POST["drop"]) {
set_session("databases", null);
query_redirect("DROP DATABASE " . idf_escape(DB), remove_from_uri("db|database"), lang('Database has been dropped.'));
queries_redirect(remove_from_uri("db|database"), lang('Database has been dropped.'), drop_databases(array(DB)));
} elseif (DB !== $_POST["name"]) {
// create or rename database
set_session("databases", null); // clear cache
@@ -15,7 +15,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
$last = "";
foreach ($dbs as $db) {
if (count($dbs) == 1 || $db != "") { // ignore empty lines but always try to create single database
if (!queries("CREATE DATABASE " . idf_escape($db) . ($_POST["collation"] ? " COLLATE " . $connection->quote($_POST["collation"]) : ""))) {
if (!create_database($db, $_POST["collation"])) {
$success = false;
}
$last = $db;
@@ -55,11 +55,15 @@ if ($_POST) {
<form action="" method="post">
<p>
<?php echo ($_POST["add_x"] || strpos($name, "\n")
<?php
echo ($_POST["add_x"] || strpos($name, "\n")
? '<textarea name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
: '<input name="name" value="' . h($name) . '" maxlength="64">'
) . "\n"; ?>
<?php echo html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate); ?>
) . "\n";
if ($collations) {
html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate);
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php