Skip to content

Commit c78e0e5

Browse files
committed
Fixed build failure on SQL Server (pdo_sqlsrv)
Use a wrapped PDO Statement instead of a custom class for `pdo_sqlsrv` since `PDOSqlsrv\Statement` doesn't extend `PDOStatement` anymore.
1 parent 43c6bd8 commit c78e0e5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/Doctrine/DBAL/Driver/PDOConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function requiresQueryForServerVersion()
113113
* @param \PDOStatement $stmt
114114
* @return PDOStatement
115115
*/
116-
private function createStatement(\PDOStatement $stmt) : PDOStatement
116+
protected function createStatement(\PDOStatement $stmt) : PDOStatement
117117
{
118118
return new PDOStatement($stmt);
119119
}

lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
44

55
use Doctrine\DBAL\Driver\PDOConnection;
6+
use Doctrine\DBAL\Driver\PDOStatement;
67
use Doctrine\DBAL\ParameterType;
78
use function strpos;
89
use function substr;
@@ -14,15 +15,6 @@
1415
*/
1516
class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection
1617
{
17-
/**
18-
* {@inheritdoc}
19-
*/
20-
public function __construct($dsn, $user = null, $password = null, array $options = null)
21-
{
22-
parent::__construct($dsn, $user, $password, $options);
23-
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
24-
}
25-
2618
/**
2719
* {@inheritDoc}
2820
*/
@@ -52,4 +44,12 @@ public function quote($value, $type = ParameterType::STRING)
5244

5345
return $val;
5446
}
47+
48+
/**
49+
* {@inheritDoc}
50+
*/
51+
protected function createStatement(\PDOStatement $stmt) : PDOStatement
52+
{
53+
return new Statement($stmt);
54+
}
5555
}

0 commit comments

Comments
 (0)