BUGFIX Fixed version not coming back from SQL Server, as it needs to be casted first

This commit is contained in:
Sean Harvey 2010-05-13 21:52:57 +00:00
parent 90e1e644c9
commit 012849fad9

View File

@ -112,19 +112,19 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
// Get the version using SERVERPROPERTY() function // Get the version using SERVERPROPERTY() function
if(function_exists('mssql_connect')) { if(function_exists('mssql_connect')) {
$conn = @mssql_connect($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], true); $conn = @mssql_connect($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], true);
$result = @mssql_query("SELECT SERVERPROPERTY('ProductVersion')", $conn); $result = @mssql_query("SELECT CONVERT(char(15), SERVERPROPERTY('ProductVersion'))", $conn);
$row = @mssql_fetch_array($result); $row = @mssql_fetch_array($result);
} else { } else {
$conn = @sqlsrv_connect($databaseConfig['server'], array( $conn = @sqlsrv_connect($databaseConfig['server'], array(
'UID' => $databaseConfig['username'], 'UID' => $databaseConfig['username'],
'PWD' => $databaseConfig['password'] 'PWD' => $databaseConfig['password']
)); ));
$result = @sqlsrv_query($conn, "SELECT SERVERPROPERTY('ProductVersion')"); $result = @sqlsrv_query($conn, "SELECT CONVERT(char(15), SERVERPROPERTY('ProductVersion'))");
$row = @sqlsrv_fetch_array($result); $row = @sqlsrv_fetch_array($result);
} }
if($row && isset($row[0])) { if($row && isset($row[0])) {
$version = $row[0]; $version = trim($row[0]);
} }
if($version) { if($version) {