]> git.joonet.de Git - adminer.git/commitdiff
Do not attempt allFields without DB (fix #1033)
authorJakub Vrana <jakub@vrana.cz>
Mon, 14 Apr 2025 07:21:51 +0000 (09:21 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 14 Apr 2025 07:21:51 +0000 (09:21 +0200)
adminer/include/driver.inc.php

index a7e05443a225b56f3e4c4ae8bec1252af4ab550c..8cd1b2084bbf7dd1b45c1c650204616ccdc63a5e 100644 (file)
@@ -268,14 +268,16 @@ AND CHECK_CLAUSE NOT LIKE '% IS NOT NULL'", $this->conn); // ignore default IS N
        */
        function allFields(): array {
                $return = array();
-               foreach (
-                       get_rows("SELECT TABLE_NAME AS tab, COLUMN_NAME AS field, IS_NULLABLE AS nullable, DATA_TYPE AS type, CHARACTER_MAXIMUM_LENGTH AS length" . (JUSH == 'sql' ? ", COLUMN_KEY = 'PRI' AS `primary`" : "") . "
+               if (DB != "") {
+                       foreach (
+                               get_rows("SELECT TABLE_NAME AS tab, COLUMN_NAME AS field, IS_NULLABLE AS nullable, DATA_TYPE AS type, CHARACTER_MAXIMUM_LENGTH AS length" . (JUSH == 'sql' ? ", COLUMN_KEY = 'PRI' AS `primary`" : "") . "
 FROM INFORMATION_SCHEMA.COLUMNS
 WHERE TABLE_SCHEMA = " . q($_GET["ns"] != "" ? $_GET["ns"] : DB) . "
 ORDER BY TABLE_NAME, ORDINAL_POSITION", $this->conn) as $row
-               ) {
-                       $row["null"] = ($row["nullable"] == "YES");
-                       $return[$row["tab"]][] = $row;
+                       ) {
+                               $row["null"] = ($row["nullable"] == "YES");
+                               $return[$row["tab"]][] = $row;
+                       }
                }
                return $return;
        }