Added driver to the skipif conditions (#831)

This commit is contained in:
Jenny Tam 2018-08-17 13:52:23 -07:00 committed by GitHub
parent 909d1fa130
commit 28a7860828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View file

@ -7,13 +7,13 @@ if (!extension_loaded("pdo_sqlsrv")) {
die("skip Extension not loaded");
}
$is_win = ( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' );
$is_win = (strtoupper(substr(php_uname('s'),0,3)) === 'WIN');
require_once( "MsSetup.inc" );
require_once("MsSetup.inc");
$conn = new PDO( "sqlsrv:server = $server ;", $uid, $pwd );
$conn = new PDO("sqlsrv:server = $server; driver=$driver;", $uid, $pwd);
if ($conn === false) {
die( "skip Could not connect during SKIPIF." );
die("skip Could not connect during SKIPIF.");
}
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
@ -33,11 +33,11 @@ if (!$is_win) {
// Get SQL Server Version
// Exclude this check if running on Azure
if (!$daasMode) {
$stmt = $conn->query( "SELECT @@VERSION" );
$stmt = $conn->query("SELECT @@VERSION");
if ($stmt) {
$ver_string = $stmt->fetch(PDO::FETCH_NUM)[0];
} else {
die( "skip Could not fetch SQL Server version during SKIPIF.");
die("skip Could not fetch SQL Server version during SKIPIF.");
}
$version = explode(' ', $ver_string);

View file

@ -7,15 +7,15 @@ if (!extension_loaded("sqlsrv")) {
die("skip Extension not loaded");
}
$is_win = ( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' );
$is_win = (strtoupper(substr(php_uname('s'),0,3)) === 'WIN');
require_once( "MsSetup.inc" );
require_once("MsSetup.inc");
$connectionInfo = array( "UID"=>$userName, "PWD"=>$userPassword );
$connectionInfo = array("UID"=>$userName, "PWD"=>$userPassword, "Driver" => $driver);
$conn = sqlsrv_connect( $server, $connectionInfo );
$conn = sqlsrv_connect($server, $connectionInfo);
if ($conn === false) {
die( "skip Could not connect during SKIPIF." );
die("skip Could not connect during SKIPIF.");
}
$msodbcsql_ver = sqlsrv_client_info($conn)["DriverVer"];
@ -35,9 +35,9 @@ if (!$is_win) {
// Get SQL Server version
// Exclude this check if running on Azure
if (!$daasMode) {
$stmt = sqlsrv_query( $conn, "SELECT @@VERSION" );
$stmt = sqlsrv_query($conn, "SELECT @@VERSION");
if (sqlsrv_fetch($stmt)) {
$ver_string = sqlsrv_get_field( $stmt, 0 );
$ver_string = sqlsrv_get_field($stmt, 0);
} else {
die("skip Could not fetch SQL Server version.");
}