зеркало из https://github.com/microsoft/msphpsql.git
Fixed driver name
This commit is contained in:
Родитель
0495513c07
Коммит
c1d579319d
|
@ -48,7 +48,7 @@ function connect($keywords = '', $options=array(), $errmode = PDO::ERRMODE_EXCEP
|
|||
// simply use $databaseName from MsSetup.inc to facilitate testing in Azure,
|
||||
// which does not support switching databases
|
||||
require("MsSetup.inc");
|
||||
$dsn = getDSN($server, $databaseName, $DriverName, $keywords, $disableCE);
|
||||
$dsn = getDSN($server, $databaseName, $driver, $keywords, $disableCE);
|
||||
$conn = new PDO($dsn, $uid, $pwd, $options);
|
||||
if ($errmode == PDO::ERRMODE_EXCEPTION || $errmode == PDO::ERRMODE_WARNING || $errmode == PDO::ERRMODE_SILENT) {
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, $errmode);
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<?php
|
||||
// For Azure ActiveDirectory, must check that
|
||||
// 1. Either running Windows, or ODBC driver 17 or greater on unix
|
||||
// 2. Either SQL Server version is 2016 or greater, or using Azure
|
||||
|
||||
if (!extension_loaded("pdo_sqlsrv")) {
|
||||
die("skip Extension not loaded");
|
||||
}
|
||||
|
||||
$is_win = ( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' );
|
||||
|
||||
require_once( "MsSetup.inc" );
|
||||
|
||||
$conn = new PDO( "sqlsrv:server = $server ;", $uid, $pwd );
|
||||
|
@ -10,6 +16,16 @@ if ($conn === false) {
|
|||
die( "skip Could not connect during SKIPIF." );
|
||||
}
|
||||
|
||||
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
|
||||
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
||||
$msodbcsql_min = explode(".", $msodbcsql_ver)[1];
|
||||
|
||||
if (!$is_win) {
|
||||
if ($msodbcsql_maj < 17) {
|
||||
die("skip Unsupported ODBC driver version");
|
||||
}
|
||||
}
|
||||
|
||||
// Get SQL Server Version
|
||||
// Exclude this check if running on Azure
|
||||
if (!$daasMode) {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<?php
|
||||
// For Azure ActiveDirectory, must check that
|
||||
// 1. Either running Windows, or ODBC driver 17 or greater on unix
|
||||
// 2. Either SQL Server version is 2016 or greater, or using Azure
|
||||
|
||||
if (!extension_loaded("sqlsrv")) {
|
||||
die("skip Extension not loaded");
|
||||
}
|
||||
|
||||
$is_win = ( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' );
|
||||
|
||||
require_once( "MsSetup.inc" );
|
||||
|
||||
$connectionInfo = array( "UID"=>$userName, "PWD"=>$userPassword );
|
||||
|
@ -12,6 +18,15 @@ if ($conn === false) {
|
|||
die( "skip Could not connect during SKIPIF." );
|
||||
}
|
||||
|
||||
$msodbcsql_ver = sqlsrv_client_info($conn)["DriverVer"];
|
||||
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
||||
|
||||
if (!$is_win) {
|
||||
if ($msodbcsql_maj < 17) {
|
||||
die("skip Unsupported ODBC driver version");
|
||||
}
|
||||
}
|
||||
|
||||
// Get SQL Server version
|
||||
// Exclude this check if running on Azure
|
||||
if (!$daasMode) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче