2007-07-02 05:51:26 +00:00
|
|
|
<?php
|
|
|
|
page_header(lang('Table') . ": " . htmlspecialchars($_GET["table"]));
|
|
|
|
|
2007-07-10 13:30:42 +00:00
|
|
|
$result = $mysql->query("SHOW COLUMNS FROM " . idf_escape($_GET["table"]));
|
2007-07-06 13:03:13 +00:00
|
|
|
if (!$result) {
|
2007-07-10 13:30:42 +00:00
|
|
|
echo "<p class='error'>" . lang('Unable to show the table definition') . ": " . $mysql->error . ".</p>\n";
|
2007-07-06 13:03:13 +00:00
|
|
|
} else {
|
2007-07-09 06:12:22 +00:00
|
|
|
$auto_increment_only = true;
|
2007-07-02 05:51:26 +00:00
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
2007-07-10 13:30:42 +00:00
|
|
|
while ($row = $result->fetch_assoc()) {
|
2007-07-09 06:12:22 +00:00
|
|
|
if (!$row["auto_increment"]) {
|
|
|
|
$auto_increment_only = false;
|
|
|
|
}
|
2007-07-06 15:48:57 +00:00
|
|
|
echo "<tr><th>" . htmlspecialchars($row["Field"]) . "</th><td>$row[Type]" . ($row["Null"] == "YES" ? " <i>NULL</i>" : "") . "</td></tr>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2007-07-10 13:30:42 +00:00
|
|
|
$result->free();
|
2007-07-09 06:12:22 +00:00
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
echo '<a href="' . htmlspecialchars($SELF) . 'create=' . urlencode($_GET["table"]) . '">' . lang('Alter table') . '</a>';
|
2007-07-09 14:48:46 +00:00
|
|
|
echo ($auto_increment_only ? '' : ' <a href="' . htmlspecialchars($SELF) . 'default=' . urlencode($_GET["table"]) . '">' . lang('Default values') . '</a>');
|
2007-07-09 06:12:22 +00:00
|
|
|
echo "</p>\n";
|
2007-07-06 13:03:13 +00:00
|
|
|
|
|
|
|
echo "<h3>" . lang('Indexes') . "</h3>\n";
|
|
|
|
$indexes = indexes($_GET["table"]);
|
|
|
|
if ($indexes) {
|
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
|
|
|
foreach ($indexes as $index) {
|
|
|
|
ksort($index["columns"]);
|
|
|
|
echo "<tr><td>$index[type]</td><td><i>" . implode("</i>, <i>", $index["columns"]) . "</i></td></tr>\n";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
}
|
|
|
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'indexes=' . urlencode($_GET["table"]) . '">' . lang('Alter indexes') . "</a></p>\n";
|
|
|
|
|
|
|
|
$foreign_keys = foreign_keys($_GET["table"]);
|
|
|
|
if ($foreign_keys) {
|
|
|
|
echo "<h3>" . lang('Foreign keys') . "</h3>\n";
|
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
|
|
|
foreach ($foreign_keys as $foreign_key) {
|
2007-07-09 06:12:22 +00:00
|
|
|
echo "<tr><td><i>" . implode("</i>, <i>", $foreign_key[2]) . "</i></td><td>" . (strlen($foreign_key[0]) && $foreign_key[0] !== $_GET["db"] ? "<strong>" . htmlspecialchars($foreign_key[0]) . "</strong>." : "") . htmlspecialchars($foreign_key[1]) . "(<em>" . implode("</em>, <em>", $foreign_key[3]) . "</em>)</td></tr>\n";
|
2007-07-06 13:03:13 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2007-07-02 10:24:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-10 13:30:42 +00:00
|
|
|
if ($mysql->server_info >= 5) {
|
|
|
|
$result = $mysql->query("SHOW TRIGGERS LIKE '" . $mysql->real_escape_string($_GET["table"]) . "'");
|
|
|
|
if ($result->num_rows) {
|
2007-07-06 09:55:51 +00:00
|
|
|
echo "<h3>" . lang('Triggers') . "</h3>\n";
|
2007-07-06 11:48:19 +00:00
|
|
|
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
2007-07-10 13:30:42 +00:00
|
|
|
while ($row = $result->fetch_assoc()) {
|
2007-07-10 06:30:04 +00:00
|
|
|
echo "<tr valign='top'><th>$row[Timing]</th><th>$row[Event]</th><td><pre class='jush-sql'>" . htmlspecialchars($row["Statement"]) . "</pre></td></tr>\n";
|
2007-07-06 09:55:51 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
2007-07-10 13:30:42 +00:00
|
|
|
$result->free();
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|