]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL, Oracle: Set schema for EXPLAIN queries in SQL command (bug #706)
authorJakub Vrana <jakub@vrana.cz>
Mon, 11 Nov 2019 11:10:46 +0000 (12:10 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 11 Nov 2019 11:27:53 +0000 (12:27 +0100)
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/include/version.inc.php
adminer/sql.inc.php
changes.txt

index 50834e76f5d67c4e15acdc1310a3197eb10c4bdd..07c96ab0fbb87a96b93a0c7e867baf0605b749ae 100644 (file)
@@ -986,9 +986,10 @@ if (!defined("DRIVER")) {
 
        /** Set current schema
        * @param string
+       * @param Min_DB
        * @return bool
        */
-       function set_schema($schema) {
+       function set_schema($schema, $connection2 = null) {
                return true;
        }
 
index ff491b33e2cfb26cdfed99429879967f9d33b703..0395f850e24f9ce6f78bddb228219f79804e496c 100644 (file)
@@ -367,9 +367,12 @@ AND c_src.TABLE_NAME = " . q($table);
                return $connection->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");
        }
 
-       function set_schema($scheme) {
+       function set_schema($scheme, $connection2 = null) {
                global $connection;
-               return $connection->query("ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape($scheme));
+               if (!$connection2) {
+                       $connection2 = $connection;
+               }
+               return $connection2->query("ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape($scheme));
        }
 
        function show_variables() {
index 7a436a5107d2a289b6539cb2e25dad3840b8d128..21b0002df860df019181b393bfd94c70ffef7da0 100644 (file)
@@ -689,9 +689,12 @@ AND typelem = 0"
                return $connection->result("SELECT current_schema()");
        }
 
-       function set_schema($schema) {
+       function set_schema($schema, $connection2 = null) {
                global $connection, $types, $structured_types;
-               $return = $connection->query("SET search_path TO " . idf_escape($schema));
+               if (!$connection2) {
+                       $connection2 = $connection;
+               }
+               $return = $connection2->query("SET search_path TO " . idf_escape($schema));
                foreach (types() as $type) { //! get types from current_schemas('t')
                        if (!isset($types[$type])) {
                                $types[$type] = 0;
index 9b916bae2a3663e7017ea3da0b7998b348bceb7c..e77123c4cfc5203e0fb70933cea6a6a8619c0634 100644 (file)
@@ -1,2 +1,2 @@
 <?php
-$VERSION = "4.7.4";
+$VERSION = "4.7.5-dev";
index 1119fbea6182e63645ce733e9166405cf495c75d..69ba1779e83a327508c633bb2d8827b0c006cfbe 100644 (file)
@@ -53,6 +53,9 @@ if (!$error && $_POST) {
                $connection2 = connect(); // connection for exploring indexes and EXPLAIN (to not replace FOUND_ROWS()) //! PDO - silent error
                if (is_object($connection2) && DB != "") {
                        $connection2->select_db(DB);
+                       if ($_GET["ns"] != "") {
+                               set_schema($_GET["ns"], $connection2);
+                       }
                }
                $commands = 0;
                $errors = array();
index 3939543bae6e11216fdc108ed256a1903a6a59d7..15207441e623d67ea057cd614425644e7faabf98 100644 (file)
@@ -1,3 +1,6 @@
+Adminer 4.7.5-dev:
+PostgreSQL, Oracle: Set schema for EXPLAIN queries in SQL command (bug #706)
+
 Adminer 4.7.4 (released 2019-10-22):
 Fix XSS if Adminer is accessible at URL /data: