[odb-users] Example of Pagination Required.

Kanwar Manish kanwarmanish at gmail.com
Thu Jan 12 09:23:43 EST 2012


Hi Boris

Let us say I am getting all the products currently available [5000
scanners] in stock under a category. All the 5000 products have a
unique ID [something like GUID]. But the user would be browsing the
results in a browser - 20 rows at a time. So we don't want to have the
entire 5000 result set coming back to the client/browser - only 20
rows. [5000 is an example count, it can be 10 times this count easily
in our scenario]

Also we will show user a page number for every consecutive set of 20
rows. So by clicking on 1st page link he sees records 1-20 and by
clicking on 10th page link - he sees records 181-200.

My guess is that probably a custom container might be required on
this. We can add an additional field - unique incremental long ID as
well to make this easier to achieve.

Regards
Kanwar

On Thu, Jan 12, 2012 at 7:34 PM, Boris Kolpackov
<boris at codesynthesis.com> wrote:
> Hi Kanwar,
>
> Kanwar Manish <kanwarmanish at gmail.com> writes:
>
>> Can someone please point me to an example of pagination using ODB? Or
>> how it can done using ODB?
>
> Can you be a bit more specific about what you are trying to achieve?
> Generally, however, this will be database-specific, so it will also
> be helpful to know which one you are using.
>
> One database-independent mechanism that you may find useful (again,
> hard to say without knowing more details about your use-case) are
> uncached query results. Essentially, when uncached results are
> used, each object is sent from the server as required instead of
> buffering the whole result set in the client's memory. This is
> not exactly pagination (since some resources, such as the connection
> as well as the table on the database, are still going to be blocked
> or locked for as long as you are iterating over the result) but it
> may be close enough. Uncached results are supported by all the
> databases ODB currently supports except PostgreSQL.
>
> Boris



More information about the odb-users mailing list