Tables and views
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@494 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
bc7dbabdbd
commit
36950ebe82
|
@ -9,7 +9,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.8.1-dev"; ?></title>
|
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.9.0-dev"; ?></title>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||||
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
||||||
</head>
|
</head>
|
||||||
|
@ -99,8 +99,8 @@ function page_footer($missing = false) {
|
||||||
} else {
|
} else {
|
||||||
echo "<p>\n";
|
echo "<p>\n";
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '" title="' . ($row["Engine"] == "MyISAM" ? lang('%d row(s)', $row["Rows"]) : lang('around %d row(s)', $row["Rows"])) . '">' . lang('select') . '</a> ';
|
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
|
||||||
echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Engine"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '" title="' . (isset($row["Engine"]) ? htmlspecialchars($row["Engine"]) : lang('View')) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
|
echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
|
||||||
}
|
}
|
||||||
echo "</p>\n";
|
echo "</p>\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ function queries($query = null) {
|
||||||
global $mysql;
|
global $mysql;
|
||||||
static $queries = array();
|
static $queries = array();
|
||||||
if (!isset($query)) {
|
if (!isset($query)) {
|
||||||
return implode("\n", $queries);
|
return implode(";\n", $queries);
|
||||||
}
|
}
|
||||||
$queries[] = $query;
|
$queries[] = $query;
|
||||||
return $mysql->query($query);
|
return $mysql->query($query);
|
||||||
|
|
42
index.php
42
index.php
|
@ -118,10 +118,49 @@ if (isset($_GET["download"])) {
|
||||||
} elseif (isset($_GET["select"])) {
|
} elseif (isset($_GET["select"])) {
|
||||||
include "./select.inc.php";
|
include "./select.inc.php";
|
||||||
} else {
|
} else {
|
||||||
unset($_SESSION["tokens"][$_GET["server"]][$_SERVER["REQUEST_URI"]]);
|
if ($_POST["tables"] && !$error) {
|
||||||
|
$result = true;
|
||||||
|
$message = "";
|
||||||
|
if (isset($_POST["truncate"])) {
|
||||||
|
foreach ($_POST["tables"] as $table) {
|
||||||
|
if (!queries("TRUNCATE " . idf_escape($table))) {
|
||||||
|
$result = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$message = lang('Tables have been truncated.');
|
||||||
|
} else {
|
||||||
|
$result = queries((isset($_POST["optimize"]) ? "OPTIMIZE" : (isset($_POST["check"]) ? "CHECK" : (isset($_POST["repair"]) ? "REPAIR" : (isset($_POST["drop"]) ? "DROP" : "ANALYZE")))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])));
|
||||||
|
if ($result) {
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$message .= htmlspecialchars("$row[Table]: $row[Msg_text]") . "<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
query_redirect(queries(), substr($SELF, 0, -1), $message, $result, false, !$result);
|
||||||
|
}
|
||||||
|
|
||||||
page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
|
page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'schema=">' . lang('Database schema') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'schema=">' . lang('Database schema') . "</a></p>\n";
|
||||||
|
|
||||||
|
echo "<h3>" . lang('Tables and views') . "</h3>\n";
|
||||||
|
$result = $mysql->query("SHOW TABLE STATUS");
|
||||||
|
if (!$result->num_rows) {
|
||||||
|
echo "<p class='message'>" . lang('No tables.') . "</p>\n";
|
||||||
|
} else {
|
||||||
|
echo "<form action='' method='post'>\n";
|
||||||
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
||||||
|
echo '<thead><tr><th>' . lang('Table') . '</th><td><label><input type="checkbox" onclick="var elems = this.form.elements; for (var i=0; elems.length > i; i++) if (elems[i].name == \'tables[]\') elems[i].checked = this.checked;" /> Engine</label></td><td>' . lang('Data Length') . "</td><td>" . lang('Index Length') . "</td><td>" . lang('Data Free') . "</td><td>" . lang('Collation') . "</td><td>" . lang('Auto Increment') . "</td><td>Rows</td></tr></tdead>\n";
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
echo '<tr><th><a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th>" . (isset($row["Rows"]) ? '<td><label><input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '" /> ' . $row["Engine"] . "</label></td><td>$row[Data_length]</td><td>$row[Index_length]</td><td>$row[Data_free]</td><td>$row[Collation]</td><td>$row[Auto_increment]</td><td>" . $mysql->result($mysql->query("SELECT COUNT(*) FROM " . idf_escape($row["Name"]))) : '<td colspan="7">' . lang('View')) . "</td></tr>\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?') . "');\" /> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /></p>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
}
|
||||||
|
$result->free();
|
||||||
|
|
||||||
if ($mysql->server_info >= 5) {
|
if ($mysql->server_info >= 5) {
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
|
||||||
echo "<h3>" . lang('Routines') . "</h3>\n";
|
echo "<h3>" . lang('Routines') . "</h3>\n";
|
||||||
|
@ -140,6 +179,7 @@ if (isset($_GET["download"])) {
|
||||||
$result->free();
|
$result->free();
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mysql->server_info >= 5.1) {
|
if ($mysql->server_info >= 5.1) {
|
||||||
echo "<h3>" . lang('Events') . "</h3>\n";
|
echo "<h3>" . lang('Events') . "</h3>\n";
|
||||||
$result = $mysql->query("SHOW EVENTS");
|
$result = $mysql->query("SHOW EVENTS");
|
||||||
|
|
|
@ -136,7 +136,6 @@ $translations = array(
|
||||||
'Event' => 'Událost',
|
'Event' => 'Událost',
|
||||||
'MySQL version: %s through PHP extension %s' => 'Verze MySQL: %s přes PHP extenzi %s',
|
'MySQL version: %s through PHP extension %s' => 'Verze MySQL: %s přes PHP extenzi %s',
|
||||||
'%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
|
'%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
|
||||||
'around %d row(s)' => array('přibližně %d řádek', 'přibližně %d řádky', 'přibližně %d řádků'),
|
|
||||||
'ON UPDATE CURRENT_TIMESTAMP' => 'Při změně aktuální čas',
|
'ON UPDATE CURRENT_TIMESTAMP' => 'Při změně aktuální čas',
|
||||||
'Remove' => 'Odebrat',
|
'Remove' => 'Odebrat',
|
||||||
'Are you sure?' => 'Opravdu?',
|
'Are you sure?' => 'Opravdu?',
|
||||||
|
@ -187,4 +186,15 @@ $translations = array(
|
||||||
'End' => 'Konec',
|
'End' => 'Konec',
|
||||||
'Status' => 'Stav',
|
'Status' => 'Stav',
|
||||||
'On completion preserve' => 'Po dokončení zachovat',
|
'On completion preserve' => 'Po dokončení zachovat',
|
||||||
|
'Tables and views' => 'Tabulky a pohledy',
|
||||||
|
'Data Length' => 'Velikost dat',
|
||||||
|
'Index Length' => 'Velikost indexů',
|
||||||
|
'Data Free' => 'Volné místo',
|
||||||
|
'Collation' => 'Porovnávání',
|
||||||
|
'Analyze' => 'Analyzovat',
|
||||||
|
'Optimize' => 'Optimalizovat',
|
||||||
|
'Check' => 'Zkontrolovat',
|
||||||
|
'Repair' => 'Opravit',
|
||||||
|
'Truncate' => 'Promazat',
|
||||||
|
'Tables have been truncated.' => 'Tabulky byly promazány.',
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,5 @@ $translations = array(
|
||||||
'Routine has been called, %d row(s) affected.' => array('Routine has been called, %d row affected.', 'Routine has been called, %d rows affected.'),
|
'Routine has been called, %d row(s) affected.' => array('Routine has been called, %d row affected.', 'Routine has been called, %d rows affected.'),
|
||||||
'%d process(es) has been killed.' => array('%d process has been killed.', '%d processes have been killed.'),
|
'%d process(es) has been killed.' => array('%d process has been killed.', '%d processes have been killed.'),
|
||||||
'%d row(s)' => array('%d row', '%d rows'),
|
'%d row(s)' => array('%d row', '%d rows'),
|
||||||
'around %d row(s)' => array('around %d row', 'around %d rows'),
|
|
||||||
'%d item(s) have been deleted.' => array('%d item has been deleted.', '%d items have been deleted.'),
|
'%d item(s) have been deleted.' => array('%d item has been deleted.', '%d items have been deleted.'),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue