Skip to content

Commit fd275f8

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 a23b29c commit fd275f8

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
@@ -111,7 +111,7 @@ public function requiresQueryForServerVersion()
111111
* @param \PDOStatement $stmt
112112
* @return PDOStatement
113113
*/
114-
private function createStatement(\PDOStatement $stmt) : PDOStatement
114+
protected function createStatement(\PDOStatement $stmt) : PDOStatement
115115
{
116116
return new PDOStatement($stmt);
117117
}

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

89
/**
@@ -12,15 +13,6 @@
1213
*/
1314
class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection
1415
{
15-
/**
16-
* {@inheritdoc}
17-
*/
18-
public function __construct($dsn, $user = null, $password = null, array $options = null)
19-
{
20-
parent::__construct($dsn, $user, $password, $options);
21-
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
22-
}
23-
2416
/**
2517
* {@inheritDoc}
2618
*/
@@ -50,4 +42,12 @@ public function quote($value, $type = ParameterType::STRING)
5042

5143
return $val;
5244
}
45+
46+
/**
47+
* {@inheritDoc}
48+
*/
49+
protected function createStatement(\PDOStatement $stmt) : PDOStatement
50+
{
51+
return new Statement($stmt);
52+
}
5353
}

0 commit comments

Comments
 (0)