\n";
echo '
' . htmlspecialchars($name) . "\n";
foreach (fields($name) as $field) {
$val = htmlspecialchars($field["field"]);
if (preg_match('~char|text~', $field["type"])) {
$val = "
$val";
} elseif (preg_match('~date|time|year~', $field["type"])) {
$val = "
$val";
} elseif (preg_match('~binary|blob~', $field["type"])) {
$val = "
$val";
} elseif (preg_match('~enum|set~', $field["type"])) {
$val = "
$val";
}
echo ($field["primary"] ? "
$val" : $val) . "
\n";
$top += 1.25;
$positions[$name][$field["field"]] = $top;
}
echo "
\n";
$top += 2.5;
}
$left = -14;
foreach ($schema as $name => $table) {
foreach ((array) $table["references"] as $target_name => $refs) {
foreach ($refs as $ref) {
$min_pos = $top;
$max_pos = 0;
foreach ($ref as $source => $target) {
$pos1 = $positions[$name][$source];
$pos2 = $positions[$target_name][$target];
$min_pos = min($min_pos, $pos1, $pos2);
$max_pos = max($max_pos, $pos1, $pos2);
echo "