SQLite: vacuum

This commit is contained in:
Jakub Vrana 2012-02-29 10:49:17 -08:00
parent 27c046f753
commit c6c48553b8
3 changed files with 9 additions and 1 deletions

View file

@ -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 .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>";
@ -91,7 +94,10 @@ if ($adminer->homepage()) {
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
if (!information_schema(DB)) {
echo "<p>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <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
echo "<p>" . (ereg('^(sql|sqlite)$', $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
$databases = (support("scheme") ? schemas() : $adminer->databases());
if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));

View file

@ -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',

View file

@ -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)