selectLinks($table_status);
if ($fields) {
echo "
\n";
echo "" . lang('Column') . " | " . lang('Type') . " | " . lang('Comment') . " |
\n";
foreach ($fields as $field) {
echo "" . h($field["field"]);
echo " | " . h($field["full_type"]) . ($field["null"] ? " NULL" : "") . ($field["auto_increment"] ? " " . lang('Auto Increment') . "" : "");
echo " | " . nbsp($field["comment"]);
echo "\n";
}
echo " |
---|
\n";
if (isset($table_status["Rows"])) {
echo "" . lang('Indexes') . "
\n";
$indexes = indexes($TABLE);
if ($indexes) {
echo "\n";
foreach ($indexes as $name => $index) {
ksort($index["columns"]); // enforce correct columns order
$print = array();
foreach ($index["columns"] as $key => $val) {
$print[] = "" . h($val) . "" . ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "");
}
echo "$index[type] | " . implode(", ", $print) . "\n";
}
echo " |
---|
\n";
}
echo '' . lang('Alter indexes') . "\n";
if ($table_status["Engine"] == "InnoDB") {
echo "
" . lang('Foreign keys') . "
\n";
$foreign_keys = foreign_keys($TABLE);
if ($foreign_keys) {
echo "\n";
foreach ($foreign_keys as $name => $foreign_key) {
$link = ($foreign_key["db"] != "" ? "" . h($foreign_key["db"]) . "." : "") . h($foreign_key["table"]);
echo "";
echo "" . implode(", ", array_map('h', $foreign_key["source"])) . "";
echo " | $link";
echo "(" . implode(", ", array_map('h', $foreign_key["target"])) . ")";
echo ' | ' . lang('Alter') . '';
}
echo " |
\n";
}
echo '' . lang('Add foreign key') . "\n";
}
if ($connection->server_info >= 5) {
echo "
" . lang('Triggers') . "
\n";
$result = $connection->query("SHOW TRIGGERS LIKE " . $connection->quote(addcslashes($TABLE, "%_")));
if ($result->num_rows) {
echo "\n";
while ($row = $result->fetch_assoc()) {
echo "$row[Timing] | $row[Event] | " . h($row["Trigger"]) . " | " . lang('Alter') . "\n";
}
echo " |
---|
\n";
}
echo '' . lang('Add trigger') . "\n";
}
}
}