From 012849fad93b5f3e3b492b3bc2b364ec9eff271b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 13 May 2010 21:52:57 +0000 Subject: [PATCH] BUGFIX Fixed version not coming back from SQL Server, as it needs to be casted first --- code/MSSQLDatabaseConfigurationHelper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/MSSQLDatabaseConfigurationHelper.php b/code/MSSQLDatabaseConfigurationHelper.php index f3f5b33..f75ebb6 100644 --- a/code/MSSQLDatabaseConfigurationHelper.php +++ b/code/MSSQLDatabaseConfigurationHelper.php @@ -112,19 +112,19 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper { // Get the version using SERVERPROPERTY() function if(function_exists('mssql_connect')) { $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); } else { $conn = @sqlsrv_connect($databaseConfig['server'], array( 'UID' => $databaseConfig['username'], '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); } if($row && isset($row[0])) { - $version = $row[0]; + $version = trim($row[0]); } if($version) {