[TYPO3-mvc] QueryResult object has issues with offsets and "count" method ?
Bastian Waidelich
bastian.waidelich at typo3.org
Fri Nov 19 11:12:03 CET 2010
Franz Koch wrote:
Hi again,
> [...]I just noticed a issue with the QueryResult object in
> combination with it's count method. In combination with a defined offset
> by the repository, count will return NULL/FALSE.
I can't reproduce the result NULL/FALSE.. But I had a look at it and
there is indeed a logical issue with the QueryResult:
If you call count() on a QueryResult that has been initialized already
(by iterating through the result or calling the toArray() method) a
regular count() is executed on the array that contains the fetched objects.
If the Result has not been touched yet, count will actually execute a
COUNT(*) Query. That's nice, because you can count all objects before
retrieving only a subset from the Database.
The problem is: Count queries ignore the LIMIT constraint.
I'll have to check how we can fix this in a backwards compatible way..
@Xavier using MySqls SQL_CALC_FOUND_ROWS would most probably break dbal
support (even more). Correct?
Best,
Bastian
More information about the TYPO3-project-typo3v4mvc
mailing list