[FOLLOWUP][BUGFIX] Introduce exception for using offset without limit 75/48475/2
authorIan SEBBAGH <ianouf@gmail.com>
Tue, 7 Jun 2016 10:50:25 +0000 (12:50 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 7 Jun 2016 11:30:15 +0000 (13:30 +0200)
In Typo3DbBackend::createQueryCommandParametersFromStatementParts,
if an offset is defined, but no limit is, an LogicException is thrown.

SQL does not provide possibility to set offset without limit.
To retrieve all rows from a certain offset up to the end of the
result set, you can use some large number for the limit.
See: http://dev.mysql.com/doc/refman/5.7/en/select.html

Fix failing fonctionnal tests.

Resolves: #65789
Releases: master
Change-Id: I066725383422829ec89a1b2621e1fdbead3cf115
Reviewed-on: https://review.typo3.org/48475
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php

index cad2478..a422ebf 100644 (file)
@@ -90,6 +90,7 @@ class CountTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $query = $this->postRepository->createQuery();
 
+        $query->setLimit($this->numberOfRecordsInFixture+1);
         $query->setOffset(6);
 
         $this->assertSame(($this->numberOfRecordsInFixture - 6), $query->count());
@@ -102,6 +103,7 @@ class CountTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
     {
         $query = $this->postRepository->createQuery();
 
+        $query->setLimit($this->numberOfRecordsInFixture+1);
         $query->setOffset(($this->numberOfRecordsInFixture + 5));
 
         $this->assertSame(0, $query->count());