Skip to content

Commit

Permalink
Fixes #12002 and #12030 - azure fallback to "select @@Version" (#12551)
Browse files Browse the repository at this point in the history
* Fixes #12002 and #12030 - azure fallback to "select @@Version"

* Add comment for why @@Version is used instead of going through the connection object.
  • Loading branch information
robocoder authored and mattab committed Apr 23, 2018
1 parent 12f4519 commit 718eb0e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/Db/Adapter/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ public function checkServerVersion()
}
}

/**
* Returns the MySQL server version
*
* @return null|string
*/
public function getServerVersion()
{
// prioritizing SELECT @@VERSION in case the connection version string is incorrect (which can
// occur on Azure)
$versionInfo = $this->fetchAll('SELECT @@VERSION');

if (count($versionInfo)) {
return $versionInfo[0]['@@VERSION'];
}

return parent::getServerVersion();
}

/**
* Check client version compatibility against database server
*
Expand Down
18 changes: 18 additions & 0 deletions core/Db/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ public function checkServerVersion()
}
}

/**
* Returns the MySQL server version
*
* @return null|string
*/
public function getServerVersion()
{
// prioritizing SELECT @@VERSION in case the connection version string is incorrect (which can
// occur on Azure)
$versionInfo = $this->fetchAll('SELECT @@VERSION');

if (count($versionInfo)) {
return $versionInfo[0]['@@VERSION'];
}

return parent::getServerVersion();
}

/**
* Check client version compatibility against database server
*
Expand Down

0 comments on commit 718eb0e

Please sign in to comment.