Commit db927005 authored by catch's avatar catch
Browse files

Issue #3186999 by alexpott, neclimdul, longwave: Make the version a private class property

(cherry picked from commit 702514c1)
parent cce00b6b
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -65,6 +65,15 @@ class Connection extends DatabaseConnection {
   */
  protected $needsCleanup = FALSE;

  /**
   * Stores the server version after it has been retrieved from the database.
   *
   * @var string
   *
   * @see \Drupal\Core\Database\Driver\mysql\Connection::version
   */
  private $serverVersion;

  /**
   * The minimal possible value for the max_allowed_packet setting of MySQL.
   *
@@ -290,11 +299,10 @@ protected function getMariaDbVersionMatch(): ?string {
   *   The PDO server version.
   */
  protected function getServerVersion(): string {
    static $server_version;
    if (!$server_version) {
      $server_version = $this->connection->query('SELECT VERSION()')->fetchColumn();
    if (!$this->serverVersion) {
      $this->serverVersion = $this->connection->query('SELECT VERSION()')->fetchColumn();
    }
    return $server_version;
    return $this->serverVersion;
  }

  public function databaseType() {
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
 *
 * @coversDefaultClass \Drupal\Core\Database\Driver\mysql\Connection
 * @group Database
 * @runTestsInSeparateProcesses
 */
class ConnectionTest extends UnitTestCase {