Project

General

Profile

Cursor, Pagination and DBO.

Added by Plug Gulp about 3 years ago

What is the best approach to support pagination at the backend? I want to return X number of rows as the user navigates through the pages. Two approaches are offset and cursor. What is the best approach when using DBO? How do I implement pagination at the backend? How is cursor defined using DBO?


Replies (2)

RE: Cursor, Pagination and DBO. - Added by Korneel Dumon about 3 years ago

I think Dbo abstracts cursor away. You can loop over results using a Dbo::collection. To implement pagination I would use offset() and limit() to return a collection of results for a specific page.

RE: Cursor, Pagination and DBO. - Added by Plug Gulp almost 3 years ago

@Korneel Dumon

I think Dbo abstracts cursor away.

I think it does. Otherwise the pagination will be very expensive operation.

@Korneel Dumon

To implement pagination I would use offset() and limit() to return a collection of results for a specific page.

offset and limit does not give the impression that there is cursor being used underneath in DBO.

Thank you for the help and suggestion on implementing pagination!

Just out of curiosity, are you Wim's brother? :)

    (1-2/2)