function(string $table)
{
if (!$this->check()) {
return null;
}
$r = [];
if ($table = $this->tableFullName($table)) {
$indexes = $this->getRows(<< [$index['column_name']],
'ref_db' => null,
'ref_table' => null,
'ref_column' => null,
'constraint' => null,
'update' => null,
'delete' => null,
'unique' => (int)$index['is_unique'],
];
} else {
$keys[$index['key_name']]['columns'][] = $index['column_name'];
}
if (!isset($cols[$index['column_name']])) {
$cols[$index['column_name']] = [$index['key_name']];
} else {
$cols[$index['column_name']][] = $index['key_name'];
}
}
if ($constraints = $this->getRows(<< [$constraint['column_name']],
'ref_db' => $this->getCurrent(),
'ref_table' => $constraint['foreign_table_name'],
'ref_column' => $constraint['foreign_column_name'],
'constraint' => $constraint['constraint_name'],
'update' => null,
'delete' => null,
'unique' => 0,
];
} else {
$keys[$constraint['key_name']]['columns'][] = $constraint['column_name'];
$keys[$constraint['key_name']]['ref_db'] = $keys[$constraint['key_name']]['ref_table'] = $keys[$constraint['key_name']]['ref_column'] = null;
}
if (!isset($cols[$constraint['column_name']])) {
$cols[$constraint['column_name']] = [$constraint['constraint_name']];
} else {
$cols[$constraint['column_name']][] = $constraint['constraint_name'];
}
}
}
$r['keys'] = $keys;
$r['cols'] = $cols;
}
return $r;
}