From c6c48553b888c5fa4d20ecf5f98e98aed68496ce Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 29 Feb 2012 10:49:17 -0800 Subject: [PATCH] SQLite: vacuum --- adminer/db.inc.php | 8 +++++++- adminer/lang/cs.inc.php | 1 + changes.txt | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 24c587f4..76223f4a 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -26,6 +26,9 @@ if ($tables_views && !$error && !$_POST["search"]) { $result = drop_tables($_POST["tables"]); } $message = lang('Tables have been dropped.'); + } elseif ($jush == "sqlite") { + $result = queries("VACUUM"); + $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()) { $message .= "" . h($row["Table"]) . ": " . h($row["Msg_text"]) . "
"; @@ -91,7 +94,10 @@ if ($adminer->homepage()) { echo "\n"; echo "\n"; if (!information_schema(DB)) { - echo "

" . ($jush == "sql" ? " " : "") . " \n"; // 1 - eventStop + echo "

" . (ereg('^(sql|sqlite)$', $jush) + ? ($jush != "sqlite" ? " " : "") + . " " : "" + ) . ($jush == "sql" ? " " : "") . " \n"; // 1 - eventStop $databases = (support("scheme") ? schemas() : $adminer->databases()); if (count($databases) != 1 && $jush != "sqlite") { $db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB)); diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 2845fec5..f903913f 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -147,6 +147,7 @@ $translations = array( 'Create new table' => 'Vytvořit novou tabulku', 'Table has been dropped.' => 'Tabulka byla odstraněna.', 'Tables have been dropped.' => 'Tabulky byly odstraněny.', + 'Tables have been optimized.' => 'Tabulky byly optimalizovány.', 'Table has been altered.' => 'Tabulka byla změněna.', 'Table has been created.' => 'Tabulka byla vytvořena.', 'Table name' => 'Název tabulky', diff --git a/changes.txt b/changes.txt index 8c61fb38..35cb4732 100644 --- a/changes.txt +++ b/changes.txt @@ -11,6 +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 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)