File tree Expand file tree Collapse file tree 5 files changed +29
-19
lines changed Expand file tree Collapse file tree 5 files changed +29
-19
lines changed Original file line number Diff line number Diff line change 11# Upgrade to 3.0
22
3+ ## BC BREAK ` Statement::rowCount() ` is moved.
4+
5+ ` Statement::rowCount() ` has been moved to the ` ResultStatement ` interface where it belongs by definition.
6+
37## BC BREAK Transaction-related ` Statement ` methods return ` void ` .
48
59` Statement::beginTransaction() ` , ` ::commit() ` and ` ::rollBack() ` no longer return a boolean value. They will throw a ` DriverException ` in case of failure.
@@ -61,7 +65,7 @@ The following classes have been removed:
6165
6266 * ` Doctrine\DBAL\Platforms\SQLAnywhere11Platform `
6367 * ` Doctrine\DBAL\Platforms\SQLAnywhere12Platform `
64- * ` Doctrine\DBAL\Platforms\SQLAnywhere16Platform `
68+ * ` Doctrine\DBAL\Platforms\SQLAnywhere16Platform `
6569 * ` Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords `
6670 * ` Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords `
6771 * ` Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords `
@@ -215,7 +219,7 @@ This method now throws SPL ``UnexpectedValueException`` instead of accidentally
215219
216220## Doctrine\DBAL\Connection::TRANSACTION_ * constants deprecated
217221
218- `` Doctrine\DBAL\Connection::TRANSACTION_* `` were moved into `` Doctrine\DBAL\TransactionIsolationLevel `` class without the `` TRANSACTION_ `` prefix.
222+ `` Doctrine\DBAL\Connection::TRANSACTION_* `` were moved into `` Doctrine\DBAL\TransactionIsolationLevel `` class without the `` TRANSACTION_ `` prefix.
219223
220224## DEPRECATION: direct usage of the PDO APIs in the DBAL API
221225
Original file line number Diff line number Diff line change @@ -57,6 +57,18 @@ public function columnCount()
5757 return $ this ->columnCount ;
5858 }
5959
60+ /**
61+ * {@inheritdoc}
62+ */
63+ public function rowCount () : int
64+ {
65+ if ($ this ->data === null ) {
66+ return 0 ;
67+ }
68+
69+ return count ($ this ->data );
70+ }
71+
6072 /**
6173 * {@inheritdoc}
6274 */
Original file line number Diff line number Diff line change 66use Doctrine \Common \Cache \Cache ;
77use Doctrine \DBAL \DBALException ;
88use Doctrine \DBAL \Driver \ResultStatement ;
9- use Doctrine \DBAL \Driver \Statement ;
109use Doctrine \DBAL \FetchMode ;
1110use InvalidArgumentException ;
1211use IteratorAggregate ;
1312use function array_key_exists ;
1413use function array_merge ;
1514use function array_values ;
16- use function assert ;
1715use function count ;
1816use function reset ;
1917
@@ -206,8 +204,6 @@ public function fetchColumn($columnIndex = 0)
206204 */
207205 public function rowCount () : int
208206 {
209- assert ($ this ->statement instanceof Statement);
210-
211207 return $ this ->statement ->rowCount ();
212208 }
213209}
Original file line number Diff line number Diff line change @@ -25,6 +25,17 @@ public function closeCursor();
2525 */
2626 public function columnCount ();
2727
28+ /**
29+ * Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
30+ * executed by the corresponding object.
31+ *
32+ * If the last SQL statement executed by the associated Statement object was a SELECT statement,
33+ * some databases may return the number of rows returned by that statement. However,
34+ * this behaviour is not guaranteed for all databases and should not be
35+ * relied on for portable applications.
36+ */
37+ public function rowCount () : int ;
38+
2839 /**
2940 * Sets the fetch mode to use while iterating this statement.
3041 *
Original file line number Diff line number Diff line change @@ -88,17 +88,4 @@ public function errorInfo();
8888 * @return bool TRUE on success or FALSE on failure.
8989 */
9090 public function execute ($ params = null );
91-
92- /**
93- * Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
94- * executed by the corresponding object.
95- *
96- * If the last SQL statement executed by the associated Statement object was a SELECT statement,
97- * some databases may return the number of rows returned by that statement. However,
98- * this behaviour is not guaranteed for all databases and should not be
99- * relied on for portable applications.
100- *
101- * @return int The number of rows.
102- */
103- public function rowCount () : int ;
10491}
You can’t perform that action at this time.
0 commit comments