mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 07:06:45 +02:00
Optimize retrieving columns for schema
This commit is contained in:
@@ -19,16 +19,17 @@ $base_left = -1;
|
||||
$schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
|
||||
$referenced = array(); // target_table => array(table => array(left => target_column))
|
||||
$lefts = array(); // float => bool
|
||||
$all_fields = driver()->allFields();
|
||||
foreach (table_status('', true) as $table => $table_status) {
|
||||
if (is_view($table_status)) {
|
||||
continue;
|
||||
}
|
||||
$pos = 0;
|
||||
$schema[$table]["fields"] = array();
|
||||
foreach (fields($table) as $name => $field) {
|
||||
foreach ($all_fields[$table] as $field) {
|
||||
$pos += 1.25;
|
||||
$field["pos"] = $pos;
|
||||
$schema[$table]["fields"][$name] = $field;
|
||||
$schema[$table]["fields"][$field["field"]] = $field;
|
||||
}
|
||||
$schema[$table]["pos"] = ($table_pos[$table] ?: array($top, 0));
|
||||
foreach (adminer()->foreignKeys($table) as $val) {
|
||||
@@ -67,7 +68,7 @@ foreach ($schema as $name => $table) {
|
||||
echo script("qsl('div').onmousedown = schemaMousedown;");
|
||||
|
||||
foreach ($table["fields"] as $field) {
|
||||
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
|
||||
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["type"] . ($field["length"] ? "($field[length])" : "") . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
|
||||
echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user