Print sums in tables overview

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1299 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2010-01-28 14:29:10 +00:00
parent ce49880a29
commit 4df6accd7b
4 changed files with 12 additions and 1 deletions

View file

@ -48,7 +48,8 @@ if (!$table_status) {
} else { } else {
echo "<form action='' method='post'>\n"; echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n"; echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);" title="' . count($table_status) . '"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n"; echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n";
$sums = array();
foreach ($table_status as $row) { foreach ($table_status as $row) {
$name = $row["Name"]; $name = $row["Name"];
echo '<tr' . odd() . '><td>' . checkbox((isset($row["Rows"]) ? "tables[]" : "views[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');"); echo '<tr' . odd() . '><td>' . checkbox((isset($row["Rows"]) ? "tables[]" : "views[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
@ -58,6 +59,7 @@ if (!$table_status) {
foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") as $key => $link) { foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") as $key => $link) {
$val = number_format($row[$key], 0, '.', lang(',')); $val = number_format($row[$key], 0, '.', lang(','));
echo '<td align="right">' . ($row[$key] != "" ? '<a href="' . h(ME . "$link=") . urlencode($name) . '">' . str_replace(" ", "&nbsp;", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : '&nbsp;'); echo '<td align="right">' . ($row[$key] != "" ? '<a href="' . h(ME . "$link=") . urlencode($name) . '">' . str_replace(" ", "&nbsp;", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : '&nbsp;');
$sums[$link] += ($row["Engine"] != "InnoDB" || $link != "edit" ? $row[$key] : 0);
} }
echo "<td>" . nbsp($row["Comment"]); echo "<td>" . nbsp($row["Comment"]);
} else { } else {
@ -66,6 +68,12 @@ if (!$table_status) {
echo '<td>&nbsp;'; echo '<td>&nbsp;';
} }
} }
echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($table_status));
echo "<td>" . $connection->result($connection->query("SELECT @@storage_engine"));
echo "<td>" . db_collation(DB, collations());
foreach (array("create", "indexes", "edit") as $val) {
echo "<td align='right'>" . number_format($sums[$val], 0, '.', lang(','));
}
echo "</table>\n"; echo "</table>\n";
echo "<p><input type='hidden' name='token' value='$token'><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') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n"; echo "<p><input type='hidden' name='token' value='$token'><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') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n";
$dbs = get_databases(); $dbs = get_databases();

View file

@ -227,4 +227,5 @@ $translations = array(
'Webserver file %s' => 'Soubor %s na webovém serveru', 'Webserver file %s' => 'Soubor %s na webovém serveru',
'File does not exist.' => 'Soubor neexistuje.', 'File does not exist.' => 'Soubor neexistuje.',
'Permanent login' => 'Trvalé přihlášení', 'Permanent login' => 'Trvalé přihlášení',
'%d in total' => '%d celkem',
); );

View file

@ -1,6 +1,7 @@
Adminer 2.3.0-dev: Adminer 2.3.0-dev:
Support for permanent login (customization required) Support for permanent login (customization required)
Show status variables Show status variables
Print sums in tables overview
Add Delete button to Edit page (regression from 2.0.0) Add Delete button to Edit page (regression from 2.0.0)
Simplify SQL syntax error message Simplify SQL syntax error message
Show SQL query info if available Show SQL query info if available

View file

@ -8,6 +8,7 @@ Offer enum and set items in search - whisperer
Variables editation, especially timezone Variables editation, especially timezone
Use event $intervals + microseconds in relative date functions Use event $intervals + microseconds in relative date functions
Optionally check IP address Optionally check IP address
Disable spell checking in SQL textareas - spellcheck="false"
? Column and table names auto-completition in SQL textarea ? Column and table names auto-completition in SQL textarea
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, JS packer can save 1 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB ? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, JS packer can save 1 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB
? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB ? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB