Rename forward-compatible ResultStatement interfaces to Result

parent ecff8519
# Upgrade to 2.11
## Deprecated `ResultStatement` interface
The `ResultStatement` interface is deprecated. Use the `Driver\Result` and `Abstraction\Result` interfaces instead.
## Deprecated `FetchMode` and the corresponding methods
1. The `FetchMode` class and the `setFetchMode()` method of the `Connection` and `Statement` interfaces are deprecated.
2. The `Statement::fetch()` method is deprecated in favor of `fetchNumeric()`, `fetchAssociative()` and `fetchOne()`.
3. The `Statement::fetchAll()` method is deprecated in favor of `fetchAllNumeric()`, `fetchAllAssociative()` and `fetchFirstColumn()`.
4. The `Statement::fetchColumn()` method is deprecated in favor of `fetchOne()`.
2. The `Statement::fetch()` method is deprecated in favor of `Result::fetchNumeric()`, `::fetchAssociative()` and `::fetchOne()`.
3. The `Statement::fetchAll()` method is deprecated in favor of `Result::fetchAllNumeric()`, `::fetchAllAssociative()` and `::fetchFirstColumn()`.
4. The `Statement::fetchColumn()` method is deprecated in favor of `Result::fetchOne()`.
5. The `Connection::fetchArray()` and `fetchAssoc()` method are deprecated in favor of `fetchNumeric()` and `fetchAssociative()` respectively.
6. The `StatementIterator` class and the usage of a `Statement` object as `Traversable` is deprecated in favor of `iterateNumeric()`, `iterateAssociative()` and `iterateColumn()`.
6. The `StatementIterator` class and the usage of a `Statement` object as `Traversable` is deprecated in favor of `Result::iterateNumeric()`, `::iterateAssociative()` and `::iterateColumn()`.
7. Fetching data in mixed mode (`FetchMode::MIXED`) is deprecated.
## Deprecated `Connection::project()`
......
......@@ -2,16 +2,17 @@
declare(strict_types=1);
namespace Doctrine\DBAL\ForwardCompatibility;
namespace Doctrine\DBAL\Abstraction;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as BaseResultStatement;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Traversable;
/**
* Forward compatibility extension for the DBAL ResultStatement interface.
* Abstraction-level result statement execution result. Provides additional methods on top
* of the driver-level interface.
*/
interface ResultStatement extends BaseResultStatement
interface Result extends DriverResult
{
/**
* Returns an iterator over the result set rows represented as numeric arrays.
......
......@@ -4,9 +4,9 @@ namespace Doctrine\DBAL\Cache;
use ArrayIterator;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use InvalidArgumentException;
use IteratorAggregate;
use PDO;
......@@ -16,7 +16,7 @@ use function array_values;
use function count;
use function reset;
class ArrayStatement implements IteratorAggregate, ResultStatement, ForwardCompatibleResultStatement
class ArrayStatement implements IteratorAggregate, ResultStatement, Result
{
/** @var mixed[] */
private $data;
......
......@@ -6,10 +6,10 @@ use ArrayIterator;
use Doctrine\Common\Cache\Cache;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use InvalidArgumentException;
use IteratorAggregate;
use PDO;
......@@ -33,7 +33,7 @@ use function reset;
* Also you have to realize that the cache will load the whole result into memory at once to ensure 2.
* This means that the memory usage for cached results might increase by using this feature.
*/
class ResultCacheStatement implements IteratorAggregate, ResultStatement, ForwardCompatibleResultStatement
class ResultCacheStatement implements IteratorAggregate, ResultStatement, Result
{
/** @var Cache */
private $resultCache;
......@@ -234,7 +234,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement, Forwar
*/
public function fetchAllNumeric(): array
{
if ($this->statement instanceof ForwardCompatibleResultStatement) {
if ($this->statement instanceof Result) {
$data = $this->statement->fetchAllAssociative();
} else {
$data = $this->statement->fetchAll(FetchMode::ASSOCIATIVE);
......@@ -250,7 +250,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement, Forwar
*/
public function fetchAllAssociative(): array
{
if ($this->statement instanceof ForwardCompatibleResultStatement) {
if ($this->statement instanceof Result) {
$data = $this->statement->fetchAllAssociative();
} else {
$data = $this->statement->fetchAll(FetchMode::ASSOCIATIVE);
......@@ -298,7 +298,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement, Forwar
$this->data = [];
}
if ($this->statement instanceof ForwardCompatibleResultStatement) {
if ($this->statement instanceof Result) {
$row = $this->statement->fetchAssociative();
} else {
$row = $this->statement->fetch(FetchMode::ASSOCIATIVE);
......
......@@ -4,6 +4,7 @@ namespace Doctrine\DBAL;
use Closure;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Abstraction\Result;
use Doctrine\DBAL\Cache\ArrayStatement;
use Doctrine\DBAL\Cache\CacheException;
use Doctrine\DBAL\Cache\QueryCacheProfile;
......@@ -14,7 +15,6 @@ use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Doctrine\DBAL\ForwardCompatibility\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
use Doctrine\DBAL\Query\QueryBuilder;
......@@ -616,7 +616,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchAssociative();
}
......@@ -643,7 +643,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchNumeric();
}
......@@ -670,7 +670,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchOne();
}
......@@ -956,7 +956,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchAllNumeric();
}
......@@ -982,7 +982,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchAllAssociative();
}
......@@ -1008,7 +1008,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchFirstColumn();
}
......@@ -1034,7 +1034,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
yield from $stmt->iterateNumeric();
} else {
while (($row = $stmt->fetch(FetchMode::NUMERIC)) !== false) {
......@@ -1062,7 +1062,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
yield from $stmt->iterateAssociative();
} else {
while (($row = $stmt->fetch(FetchMode::ASSOCIATIVE)) !== false) {
......@@ -1090,7 +1090,7 @@ class Connection implements DriverConnection
try {
$stmt = $this->executeQuery($query, $params, $types);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
yield from $stmt->iterateColumn();
} else {
while (($value = $stmt->fetch(FetchMode::COLUMN)) !== false) {
......
......@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement;
/**
* @internal
*/
......@@ -16,9 +14,9 @@ final class FetchUtils
*
* @throws DriverException
*/
public static function fetchOne(ResultStatement $stmt)
public static function fetchOne(Result $result)
{
$row = $stmt->fetchNumeric();
$row = $result->fetchNumeric();
if ($row === false) {
return false;
......@@ -32,11 +30,11 @@ final class FetchUtils
*
* @throws DriverException
*/
public static function fetchAllNumeric(ResultStatement $stmt): array
public static function fetchAllNumeric(Result $result): array
{
$rows = [];
while (($row = $stmt->fetchNumeric()) !== false) {
while (($row = $result->fetchNumeric()) !== false) {
$rows[] = $row;
}
......@@ -48,11 +46,11 @@ final class FetchUtils
*
* @throws DriverException
*/
public static function fetchAllAssociative(ResultStatement $stmt): array
public static function fetchAllAssociative(Result $result): array
{
$rows = [];
while (($row = $stmt->fetchAssociative()) !== false) {
while (($row = $result->fetchAssociative()) !== false) {
$rows[] = $row;
}
......@@ -64,11 +62,11 @@ final class FetchUtils
*
* @throws DriverException
*/
public static function fetchFirstColumn(ResultStatement $stmt): array
public static function fetchFirstColumn(Result $result): array
{
$rows = [];
while (($row = $stmt->fetchOne()) !== false) {
while (($row = $result->fetchOne()) !== false) {
$rows[] = $row;
}
......
......@@ -3,10 +3,10 @@
namespace Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use IteratorAggregate;
use PDO;
......@@ -50,7 +50,7 @@ use const DB2_LONG;
use const DB2_PARAM_FILE;
use const DB2_PARAM_IN;
class DB2Statement implements IteratorAggregate, Statement, ForwardCompatibleResultStatement
class DB2Statement implements IteratorAggregate, Statement, Result
{
/** @var resource */
private $stmt;
......
......@@ -3,11 +3,11 @@
namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use IteratorAggregate;
use mysqli;
......@@ -27,7 +27,7 @@ use function is_resource;
use function sprintf;
use function str_repeat;
class MysqliStatement implements IteratorAggregate, Statement, ForwardCompatibleResultStatement
class MysqliStatement implements IteratorAggregate, Statement, Result
{
/** @var string[] */
protected static $_paramTypeMap = [
......
......@@ -3,10 +3,10 @@
namespace Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use InvalidArgumentException;
use IteratorAggregate;
......@@ -51,7 +51,7 @@ use const SQLT_CHR;
/**
* The OCI8 implementation of the Statement interface.
*/
class OCI8Statement implements IteratorAggregate, Statement, ForwardCompatibleResultStatement
class OCI8Statement implements IteratorAggregate, Statement, Result
{
/** @var resource */
protected $_dbh;
......
......@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\ParameterType;
use PDO;
......@@ -36,7 +36,7 @@ class Connection extends PDOConnection
$stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?');
$stmt->execute([$name]);
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchOne();
}
......
......@@ -3,7 +3,6 @@
namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use PDO;
......@@ -20,7 +19,7 @@ use const E_USER_DEPRECATED;
* The PDO implementation of the Statement interface.
* Used by all PDO-based drivers.
*/
class PDOStatement extends \PDOStatement implements Statement, ForwardCompatibleResultStatement
class PDOStatement extends \PDOStatement implements Statement, Result
{
private const PARAM_TYPE_MAP = [
ParameterType::NULL => PDO::PARAM_NULL,
......
......@@ -2,18 +2,17 @@
declare(strict_types=1);
namespace Doctrine\DBAL\ForwardCompatibility\Driver;
namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\ResultStatement as BaseResultStatement;
/**
* Forward compatibility extension for the ResultStatement interface.
* Driver-level result statement execution result.
*/
interface ResultStatement extends BaseResultStatement
interface Result extends BaseResultStatement
{
/**
* Returns the next row of a result set as a numeric array or FALSE if there are no more rows.
* Returns the next row of the result as a numeric array or FALSE if there are no more rows.
*
* @return array<int,mixed>|false
*
......@@ -22,7 +21,7 @@ interface ResultStatement extends BaseResultStatement
public function fetchNumeric();
/**
* Returns the next row of a result set as an associative array or FALSE if there are no more rows.
* Returns the next row of the result as an associative array or FALSE if there are no more rows.
*
* @return array<string,mixed>|false
*
......@@ -31,7 +30,7 @@ interface ResultStatement extends BaseResultStatement
public function fetchAssociative();
/**
* Returns the first value of the next row of a result set or FALSE if there are no more rows.
* Returns the first value of the next row of the result or FALSE if there are no more rows.
*
* @return mixed|false
*
......@@ -40,7 +39,7 @@ interface ResultStatement extends BaseResultStatement
public function fetchOne();
/**
* Returns an array containing all of the result set rows represented as numeric arrays.
* Returns an array containing all of the result rows represented as numeric arrays.
*
* @return array<int,array<int,mixed>>
*
......@@ -49,7 +48,7 @@ interface ResultStatement extends BaseResultStatement
public function fetchAllNumeric(): array;
/**
* Returns an array containing all of the result set rows represented as associative arrays.
* Returns an array containing all of the result rows represented as associative arrays.
*
* @return array<int,array<string,mixed>>
*
......@@ -58,7 +57,7 @@ interface ResultStatement extends BaseResultStatement
public function fetchAllAssociative(): array;
/**
* Returns an array containing the values of the first column of the result set.
* Returns an array containing the values of the first column of the result.
*
* @return array<int,mixed>
*
......
......@@ -3,8 +3,8 @@
namespace Doctrine\DBAL\Driver\SQLAnywhere;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use function assert;
......@@ -129,7 +129,7 @@ class SQLAnywhereConnection implements Connection, ServerInfoAwareConnection
{
$stmt = $this->query("SELECT PROPERTY('ProductVersion')");
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
$version = $stmt->fetchOne();
} else {
$version = $stmt->fetchColumn();
......@@ -151,7 +151,7 @@ class SQLAnywhereConnection implements Connection, ServerInfoAwareConnection
$stmt = $this->query('SELECT ' . $name . '.CURRVAL');
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchOne();
}
......
......@@ -4,10 +4,10 @@ namespace Doctrine\DBAL\Driver\SQLAnywhere;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use IteratorAggregate;
use PDO;
......@@ -44,7 +44,7 @@ use const SASQL_BOTH;
/**
* SAP SQL Anywhere implementation of the Statement interface.
*/
class SQLAnywhereStatement implements IteratorAggregate, Statement, ForwardCompatibleResultStatement
class SQLAnywhereStatement implements IteratorAggregate, Statement, Result
{
/** @var resource The connection resource. */
private $conn;
......
......@@ -3,8 +3,8 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use function func_get_args;
......@@ -144,7 +144,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
$stmt = $this->query('SELECT @@IDENTITY');
}
if ($stmt instanceof ForwardCompatibleResultStatement) {
if ($stmt instanceof Result) {
return $stmt->fetchOne();
}
......
......@@ -3,10 +3,10 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\FetchUtils;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use IteratorAggregate;
use PDO;
......@@ -42,7 +42,7 @@ use const SQLSRV_PARAM_IN;
/**
* SQL Server Statement.
*/
class SQLSrvStatement implements IteratorAggregate, Statement, ForwardCompatibleResultStatement
class SQLSrvStatement implements IteratorAggregate, Statement, Result
{
/**
* The SQLSRV Resource.
......
......@@ -2,11 +2,11 @@
namespace Doctrine\DBAL\Portability;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\Driver\StatementIterator;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ForwardCompatibility\Driver\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\ParameterType;
use IteratorAggregate;
use PDO;
......@@ -19,7 +19,7 @@ use function rtrim;
/**
* Portability wrapper for a Statement.
*/
class Statement implements IteratorAggregate, DriverStatement, ForwardCompatibleResultStatement
class Statement implements IteratorAggregate, DriverStatement, Result
{
/** @var int */
private $portability;
......@@ -185,7 +185,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchNumeric()
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$row = $this->stmt->fetchNumeric();
} else {
$row = $this->stmt->fetch(FetchMode::NUMERIC);
......@@ -199,7 +199,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchAssociative()
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$row = $this->stmt->fetchAssociative();
} else {
$row = $this->stmt->fetch(FetchMode::ASSOCIATIVE);
......@@ -213,7 +213,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchOne()
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$value = $this->stmt->fetchOne();
} else {
$value = $this->stmt->fetch(FetchMode::COLUMN);
......@@ -233,7 +233,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchAllNumeric(): array
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$data = $this->stmt->fetchAllNumeric();
} else {
$data = $this->stmt->fetchAll(FetchMode::NUMERIC);
......@@ -247,7 +247,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchAllAssociative(): array
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$data = $this->stmt->fetchAllAssociative();
} else {
$data = $this->stmt->fetchAll(FetchMode::ASSOCIATIVE);
......@@ -261,7 +261,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
*/
public function fetchFirstColumn(): array
{
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
$data = $this->stmt->fetchFirstColumn();
} else {
$data = $this->stmt->fetchAll(FetchMode::COLUMN);
......
......@@ -2,9 +2,9 @@
namespace Doctrine\DBAL;
use Doctrine\DBAL\Abstraction\Result;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\ForwardCompatibility\ResultStatement as ForwardCompatibleResultStatement;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use IteratorAggregate;
......@@ -19,7 +19,7 @@ use function is_string;
* A thin wrapper around a Doctrine\DBAL\Driver\Statement that adds support
* for logging, DBAL mapping types, etc.
*/
class Statement implements IteratorAggregate, DriverStatement, ForwardCompatibleResultStatement
class Statement implements IteratorAggregate, DriverStatement, Result
{
/**
* The SQL statement.
......@@ -289,7 +289,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchNumeric()
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchNumeric();
}
......@@ -307,7 +307,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchAssociative()
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchAssociative();
}
......@@ -325,7 +325,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchOne()
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchOne();
}
......@@ -343,7 +343,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchAllNumeric(): array
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchAllNumeric();
}
......@@ -361,7 +361,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchAllAssociative(): array
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchAllAssociative();
}
......@@ -379,7 +379,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function fetchFirstColumn(): array
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
return $this->stmt->fetchFirstColumn();
}
......@@ -399,7 +399,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function iterateNumeric(): Traversable
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
while (($row = $this->stmt->fetchNumeric()) !== false) {
yield $row;
}
......@@ -423,7 +423,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function iterateAssociative(): Traversable
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
while (($row = $this->stmt->fetchAssociative()) !== false) {
yield $row;
}
......@@ -447,7 +447,7 @@ class Statement implements IteratorAggregate, DriverStatement, ForwardCompatible
public function iterateColumn(): Traversable
{
try {
if ($this->stmt instanceof ForwardCompatibleResultStatement) {
if ($this->stmt instanceof Result) {
while (($value = $this->stmt->fetchOne()) !== false) {
yield $value;
}
......
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