diff --git a/src/Driver/PDO/SQLSrv/Connection.php b/src/Driver/PDO/SQLSrv/Connection.php index 1ab904bdbf9..0c34d4b9b8c 100644 --- a/src/Driver/PDO/SQLSrv/Connection.php +++ b/src/Driver/PDO/SQLSrv/Connection.php @@ -2,21 +2,21 @@ namespace Doctrine\DBAL\Driver\PDO\SQLSrv; +use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware; use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection; -use Doctrine\DBAL\Driver\Result; -use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as StatementInterface; -use Doctrine\DBAL\ParameterType; use Doctrine\Deprecations\Deprecation; use PDO; -final class Connection implements ServerInfoAwareConnection +final class Connection extends AbstractConnectionMiddleware { /** @var PDOConnection */ private $connection; public function __construct(PDOConnection $connection) { + parent::__construct($connection); + $this->connection = $connection; } @@ -27,31 +27,13 @@ public function prepare(string $sql): StatementInterface ); } - public function query(string $sql): Result - { - return $this->connection->query($sql); - } - - /** - * {@inheritDoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - return $this->connection->quote($value, $type); - } - - public function exec(string $sql): int - { - return $this->connection->exec($sql); - } - /** * {@inheritDoc} */ public function lastInsertId($name = null) { if ($name === null) { - return $this->connection->lastInsertId($name); + return parent::lastInsertId($name); } Deprecation::triggerIfCalledFromOutside( @@ -65,29 +47,6 @@ public function lastInsertId($name = null) ->fetchOne(); } - public function beginTransaction(): bool - { - return $this->connection->beginTransaction(); - } - - public function commit(): bool - { - return $this->connection->commit(); - } - - public function rollBack(): bool - { - return $this->connection->rollBack(); - } - - /** - * {@inheritDoc} - */ - public function getServerVersion() - { - return $this->connection->getServerVersion(); - } - public function getNativeConnection(): PDO { return $this->connection->getNativeConnection(); diff --git a/src/Driver/PDO/SQLSrv/Statement.php b/src/Driver/PDO/SQLSrv/Statement.php index 49957921c79..43b07a3ab12 100644 --- a/src/Driver/PDO/SQLSrv/Statement.php +++ b/src/Driver/PDO/SQLSrv/Statement.php @@ -2,16 +2,15 @@ namespace Doctrine\DBAL\Driver\PDO\SQLSrv; +use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware; use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement; -use Doctrine\DBAL\Driver\Result; -use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; use Doctrine\Deprecations\Deprecation; use PDO; use function func_num_args; -final class Statement implements StatementInterface +final class Statement extends AbstractStatementMiddleware { /** @var PDOStatement */ private $statement; @@ -21,6 +20,8 @@ final class Statement implements StatementInterface */ public function __construct(PDOStatement $statement) { + parent::__construct($statement); + $this->statement = $statement; } @@ -74,12 +75,4 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool { return $this->bindParam($param, $value, $type); } - - /** - * {@inheritdoc} - */ - public function execute($params = null): Result - { - return $this->statement->execute($params); - } }