From f0b68587bc1602dc28c2fb58871a82b0fd0ceb96 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 11 Oct 2010 01:09:04 +0000 Subject: [PATCH] ENHANCEMENT Make use of mysql_get_server_info() when calling MSSQLDatabase::getVersion(), if there's a problem getting info this way, falls back to using query for VERSION() details git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@111850 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/MySQLDatabase.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index 428c57a00..658c0e34c 100755 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -100,7 +100,11 @@ class MySQLDatabase extends SS_Database { */ public function getVersion() { if(!$this->mysqlVersion) { - $this->mysqlVersion = (float)substr(trim(ereg_replace("([A-Za-z-])", "", $this->query("SELECT VERSION()")->value())), 0, 3); + $this->mysqlVersion = @mysql_get_server_info($this->dbConn); + // fallback to query if function doesn't give anything + if(!$this->mysqlVersion) { + $this->mysqlVersion = (float)substr(trim(ereg_replace("([A-Za-z-])", "", $this->query("SELECT VERSION()")->value())), 0, 3); + } } return $this->mysqlVersion; }