mirror of
https://github.com/vrana/adminer.git
synced 2025-08-20 13:21:30 +02:00
MS SQL: Common parent for PDO Db
This commit is contained in:
@@ -156,32 +156,32 @@ if (isset($_GET["mssql"])) {
|
||||
}
|
||||
}
|
||||
|
||||
} elseif (extension_loaded("pdo_sqlsrv")) {
|
||||
class Db extends PdoDb {
|
||||
public $extension = "PDO_SQLSRV";
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
$this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
class MssqlDb extends PdoDb {
|
||||
function select_db($database) {
|
||||
// database selection is separated from the connection so dbname in DSN can't be used
|
||||
return $this->query(use_sql($database));
|
||||
}
|
||||
}
|
||||
|
||||
} elseif (extension_loaded("pdo_dblib")) {
|
||||
class Db extends PdoDb {
|
||||
public $extension = "PDO_DBLIB";
|
||||
if (extension_loaded("pdo_sqlsrv")) {
|
||||
class Db extends MssqlDb {
|
||||
public $extension = "PDO_SQLSRV";
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
$this->dsn("dblib:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\d)~', ';port=\1', $server)), $username, $password);
|
||||
return true;
|
||||
function connect($server, $username, $password) {
|
||||
$this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function select_db($database) {
|
||||
return $this->query(use_sql($database));
|
||||
} elseif (extension_loaded("pdo_dblib")) {
|
||||
class Db extends MssqlDb {
|
||||
public $extension = "PDO_DBLIB";
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
$this->dsn("dblib:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\d)~', ';port=\1', $server)), $username, $password);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user