From cf14c61d50915e02df8bab750b3f1ef27e854a53 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 23 Sep 2020 12:15:09 -0700 Subject: [PATCH] Deprecated usage of Abstraction\Result as Driver\Result --- UPGRADE.md | 5 ++ lib/Doctrine/DBAL/Abstraction/Result.php | 78 ++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index 9eb98d764a3..4fd9ceee4c0 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,10 @@ # Upgrade to 2.11 +## Deprecated the usage of Abstraction\Result as Driver\Result + +The usage of the `Abstraction\Result` as a sub-type of the `Driver\Result` interface is deprecated. +The `Abstraction\Result` interface will not extend `Driver\Result` in DBAL 3.0. + ## Deprecated the functionality of dropping client connections when dropping a database The corresponding `getDisallowDatabaseConnectionsSQL()` and `getCloseActiveDatabaseConnectionsSQL` methods diff --git a/lib/Doctrine/DBAL/Abstraction/Result.php b/lib/Doctrine/DBAL/Abstraction/Result.php index 42ff3419e37..ef44ef60815 100644 --- a/lib/Doctrine/DBAL/Abstraction/Result.php +++ b/lib/Doctrine/DBAL/Abstraction/Result.php @@ -14,6 +14,60 @@ */ interface Result extends DriverResult { + /** + * Returns the next row of the result as a numeric array or FALSE if there are no more rows. + * + * @return array|false + * + * @throws Exception + */ + public function fetchNumeric(); + + /** + * Returns the next row of the result as an associative array or FALSE if there are no more rows. + * + * @return array|false + * + * @throws Exception + */ + public function fetchAssociative(); + + /** + * Returns the first value of the next row of the result or FALSE if there are no more rows. + * + * @return mixed|false + * + * @throws Exception + */ + public function fetchOne(); + + /** + * Returns an array containing all of the result rows represented as numeric arrays. + * + * @return array> + * + * @throws Exception + */ + public function fetchAllNumeric(): array; + + /** + * Returns an array containing all of the result rows represented as associative arrays. + * + * @return array> + * + * @throws Exception + */ + public function fetchAllAssociative(): array; + + /** + * Returns an array containing the values of the first column of the result. + * + * @return array + * + * @throws Exception + */ + public function fetchFirstColumn(): array; + /** * Returns an iterator over the result set rows represented as numeric arrays. * @@ -40,4 +94,28 @@ public function iterateAssociative(): Traversable; * @throws Exception */ public function iterateColumn(): Traversable; + + /** + * Returns the number of rows affected by the DELETE, INSERT, or UPDATE statement that produced the result. + * + * If the statement executed a SELECT query or a similar platform-specific SQL (e.g. DESCRIBE, SHOW, etc.), + * some database drivers may return the number of rows returned by that query. However, this behaviour + * is not guaranteed for all drivers and should not be relied on in portable applications. + * + * @return int The number of rows. + */ + public function rowCount(); + + /** + * Returns the number of columns in the result + * + * @return int The number of columns in the result. If the columns cannot be counted, + * this method must return 0. + */ + public function columnCount(); + + /** + * Discards the non-fetched portion of the result, enabling the originating statement to be executed again. + */ + public function free(): void; }