Skip to content

Commit

Permalink
Use adapter for when PDO instance is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
lcobucci committed May 10, 2019
1 parent 1d1b481 commit 8970af9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\Driver\WrappedPDOConnection;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
Expand Down Expand Up @@ -189,7 +190,7 @@ public function __construct(
$this->params = $params;

if (isset($params['pdo'])) {
$this->_conn = $params['pdo'];
$this->_conn = WrappedPDOConnection::fromInstance($params['pdo']);
$this->isConnected = true;
unset($this->params['pdo']);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Portability/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\ColumnCase;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\WrappedPDOConnection;
use PDO;
use const CASE_LOWER;
use const CASE_UPPER;
Expand Down Expand Up @@ -66,7 +67,7 @@ public function connect()
}

if (isset($params['fetch_case']) && $this->portability & self::PORTABILITY_FIX_CASE) {
if ($this->_conn instanceof PDOConnection) {
if ($this->_conn instanceof PDOConnection || $this->_conn instanceof WrappedPDOConnection) {
// make use of c-level support for case handling
$this->_conn->setAttribute(PDO::ATTR_CASE, $params['fetch_case']);
} else {
Expand Down

0 comments on commit 8970af9

Please sign in to comment.