mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX Fixed version not coming back from SQL Server, as it needs to be casted first
This commit is contained in:
parent
90e1e644c9
commit
012849fad9
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user