? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
7 Nov 2014

Related to #5010

Issue

PostgreSQL allows to have an OFFSET without a LIMIT in the database query. In MySQL the OFFSET has to follow a LIMIT.
Thus our JDatabaseQueryPostgresql class thus allows to clear the limit independant from the offset, while our other database classes clear both limit and offset together with one call to $query->clear('limit').
So far so good.
If you now use $query->clear( 'offset') it works as expected in PostgreSQL. But if you do the same in any other databases it will actually clear the full query since this case isn't defined and thus it uses the default case.

Solution

This PR adds the case offset to the JDatabaseQuery class so all databases will support that case and allow to clear the offset.

This PR also adds a ->clear('offset') to the JModelLegacy->_getListCount() method. For MySQL and other databases this will not change anything as the offset is already cleared with ->clear('limit') anyway. But it will fix the query for PostgreSQL and properly clear the offset there as well

Testing

Create a list/blog where you get pagination and make sure the total and pagination works as expected.
With MySql you should see no difference at all. With PostgreSQL it should work with the patch.

avatar Bakual Bakual - open - 7 Nov 2014
avatar jissues-bot jissues-bot - change - 7 Nov 2014
Labels Added: ?
avatar Humorlos
Humorlos - comment - 7 Nov 2014

Yes it works with PostgreSQL. Thank you.

avatar waader
waader - comment - 8 Nov 2014

@test Works with PostgreSQL and MySQL.

avatar Bakual
Bakual - comment - 8 Nov 2014

Merged, thanks for testing!

avatar Bakual Bakual - close - 8 Nov 2014
avatar Bakual Bakual - change - 8 Nov 2014
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-11-08 12:35:14

Add a Comment

Login with GitHub to post a comment