ENHANCEMENT Added MSSQLDatabaseConfigurationHelper::getDatabaseVersion()

This commit is contained in:
Sean Harvey 2010-05-26 05:11:14 +00:00
parent a0768ec44d
commit 5ad91ce0ed

View File

@ -98,15 +98,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
); );
} }
/** public function getDatabaseVersion($databaseConfig) {
* Ensure that the SQL Server version is at least 10.00.2531 (SQL Server 2008 SP1).
* @see http://www.sqlteam.com/article/sql-server-versions
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
*/
public function requireDatabaseVersion($databaseConfig) {
$success = false;
$error = '';
$version = 0; $version = 0;
// Get the version using SERVERPROPERTY() function // Get the version using SERVERPROPERTY() function
@ -127,6 +119,20 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper {
$version = trim($row[0]); $version = trim($row[0]);
} }
return $version;
}
/**
* Ensure that the SQL Server version is at least 10.00.2531 (SQL Server 2008 SP1).
* @see http://www.sqlteam.com/article/sql-server-versions
* @param array $databaseConfig Associative array of db configuration, e.g. "server", "username" etc
* @return array Result - e.g. array('success' => true, 'error' => 'details of error')
*/
public function requireDatabaseVersion($databaseConfig) {
$success = false;
$error = '';
$version = $this->getDatabaseVersion($databaseConfig);
if($version) { if($version) {
$success = version_compare($version, '10.00.2531', '>='); $success = version_compare($version, '10.00.2531', '>=');
if(!$success) { if(!$success) {