Support for virtual foreign keys
This commit is contained in:
parent
43f936a0d8
commit
753909ecea
|
@ -108,6 +108,14 @@ document.getElementById('username').focus();
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get foreign keys for table
|
||||||
|
* @param string
|
||||||
|
* @return array same format as foreign_keys()
|
||||||
|
*/
|
||||||
|
function foreignKeys($table) {
|
||||||
|
return foreign_keys($table);
|
||||||
|
}
|
||||||
|
|
||||||
/** Find backward keys for table
|
/** Find backward keys for table
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
|
|
|
@ -550,8 +550,9 @@ function hidden_fields_get() {
|
||||||
* @return array array($col => array())
|
* @return array array($col => array())
|
||||||
*/
|
*/
|
||||||
function column_foreign_keys($table) {
|
function column_foreign_keys($table) {
|
||||||
|
global $adminer;
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (foreign_keys($table) as $foreign_key) {
|
foreach ($adminer->foreignKeys($table) as $foreign_key) {
|
||||||
foreach ($foreign_key["source"] as $val) {
|
foreach ($foreign_key["source"] as $val) {
|
||||||
$return[$val][] = $foreign_key;
|
$return[$val][] = $foreign_key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,7 @@ foreach (table_status() as $row) {
|
||||||
$schema[$row["Name"]]["fields"][$name] = $field;
|
$schema[$row["Name"]]["fields"][$name] = $field;
|
||||||
}
|
}
|
||||||
$schema[$row["Name"]]["pos"] = ($table_pos[$row["Name"]] ? $table_pos[$row["Name"]] : array($top, 0));
|
$schema[$row["Name"]]["pos"] = ($table_pos[$row["Name"]] ? $table_pos[$row["Name"]] : array($top, 0));
|
||||||
if (fk_support($row)) {
|
foreach ($adminer->foreignKeys($row["Name"]) as $val) {
|
||||||
foreach (foreign_keys($row["Name"]) as $val) {
|
|
||||||
if (!$val["db"]) {
|
if (!$val["db"]) {
|
||||||
$left = $base_left;
|
$left = $base_left;
|
||||||
if ($table_pos[$row["Name"]][1] || $table_pos[$val["table"]][1]) {
|
if ($table_pos[$row["Name"]][1] || $table_pos[$val["table"]][1]) {
|
||||||
|
@ -45,7 +44,6 @@ foreach (table_status() as $row) {
|
||||||
$lefts[(string) $left] = true;
|
$lefts[(string) $left] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$top = max($top, $schema[$row["Name"]]["pos"][0] + 2.5 + $pos);
|
$top = max($top, $schema[$row["Name"]]["pos"][0] + 2.5 + $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ Highlight and edit SQL command in processlist
|
||||||
Disable XSS "protection" of IE8
|
Disable XSS "protection" of IE8
|
||||||
Timestamp in export
|
Timestamp in export
|
||||||
Link to bookmark SQL command
|
Link to bookmark SQL command
|
||||||
|
Support for virtual foreign keys
|
||||||
Immunity against zend.ze1_compatibility_mode
|
Immunity against zend.ze1_compatibility_mode
|
||||||
Fix last page with empty result set
|
Fix last page with empty result set
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ document.getElementById('username').focus();
|
||||||
echo "<a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a>\n";
|
echo "<a href='" . h(remove_from_uri("page")) . "&page=last' title='" . lang('Page') . ": " . lang('last') . "'>>></a>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function foreignKeys($table) {
|
||||||
|
return foreign_keys($table);
|
||||||
|
}
|
||||||
|
|
||||||
function backwardKeys($table, $tableName) {
|
function backwardKeys($table, $tableName) {
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
|
foreach (get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
|
||||||
|
|
Loading…
Reference in a new issue