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.
parent 6eea1423
...@@ -107,7 +107,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection ...@@ -107,7 +107,7 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
/** /**
* Creates a wrapped statement * Creates a wrapped statement
*/ */
private function createStatement(\PDOStatement $stmt) : PDOStatement protected function createStatement(\PDOStatement $stmt) : PDOStatement
{ {
return new PDOStatement($stmt); return new PDOStatement($stmt);
} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace Doctrine\DBAL\Driver\PDOSqlsrv; namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver\PDOConnection; use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOStatement;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use PDO;
use function strpos; use function strpos;
use function substr; use function substr;
...@@ -13,15 +13,6 @@ use function substr; ...@@ -13,15 +13,6 @@ use function substr;
*/ */
class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection
{ {
/**
* {@inheritdoc}
*/
public function __construct($dsn, $user = null, $password = null, ?array $options = null)
{
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
...@@ -51,4 +42,12 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti ...@@ -51,4 +42,12 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti
return $val; return $val;
} }
/**
* {@inheritDoc}
*/
protected function createStatement(\PDOStatement $stmt) : PDOStatement
{
return new Statement($stmt);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment