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

Fix type of select_db()

This commit is contained in:
Jakub Vrana
2025-03-31 11:08:37 +02:00
parent 366342985d
commit e6c0c8ab6b
11 changed files with 18 additions and 16 deletions

View File

@@ -53,7 +53,7 @@ if (isset($_GET["mssql"])) {
return ($unicode ? "N" : "") . "'" . str_replace("'", "''", $string) . "'";
}
function select_db(string $database): bool {
function select_db(string $database) {
return $this->query(use_sql($database));
}
@@ -159,7 +159,7 @@ if (isset($_GET["mssql"])) {
} else {
abstract class MssqlDb extends PdoDb {
function select_db(string $database): bool {
function select_db(string $database) {
// database selection is separated from the connection so dbname in DSN can't be used
return $this->query(use_sql($database));
}

View File

@@ -91,7 +91,7 @@ if (!defined('Adminer\DRIVER')) {
return "'" . mysql_real_escape_string($string, $this->link) . "'";
}
function select_db(string $database): bool {
function select_db(string $database) {
return mysql_select_db($database, $this->link);
}
@@ -186,7 +186,7 @@ if (!defined('Adminer\DRIVER')) {
return $this->query("SET NAMES $charset"); // charset in DSN is ignored before PHP 5.3.6
}
function select_db(string $database): bool {
function select_db(string $database) {
// database selection is separated from the connection so dbname in DSN can't be used
return $this->query("USE " . idf_escape($database));
}

View File

@@ -33,7 +33,7 @@ if (isset($_GET["oracle"])) {
return "'" . str_replace("'", "''", $string) . "'";
}
function select_db(string $database): bool {
function select_db(string $database) {
$this->_current_db = $database;
return true;
}
@@ -109,7 +109,7 @@ if (isset($_GET["oracle"])) {
return $this->dsn("oci:dbname=//$server;charset=AL32UTF8", $username, $password);
}
function select_db(string $database): bool {
function select_db(string $database) {
$this->_current_db = $database;
return true;
}

View File

@@ -51,7 +51,7 @@ if (isset($_GET["pgsql"])) {
return ($field["type"] == "bytea" && $val !== null ? pg_unescape_bytea($val) : $val);
}
function select_db(string $database): bool {
function select_db(string $database) {
if ($database == adminer()->database()) {
return $this->database;
}
@@ -138,7 +138,7 @@ if (isset($_GET["pgsql"])) {
return $this->dsn($dsn, $username, $password);
}
function select_db(string $database): bool {
function select_db(string $database) {
return (adminer()->database() == $database);
}

View File

@@ -25,8 +25,10 @@ abstract class SqlDb {
*/
abstract function quote(string $string): string;
/** Select database */
abstract function select_db(string $database): bool;
/** Select database
* @return bool boolish
*/
abstract function select_db(string $database);
/** Send query
* @return Result|bool

View File

@@ -63,7 +63,7 @@ if (isset($_GET["clickhouse"])) {
return ($return ? '' : $this->error);
}
function select_db(string $database): bool {
function select_db(string $database) {
$this->_db = $database;
return true;
}

View File

@@ -71,7 +71,7 @@ if (isset($_GET["elastic"])) {
return ($return ? '' : $this->error);
}
function select_db(string $database): bool {
function select_db(string $database) {
return true;
}

View File

@@ -29,7 +29,7 @@ if (isset($_GET["firebird"])) {
return "'" . str_replace("'", "''", $string) . "'";
}
function select_db(string $database): bool {
function select_db(string $database) {
return ($database == "domain");
}

View File

@@ -30,7 +30,7 @@ if (isset($_GET["imap"])) {
return ($this->imap ? '' : imap_last_error());
}
function select_db(string $database): bool {
function select_db(string $database) {
return ($database == "mail");
}

View File

@@ -58,7 +58,7 @@ if (isset($_GET["mongo"])) {
return false;
}
function select_db(string $database): bool {
function select_db(string $database) {
$this->_db_name = $database;
return true;
}

View File

@@ -14,7 +14,7 @@ if (isset($_GET["simpledb"])) {
return '';
}
function select_db(string $database): bool {
function select_db(string $database) {
return ($database == "domain");
}