]> git.joonet.de Git - adminer.git/commitdiff
Move is_c_style_escapes to Min_Driver
authorJakub Vrana <jakub@vrana.cz>
Tue, 25 Feb 2025 06:26:08 +0000 (07:26 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 25 Feb 2025 06:26:08 +0000 (07:26 +0100)
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/drivers/sqlite.inc.php
adminer/include/driver.inc.php
adminer/sql.inc.php

index c6f59f6605d18bf4206b80a78877eeb2d5a89a8f..035efdbfa46b68eaea09cac84bcdcd7ab8dd79b8 100644 (file)
@@ -662,10 +662,6 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
                return array();
        }
 
-       function is_c_style_escapes() {
-               return false;
-       }
-
        function show_status() {
                return array();
        }
index f1ae8a8a59b55b22e27178171775534c0bfbd36f..2538482515810ee0b8cc20041a427581fe93e29b 100644 (file)
@@ -345,6 +345,15 @@ if (!defined("DRIVER")) {
                        }
                }
 
+               function hasCStyleEscapes() {
+                       static $c_style;
+                       if ($c_style === null) {
+                               $sql_mode = $this->_conn->result("SHOW VARIABLES LIKE 'sql_mode'", 1);
+                               $c_style = (strpos($sql_mode, 'NO_BACKSLASH_ESCAPES') === false);
+                       }
+                       return $c_style;
+               }
+
        }
 
 
@@ -1070,19 +1079,6 @@ if (!defined("DRIVER")) {
                return get_key_vals("SHOW VARIABLES");
        }
 
-       /** Check if C-style escapes are supported
-       * @return bool
-       */
-       function is_c_style_escapes() {
-               global $connection;
-               static $c_style;
-               if ($c_style === null) {
-                       $sql_mode = $connection->result("SHOW VARIABLES LIKE 'sql_mode'", 1);
-                       $c_style = (strpos($sql_mode, 'NO_BACKSLASH_ESCAPES') === false);
-               }
-               return $c_style;
-       }
-
        /** Get process list
        * @return array [$row]
        */
index 6ba2607c344fbb7efec81851dfa70303a45951c7..65cb48942e8e8e80ac849b6cc34ae62e6e14dba7 100644 (file)
@@ -165,6 +165,11 @@ if (isset($_GET["oracle"])) {
                        }
                        return true;
                }
+
+               function hasCStyleEscapes() {
+                       return true;
+               }
+
        }
 
 
@@ -484,10 +489,6 @@ AND c_src.TABLE_NAME = " . q($table);
                return get_key_vals('SELECT name, display_value FROM v$parameter');
        }
 
-       function is_c_style_escapes() {
-               return true;
-       }
-
        function process_list() {
                return get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
 FROM v$session sess LEFT OUTER JOIN v$sql sql
index 23f6254837d97e5e27189d28d5ed4c921651a8ef..a5e6f8e1241176eb5786bd8aeb69a056ae3ebd64 100644 (file)
@@ -249,6 +249,14 @@ if (isset($_GET["pgsql"])) {
                        }
                }
 
+               function hasCStyleEscapes() {
+                       static $c_style;
+                       if ($c_style === null) {
+                               $c_style = ($this->_conn->result("SHOW standard_conforming_strings") == "off");
+                       }
+                       return $c_style;
+               }
+
        }
 
 
@@ -879,15 +887,6 @@ ORDER BY connamespace, conname"
                return get_key_vals("SHOW ALL");
        }
 
-       function is_c_style_escapes() {
-               global $connection;
-               static $c_style;
-               if ($c_style === null) {
-                       $c_style = ($connection->result("SHOW standard_conforming_strings") == "off");
-               }
-               return $c_style;
-       }
-
        function process_list() {
                return get_rows("SELECT * FROM pg_stat_activity ORDER BY " . (min_version(9.2) ? "pid" : "procpid"));
        }
index 239b3042ef34885aed043ef8b02c8864e3536852..f206c02335cc0099126ecb8bfd50170bb6d48d3f 100644 (file)
@@ -764,10 +764,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
                return $return;
        }
 
-       function is_c_style_escapes() {
-               return false;
-       }
-
        function show_status() {
                $return = array();
                foreach (get_vals("PRAGMA compile_options") as $option) {
index cf577768b1cc5a6a3de045aaea8ca14343be627e..394ab635161bd4cb16c730807893fe7520649c1c 100644 (file)
@@ -193,4 +193,11 @@ function get_driver($id) {
        function tableHelp($name) {
        }
 
+       /** Check if C-style escapes are supported
+       * @return bool
+       */
+       function hasCStyleEscapes() {
+               return false;
+       }
+
 }
index e9587987930deb9cbc3415f9b42c6b58e94b6c07..fa1d643f442c628272c65c4e1b64cd171fc8e027 100644 (file)
@@ -81,7 +81,7 @@ if (!$error && $_POST) {
                                        $offset = $pos + strlen($found);
 
                                        if ($found && rtrim($found) != $delimiter) { // find matching quote or comment end
-                                               $c_style_escapes = is_c_style_escapes() || ($jush == "pgsql" && ($pos > 0 && strtolower($query[$pos - 1]) == "e"));
+                                               $c_style_escapes = $driver->hasCStyleEscapes() || ($jush == "pgsql" && ($pos > 0 && strtolower($query[$pos - 1]) == "e"));
 
                                                $pattern = ($found == '/*' ? '\*/'
                                                        : ($found == '[' ? ']'