mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 17:44:07 +02:00
Added pdo_dblib as a driver for MSSQL (as native MSSQL driver does not exist for PHP7)
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
$drivers["mssql"] = "MS SQL";
|
$drivers["mssql"] = "MS SQL";
|
||||||
|
|
||||||
if (isset($_GET["mssql"])) {
|
if (isset($_GET["mssql"])) {
|
||||||
$possible_drivers = array("SQLSRV", "MSSQL");
|
$possible_drivers = array("SQLSRV", "MSSQL", "PDO_DBLIB");
|
||||||
define("DRIVER", "mssql");
|
define("DRIVER", "mssql");
|
||||||
if (extension_loaded("sqlsrv")) {
|
if (extension_loaded("sqlsrv")) {
|
||||||
class Min_DB {
|
class Min_DB {
|
||||||
@@ -234,8 +234,21 @@ if (isset($_GET["mssql"])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} elseif (extension_loaded("pdo_dblib")) {
|
||||||
|
class Min_DB extends Min_PDO {
|
||||||
|
var $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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Min_Driver extends Min_SQL {
|
class Min_Driver extends Min_SQL {
|
||||||
|
@@ -19,7 +19,7 @@ if (extension_loaded('pdo')) {
|
|||||||
auth_error($ex->getMessage());
|
auth_error($ex->getMessage());
|
||||||
}
|
}
|
||||||
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
||||||
$this->server_info = $this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
$this->server_info = @$this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
/*abstract function select_db($database);*/
|
/*abstract function select_db($database);*/
|
||||||
|
Reference in New Issue
Block a user