[BUGFIX] Ordering without grouping is incompatible with non-MySQL DBMS
authorIngo Pfennigstorf <i.pfennigstorf@gmail.com>
Sat, 8 Sep 2012 20:04:13 +0000 (22:04 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 20 Jan 2013 15:55:18 +0000 (16:55 +0100)
Each SELECT COUNT(*) statement has orderings. This fixes the
behaviour that is incompatible to database systems other than
MySQL and also is not needed as only an integer is returned.

Thanks to Xavier Perseguers for the patch.

Change-Id: I81a51dc6a7978434ef8e7751d7c72823e88fe550
Fixes: #25873
Releases: 1.3, 1.4, 4.7, 6.0
Reviewed-on: https://review.typo3.org/14461
Reviewed-by: Xavier Perseguers
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Xavier Perseguers
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

index 34d1f6d..82f70b8 100644 (file)
@@ -307,6 +307,8 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                        $count = $this->databaseHandle->sql_num_rows($result);
                } else {
                        $statementParts['fields'] = array('COUNT(*)');
+                       // having orderings without grouping is not compatible with non-MySQL DBMS
+                       $statementParts['orderings'] = array();
                        if (isset($statementParts['keywords']['distinct'])) {
                                unset($statementParts['keywords']['distinct']);
                                $statementParts['fields'] = array('COUNT(DISTINCT ' . reset($statementParts['tables']) . '.uid)');