1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

Move is_c_style_escapes to Min_Driver

This commit is contained in:
Jakub Vrana
2025-02-25 07:26:08 +01:00
parent a1235f68ff
commit 4f0da70733
7 changed files with 30 additions and 35 deletions

View 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();
}

View 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]
*/

View 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

View 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"));
}

View 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) {

View 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;
}
}

View 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 == '[' ? ']'