Project

General

Profile

Actions

Bug #78129

closed

Statement::rowCount not reliable for SELECT queries

Added by Oliver Hader about 8 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2016-10-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

see https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Statement.php#L127

... taken from the PHPdoc comment:

Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
executed by the corresponding object.

If the last SQL statement executed by the associated Statement object was a SELECT statement,
some databases may return the number of rows returned by that statement. However,
this behaviour is not guaranteed for all databases and should not be
relied on for portable applications.

In particular rowCount() on valid SELECT statements for SQLite as DBMS returns 0 when fetch() would retrieve existing records. Thus, using rowCount() should be avoided and replaced by proper COUNT statements instead - if required at all.


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #85228: Invalid count query in SuggestWizardDefaultReceiverClosedAlexander Stehlik2018-06-11

Actions
Related to TYPO3 Core - Bug #85359: BE-Pagebrowser brokenClosed2018-06-23

Actions
Related to TYPO3 Core - Bug #90231: Linkvalidator makes use of rowCount() and does not work with sqliteClosedDaniel Siepmann2020-01-28

Actions
Precedes TYPO3 Core - Bug #85743: An exception occurred if I click on ListClosed2016-10-032016-10-03

Actions
Actions

Also available in: Atom PDF