]> git.joonet.de Git - adminer.git/commitdiff
Link more foreign keys
authorJakub Vrana <jakub@vrana.cz>
Wed, 3 Nov 2010 07:40:10 +0000 (08:40 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 3 Nov 2010 07:40:10 +0000 (08:40 +0100)
adminer/select.inc.php

index e74804a44d185e9ae61585227b50a4d7b37ca1b1..c2c6229d60085ea545c90bdba186b2ded11f2f06 100644 (file)
@@ -300,12 +300,15 @@ if (!$columns) {
                                                        
                                                        if (!$link) { // link related items
                                                                foreach ((array) $foreign_keys[$key] as $foreign_key) {
-                                                                       if (count($foreign_keys[$key]) == 1 || count($foreign_key["source"]) == 1) {
+                                                                       if (count($foreign_keys[$key]) == 1 || end($foreign_key["source"]) == $key) {
+                                                                               $link = "";
                                                                                foreach ($foreign_key["source"] as $i => $source) {
                                                                                        $link .= where_link($i, $foreign_key["target"][$i], $rows[$n][$source]);
                                                                                }
                                                                                $link = h(($foreign_key["db"] != "" ? preg_replace('~([?&]db=)[^&]+~', '\\1' . urlencode($foreign_key["db"]), ME) : ME) . 'select=' . urlencode($foreign_key["table"]) . $link); // InnoDB supports non-UNIQUE keys
-                                                                               break;
+                                                                               if (count($foreign_key["source"]) == 1) {
+                                                                                       break;
+                                                                               }
                                                                        }
                                                                }
                                                        }