[Tutor] how best to implement paginated data in CLI

Alan Gauld alan.gauld at btinternet.com
Wed Sep 15 11:13:46 CEST 2010


"Rance Hall" <ranceh at gmail.com> wrote

> In reviewing the app I'm hoping to replace I found the size of the
> client list is under 100 records.
>
> Given this new information, do you still think that db cursors is 
> the way to go?

Using the cursor is a more scaleable solution but if you are sure you 
only
ever have 100 or so rows then I agree that sing a local client side 
windowing
scheme may be as effective.

Using the cursor should not be onerous however, it should look 
something
like:

configure cursor page size
for each page in cursor
      display screen
      process data

The only downside is, as you say that you are now dipping into the 
cursor
for every 10 records which would be a lot of network traffic. I'd 
expect the
"induistrial" solution to this to be something like

set cursor to 100 records (or even 1000 depending on size)
for each page in cursor
     for each screen in page
          display screen
          process data

So if you are sure you will only ever have about 100 records you can
omit the cursor paging.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list