]> git.joonet.de Git - adminer.git/commitdiff
Vacuum for PostgreSQL
authorJakub Vrana <jakub@vrana.cz>
Thu, 1 Mar 2012 09:14:55 +0000 (01:14 -0800)
committerJakub Vrana <jakub@vrana.cz>
Thu, 1 Mar 2012 09:14:55 +0000 (01:14 -0800)
adminer/db.inc.php
changes.txt

index 76223f4ac79b0524b1230eea35d814e206348c8e..0ff7bce4ab1a7da109ea23eff1d20da86bb84d9d 100644 (file)
@@ -26,8 +26,11 @@ if ($tables_views && !$error && !$_POST["search"]) {
                        $result = drop_tables($_POST["tables"]);
                }
                $message = lang('Tables have been dropped.');
-       } elseif ($jush == "sqlite") {
-               $result = queries("VACUUM");
+       } elseif ($jush != "sql") {
+               $result = ($jush == "sqlite"
+                       ? queries("VACUUM")
+                       : apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"])
+               );
                $message = lang('Tables have been optimized.');
        } elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) {
                while ($row = $result->fetch_assoc()) {
@@ -94,7 +97,7 @@ if ($adminer->homepage()) {
                        echo "</table>\n";
                        echo "<script type='text/javascript'>tableCheck();</script>\n";
                        if (!information_schema(DB)) {
-                               echo "<p>" . (ereg('^(sql|sqlite)$', $jush)
+                               echo "<p>" . (ereg('^(sql|sqlite|pgsql)$', $jush)
                                        ? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "")
                                        . "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : ""
                                ) . ($jush == "sql" ? "<input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
index 35cb4732407291f9d8c44000351554c5280d95d5..38e2b09e152f6b1245627e86c18014ef173d2ccb 100644 (file)
@@ -11,7 +11,7 @@ Don't quote bit type in export
 Ability to disable export (customization)
 Extensible list of databases (customization)
 MySQL: set autocommit after connect
-SQLite: vacuum
+SQLite, PostgreSQL: vacuum
 PostgreSQL: fix alter foreign key
 PostgreSQL, SQLite: don't use LIKE for numbers (bug #3420408)
 PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619)