1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 17:44:07 +02:00

Display type in schema

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@724 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-06-19 08:58:13 +00:00
parent 4956a3d66d
commit 1f733b0dda
2 changed files with 8 additions and 4 deletions

View File

@@ -230,6 +230,7 @@ function fields($table) {
preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~', $row["Type"], $match);
$return[$row["Field"]] = array(
"field" => $row["Field"],
"Type" => $row["Type"],
"type" => $match[1],
"length" => $match[2],
"unsigned" => ltrim($match[3] . $match[4]),

View File

@@ -63,14 +63,17 @@ foreach ($schema as $name => $table) {
echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($name) . '"><strong>' . htmlspecialchars($name) . "</strong></a><br />\n";
foreach ($table["fields"] as $field) {
$val = htmlspecialchars($field["field"]);
$title = ' title="' . htmlspecialchars($field["Type"] . ($field["null"] ? " " . lang('NULL') : '')) . '"';
if (preg_match('~char|text~', $field["type"])) {
$val = "<span class='char'>$val</span>";
$val = "<span class='char'$title>$val</span>";
} elseif (preg_match('~date|time|year~', $field["type"])) {
$val = "<span class='date'>$val</span>";
$val = "<span class='date'$title>$val</span>";
} elseif (preg_match('~binary|blob~', $field["type"])) {
$val = "<span class='binary'>$val</span>";
$val = "<span class='binary'$title>$val</span>";
} elseif (preg_match('~enum|set~', $field["type"])) {
$val = "<span class='enum'>$val</span>";
$val = "<span class='enum'$title>$val</span>";
} else {
$val = "<span$title>$val</span>";
}
echo ($field["primary"] ? "<em>$val</em>" : $val) . "<br />\n";
}