Bug #78129

Statement::rowCount not reliable for SELECT queries

Added by Oliver Hader over 4 years ago. Updated over 1 year 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

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
#1

Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#2

Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#3

Updated by Benni Mack over 4 years ago

  • Sprint Focus set to Stabilization Sprint
#4

Updated by Benni Mack over 4 years ago

  • Target version set to 8.4
#5

Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#6

Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#7

Updated by Benni Mack over 4 years ago

  • Target version changed from 8.4 to 8.5
#8

Updated by Morton Jonuschat over 4 years ago

  • Category changed from 999 to Database API (Doctrine DBAL)
#9

Updated by Benni Mack over 4 years ago

  • Target version changed from 8.5 to 8.6
#10

Updated by Benni Mack about 4 years ago

  • Target version changed from 8.6 to 8 LTS
#11

Updated by Christian Kuhn about 4 years ago

  • Target version deleted (8 LTS)
  • Sprint Focus deleted (Stabilization Sprint)
#12

Updated by Gerrit Code Review almost 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#13

Updated by Gerrit Code Review almost 3 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#14

Updated by Gerrit Code Review almost 3 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#15

Updated by Gerrit Code Review almost 3 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#16

Updated by Gerrit Code Review almost 3 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50083

#17

Updated by Susanne Moog almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#18

Updated by Alexander Stehlik almost 3 years ago

  • Related to Bug #85228: Invalid count query in SuggestWizardDefaultReceiver added
#19

Updated by Georg Ringer almost 3 years ago

  • Related to Bug #85359: BE-Pagebrowser broken added
#20

Updated by Stephan Großberndt almost 3 years ago

  • Precedes Bug #85743: An exception occurred if I click on List added
#21

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
#22

Updated by Daniel Siepmann over 1 year ago

  • Related to Bug #90231: Linkvalidator makes use of rowCount() and does not work with sqlite added
#23

Updated by Sybille Peters over 1 year ago

What is the status here? This issue is closed but it seems that rowCount() is still a problem with sqlite, see #90231

Also available in: Atom PDF