error); } $table_status = ($fields ? table_status($TABLE) : array()); $is_view = !isset($table_status["Rows"]); page_header(($fields && $is_view ? lang('View') : lang('Table')) . ": " . h($TABLE), $error); $adminer->selectLinks($table_status, $is_view ? null : ""); if ($fields) { echo "\n"; echo "\n"; foreach ($fields as $field) { echo "
" . lang('Column') . "" . lang('Type') . "" . lang('Comment') . "
" . 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 $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 = (strlen($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"; } } }