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 (from r111850)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112930 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 05:01:50 +00:00
parent 1fc540c16b
commit 849bca4a3d

View File

@ -99,9 +99,13 @@ class MySQLDatabase extends SS_Database {
* @return float
*/
public function getVersion() {
if(!$this->mysqlVersion) {
$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;
}