From 5ad91ce0ed8022a8bff55ae393821f13496d7932 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 26 May 2010 05:11:14 +0000 Subject: [PATCH] ENHANCEMENT Added MSSQLDatabaseConfigurationHelper::getDatabaseVersion() --- code/MSSQLDatabaseConfigurationHelper.php | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/code/MSSQLDatabaseConfigurationHelper.php b/code/MSSQLDatabaseConfigurationHelper.php index f75ebb6..89fdf76 100644 --- a/code/MSSQLDatabaseConfigurationHelper.php +++ b/code/MSSQLDatabaseConfigurationHelper.php @@ -98,15 +98,7 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper { ); } - /** - * 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 = ''; + public function getDatabaseVersion($databaseConfig) { $version = 0; // Get the version using SERVERPROPERTY() function @@ -127,6 +119,20 @@ class MSSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper { $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) { $success = version_compare($version, '10.00.2531', '>='); if(!$success) {