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 Apr 9, 2018
1 parent 43c6bd8 commit c78e0e5
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 @@ -113,7 +113,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;
use function strpos;
use function substr;
Expand All @@ -14,15 +15,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 @@ -52,4 +44,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 c78e0e5

Please sign in to comment.