Skip to content

Commit

Permalink
Fixed build failure on SQL Server (pdo_sqlsrv)
Browse files Browse the repository at this point in the history
Use a wrapped PDO Statement instead of a custom class for `pdo_sqlsrv` since `PDOSqlsrv\Statement` doesn't extend `PDOStatement` anymore.
  • Loading branch information
morozov committed Mar 29, 2018
1 parent a23b29c commit fd275f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function requiresQueryForServerVersion()
* @param \PDOStatement $stmt
* @return PDOStatement
*/
private function createStatement(\PDOStatement $stmt) : PDOStatement
protected function createStatement(\PDOStatement $stmt) : PDOStatement
{
return new PDOStatement($stmt);
}
Expand Down
18 changes: 9 additions & 9 deletions lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Driver\PDOSqlsrv;

use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOStatement;
use Doctrine\DBAL\ParameterType;

/**
Expand All @@ -12,15 +13,6 @@
*/
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}
*/
Expand Down Expand Up @@ -50,4 +42,12 @@ public function quote($value, $type = ParameterType::STRING)

return $val;
}

/**
* {@inheritDoc}
*/
protected function createStatement(\PDOStatement $stmt) : PDOStatement
{
return new Statement($stmt);
}
}

0 comments on commit fd275f8

Please sign in to comment.