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

Use protected visibility

This commit is contained in:
Jakub Vrana
2025-03-11 07:49:10 +01:00
parent 607febea8e
commit c454ea8430
7 changed files with 33 additions and 33 deletions

View File

@@ -331,15 +331,15 @@ if (isset($_GET["mongo"])) {
$limit = min(200, max(1, (int) $limit));
$skip = $page * $limit;
try {
return new Result($this->_conn->_link->executeQuery($this->_conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
return new Result($this->conn->_link->executeQuery($this->conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
} catch (Exception $e) {
$this->_conn->error = $e->getMessage();
$this->conn->error = $e->getMessage();
return false;
}
}
function update($table, $set, $queryWhere, $limit = 0, $separator = "\n") {
$db = $this->_conn->_db_name;
$db = $this->conn->_db_name;
$where = sql_query_where_parser($queryWhere);
$bulk = new \MongoDB\Driver\BulkWrite(array());
if (isset($set['_id'])) {
@@ -357,25 +357,25 @@ if (isset($_GET["mongo"])) {
$update['$unset'] = $removeFields;
}
$bulk->update($where, $update, array('upsert' => false));
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getModifiedCount');
return $this->conn->executeBulkWrite("$db.$table", $bulk, 'getModifiedCount');
}
function delete($table, $queryWhere, $limit = 0) {
$db = $this->_conn->_db_name;
$db = $this->conn->_db_name;
$where = sql_query_where_parser($queryWhere);
$bulk = new \MongoDB\Driver\BulkWrite(array());
$bulk->delete($where, array('limit' => $limit));
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getDeletedCount');
return $this->conn->executeBulkWrite("$db.$table", $bulk, 'getDeletedCount');
}
function insert($table, $set) {
$db = $this->_conn->_db_name;
$db = $this->conn->_db_name;
$bulk = new \MongoDB\Driver\BulkWrite(array());
if ($set['_id'] == '') {
unset($set['_id']);
}
$bulk->insert($set);
return $this->_conn->executeBulkWrite("$db.$table", $bulk, 'getInsertedCount');
return $this->conn->executeBulkWrite("$db.$table", $bulk, 'getInsertedCount');
}
}

View File

@@ -356,7 +356,7 @@ if (!defined('Adminer\DRIVER')) {
function slowQuery($query, $timeout) {
if (min_version('5.7.8', '10.1.2')) {
if (preg_match('~MariaDB~', $this->_conn->server_info)) {
if (preg_match('~MariaDB~', $this->conn->server_info)) {
return "SET STATEMENT max_statement_time=$timeout FOR $query";
} elseif (preg_match('~^(SELECT\b)(.+)~is', $query, $match)) {
return "$match[1] /*+ MAX_EXECUTION_TIME(" . ($timeout * 1000) . ") */ $match[2]";
@@ -366,13 +366,13 @@ if (!defined('Adminer\DRIVER')) {
function convertSearch($idf, $val, $field) {
return (preg_match('~char|text|enum|set~', $field["type"]) && !preg_match("~^utf8~", $field["collation"]) && preg_match('~[\x80-\xFF]~', $val['val'])
? "CONVERT($idf USING " . charset($this->_conn) . ")"
? "CONVERT($idf USING " . charset($this->conn) . ")"
: $idf
);
}
function warnings() {
$result = $this->_conn->query("SHOW WARNINGS");
$result = $this->conn->query("SHOW WARNINGS");
if ($result && $result->num_rows) {
ob_start();
select($result); // select() usually needs to print a big table progressively
@@ -381,7 +381,7 @@ if (!defined('Adminer\DRIVER')) {
}
function tableHelp($name, $is_view = false) {
$maria = preg_match('~MariaDB~', $this->_conn->server_info);
$maria = preg_match('~MariaDB~', $this->conn->server_info);
if (information_schema(DB)) {
return strtolower("information-schema-" . ($maria ? "$name-table/" : str_replace("_", "-", $name) . "-table.html"));
}
@@ -393,7 +393,7 @@ if (!defined('Adminer\DRIVER')) {
function hasCStyleEscapes() {
static $c_style;
if ($c_style === null) {
$sql_mode = $this->_conn->result("SHOW VARIABLES LIKE 'sql_mode'", 1);
$sql_mode = $this->conn->result("SHOW VARIABLES LIKE 'sql_mode'", 1);
$c_style = (strpos($sql_mode, 'NO_BACKSLASH_ESCAPES') === false);
}
return $c_style;

View File

@@ -267,8 +267,8 @@ if (isset($_GET["pgsql"])) {
}
function slowQuery($query, $timeout) {
$this->_conn->query("SET statement_timeout = " . (1000 * $timeout));
$this->_conn->timeout = 1000 * $timeout;
$this->conn->query("SET statement_timeout = " . (1000 * $timeout));
$this->conn->timeout = 1000 * $timeout;
return $query;
}
@@ -282,11 +282,11 @@ if (isset($_GET["pgsql"])) {
}
function quoteBinary($s) {
return $this->_conn->quoteBinary($s);
return $this->conn->quoteBinary($s);
}
function warnings() {
return $this->_conn->warnings();
return $this->conn->warnings();
}
function tableHelp($name, $is_view = false) {
@@ -308,7 +308,7 @@ if (isset($_GET["pgsql"])) {
function hasCStyleEscapes() {
static $c_style;
if ($c_style === null) {
$c_style = ($this->_conn->result("SHOW standard_conforming_strings") == "off");
$c_style = ($this->conn->result("SHOW standard_conforming_strings") == "off");
}
return $c_style;
}

View File

@@ -177,7 +177,7 @@ if (isset($_GET["sqlite"])) {
}
function checkConstraints($table) {
preg_match_all('~ CHECK *(\( *(((?>[^()]*[^() ])|(?1))*) *\))~', $this->_conn->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table)), $matches); //! could be inside a comment
preg_match_all('~ CHECK *(\( *(((?>[^()]*[^() ])|(?1))*) *\))~', $this->conn->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table)), $matches); //! could be inside a comment
return array_combine($matches[2], $matches[2]);
}
}

View File

@@ -26,7 +26,7 @@ abstract class SqlDriver {
static $possibleDrivers = array();
static $jush; ///< @var string JUSH identifier
var $_conn;
protected $conn;
protected $types = array(); ///< @var array [$description => [$type => $maximum_unsigned_length, ...], ...]
var $editFunctions = array(); ///< @var array of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
var $unsigned = array(); ///< @var array number variants
@@ -42,7 +42,7 @@ abstract class SqlDriver {
* @param Db
*/
function __construct($connection) {
$this->_conn = $connection;
$this->conn = $connection;
}
/** Get all types
@@ -91,7 +91,7 @@ abstract class SqlDriver {
);
}
$start = microtime(true);
$return = $this->_conn->query($query);
$return = $this->conn->query($query);
if ($print) {
echo $adminer->selectQuery($query, $start, !$return);
}
@@ -201,8 +201,8 @@ abstract class SqlDriver {
* @return string
*/
function value($val, $field) {
return (method_exists($this->_conn, 'value')
? $this->_conn->value($val, $field)
return (method_exists($this->conn, 'value')
? $this->conn->value($val, $field)
: (is_resource($val) ? stream_get_contents($val) : $val)
);
}

View File

@@ -199,7 +199,7 @@ if (isset($_GET["elastic"])) {
$query = "$table/_search";
$start = microtime(true);
$search = $this->_conn->rootQuery($query, $data);
$search = $this->conn->rootQuery($query, $data);
if ($print) {
echo adminer()->selectQuery("$query: " . json_encode($data), $start, !$search);
@@ -245,7 +245,7 @@ if (isset($_GET["elastic"])) {
$id = trim($parts[1]);
$query = "$type/$id";
return $this->_conn->query($query, $record, 'POST');
return $this->conn->query($query, $record, 'POST');
}
return false;
@@ -262,11 +262,11 @@ if (isset($_GET["elastic"])) {
unset($record[$key]);
}
}
$response = $this->_conn->query($query, $record, 'POST');
$response = $this->conn->query($query, $record, 'POST');
if ($response == false) {
return false;
}
$this->_conn->last_id = $response['_id'];
$this->conn->last_id = $response['_id'];
return $response['result'];
}
@@ -286,17 +286,17 @@ if (isset($_GET["elastic"])) {
}
}
$this->_conn->affected_rows = 0;
$this->conn->affected_rows = 0;
foreach ($ids as $id) {
$query = "$table/_doc/$id";
$response = $this->_conn->query($query, null, 'DELETE');
$response = $this->conn->query($query, null, 'DELETE');
if (isset($response['result']) && $response['result'] == 'deleted') {
$this->_conn->affected_rows++;
$this->conn->affected_rows++;
}
}
return $this->_conn->affected_rows;
return $this->conn->affected_rows;
}
function convertOperator($operator) {

View File

@@ -246,7 +246,7 @@ if (isset($_GET["simpledb"])) {
}
function slowQuery($query, $timeout) {
$this->_conn->timeout = $timeout;
$this->conn->timeout = $timeout;
return $query;
}
}