Commit 96b7a7fb authored by Marco Pivetta's avatar Marco Pivetta

Merge branch 'hotfix/sqlite-offset-with-no-limit-support-2.4-backport' into 2.4

parents 1f34a074 55813bd4
...@@ -595,6 +595,18 @@ class SqlitePlatform extends AbstractPlatform ...@@ -595,6 +595,18 @@ class SqlitePlatform extends AbstractPlatform
return $sql; return $sql;
} }
/**
* {@inheritDoc}
*/
protected function doModifyLimitQuery($query, $limit, $offset)
{
if (null === $limit && null !== $offset) {
return $query . ' LIMIT -1 OFFSET ' . $offset;
}
return parent::doModifyLimitQuery($query, $limit, $offset);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
......
...@@ -142,6 +142,12 @@ class SqlitePlatformTest extends AbstractPlatformTestCase ...@@ -142,6 +142,12 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
$this->assertEquals('SELECT * FROM user LIMIT 10', $sql); $this->assertEquals('SELECT * FROM user LIMIT 10', $sql);
} }
public function testModifyLimitQueryWithOffsetAndEmptyLimit()
{
$sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10);
$this->assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql);
}
public function getGenerateAlterTableSql() public function getGenerateAlterTableSql()
{ {
return array( return array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment