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

MS SQL: Add support for PDO_SQLSRV extension

This commit is contained in:
Jakub Vrana
2025-02-26 17:55:53 +01:00
parent 15cd83fc39
commit 848cd482e2
2 changed files with 17 additions and 2 deletions

View File

@@ -152,6 +152,21 @@ if (isset($_GET["mssql"])) {
} }
} }
} elseif (extension_loaded("pdo_sqlsrv")) {
class Min_DB extends Min_PDO {
var $extension = "PDO_SQLSRV";
function connect($server, $username, $password) {
$this->dsn("sqlsrv:Server=" . str_replace(":", ",", $server), $username, $password);
return true;
}
function select_db($database) {
// database selection is separated from the connection so dbname in DSN can't be used
return $this->query("USE " . idf_escape($database));
}
}
} elseif (extension_loaded("pdo_dblib")) { } elseif (extension_loaded("pdo_dblib")) {
class Min_DB extends Min_PDO { class Min_DB extends Min_PDO {
var $extension = "PDO_DBLIB"; var $extension = "PDO_DBLIB";
@@ -162,7 +177,6 @@ if (isset($_GET["mssql"])) {
} }
function select_db($database) { function select_db($database) {
// database selection is separated from the connection so dbname in DSN can't be used
return $this->query("USE " . idf_escape($database)); return $this->query("USE " . idf_escape($database));
} }
} }
@@ -637,7 +651,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
$structured_types[$key] = array_keys($val); $structured_types[$key] = array_keys($val);
} }
return array( return array(
'possible_drivers' => array("SQLSRV", "PDO_DBLIB"), 'possible_drivers' => array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"),
'jush' => "mssql", 'jush' => "mssql",
'types' => $types, 'types' => $types,
'structured_types' => $structured_types, 'structured_types' => $structured_types,

View File

@@ -8,6 +8,7 @@ MS SQL: Display foreign keys ON UPDATE and ON DELETE
MS SQL: Fix altering foreign key MS SQL: Fix altering foreign key
MS SQL PDO: Support offset MS SQL PDO: Support offset
MS SQL: Remove support for MSSQL extension MS SQL: Remove support for MSSQL extension
MS SQL: Add support for PDO_SQLSRV extension
MongoDB: Remove support for deprecated extension mongo MongoDB: Remove support for deprecated extension mongo
Adminer 4.17.1 (released 2025-02-25): Adminer 4.17.1 (released 2025-02-25):