From ea238c86b5cebb94dd40ff68a0d3f4e1e2c8e321 Mon Sep 17 00:00:00 2001 From: catalin Date: Fri, 21 Oct 2016 12:32:33 +0300 Subject: [PATCH 1/2] retrieve version from query. This is needed when you expecially when you get Dbal Connection from a laravel connection --- lib/Doctrine/DBAL/Connection.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index bc4348995b6..ebe727f4927 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -435,6 +435,15 @@ private function getDatabasePlatformVersion() return $this->_conn->getServerVersion(); } + if ($this->_conn instanceof \PDO) { + try { + return $this->_conn->query('select version()')->fetchColumn(); + } catch (\PDOException $e) { + //version query not supported + } + + + } // Unable to detect platform version. return null; } From 47495f0c62729e086ba81889949c26f0d9ca361a Mon Sep 17 00:00:00 2001 From: catalin Date: Mon, 24 Oct 2016 09:19:13 +0300 Subject: [PATCH 2/2] retrieve version from query. This is needed when a PDO connection is wrapped --- lib/Doctrine/DBAL/Connection.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index ebe727f4927..098c5d339e2 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -435,14 +435,12 @@ private function getDatabasePlatformVersion() return $this->_conn->getServerVersion(); } - if ($this->_conn instanceof \PDO) { + if ($this->_conn instanceof \PDO && $this->_conn->getAttribute(PDO::ATTR_DRIVER_NAME)==='mysql') { try { return $this->_conn->query('select version()')->fetchColumn(); } catch (\PDOException $e) { //version query not supported } - - } // Unable to detect platform version. return null;