Use common parent for Db

This commit is contained in:
Jakub Vrana
2025-03-27 15:28:14 +01:00
parent 0578b5c490
commit e2deed9a02
18 changed files with 167 additions and 298 deletions

View File

@@ -6,9 +6,9 @@ $drivers["pgsql"] = "PostgreSQL";
if (isset($_GET["pgsql"])) {
define('Adminer\DRIVER', "pgsql");
if (extension_loaded("pgsql") && $_GET["ext"] != "pdo") {
class Db {
public $extension = "PgSQL", $flavor = '', $server_info, $affected_rows, $error, $timeout;
private $link, $result, $string, $database = true;
class Db extends SqlDb {
public $extension = "PgSQL", $timeout;
private $link, $string, $database = true;
function _error($errno, $error) {
if (ini_bool("html_errors")) {
@@ -86,24 +86,6 @@ if (isset($_GET["pgsql"])) {
return $return;
}
function multi_query($query) {
return $this->result = $this->query($query);
}
function store_result() {
return $this->result;
}
function next_result() {
// PgSQL extension doesn't support multiple results
return false;
}
function result($query, $field = 0) {
$result = $this->query($query);
return ($result ? $result->fetch_column($field) : false);
}
function warnings() {
return h(pg_last_notice($this->link)); // second parameter is available since PHP 7.1.0
}
@@ -126,10 +108,6 @@ if (isset($_GET["pgsql"])) {
return pg_fetch_row($this->result);
}
function fetch_column($field) {
return ($this->num_rows ? pg_fetch_result($this->result, 0, $field) : false);
}
function fetch_field() {
$column = $this->offset++;
$return = new \stdClass;
@@ -176,7 +154,9 @@ if (isset($_GET["pgsql"])) {
return $return;
}
// warnings() not implemented in PDO_PgSQL as of PHP 7.2.1
function warnings() {
// not implemented in PDO_PgSQL as of PHP 7.2.1
}
function close() {
}