]> git.joonet.de Git - adminer.git/commitdiff
Primary key detection for other drivers
authorJakub Vrana <jakub@vrana.cz>
Thu, 22 Jul 2010 15:43:43 +0000 (17:43 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 22 Jul 2010 15:43:43 +0000 (17:43 +0200)
adminer/select.inc.php

index 17e6ff8705d477b47010060a3ea78ca793f22e75..9ec8a9457638ea33e82a6375c9bc2ed1f178a1b3 100644 (file)
@@ -28,7 +28,13 @@ $group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(
 
 if ($_POST && !$error) {
        $where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
-       $primary = ($indexes["PRIMARY"] ? ($select ? array_flip($indexes["PRIMARY"]["columns"]) : array()) : null); // empty array means that all primary fields are selected
+       $primary = null;
+       foreach ($indexes as $index) {
+               if ($index["type"] == "PRIMARY") {
+                       $primary = ($select ? array_flip($index["columns"]) : array()); // empty array means that all primary fields are selected
+                       break;
+               }
+       }
        foreach ($select as $key => $val) {
                $val = $_GET["columns"][$key];
                if (!$val["fun"]) {