• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Resultset display

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i m begineer i need an idea from u for displaying resultset in terms of 10 records so that there must be prev and next buttons so that i can access previous or next records relative to the present records and number of records /total no.of records.pls respond to me regards
[ February 27, 2006: Message edited by: rai talari ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, this is a common situation and there are a number of solutions.

1) Get rows by numbers. For the first page do your query, take rows 1..10. For the second page, repeat the same query, take rows 11..20. Your database may support syntax that lets you select only "n" rows or even select them by row number. May not get consistent results if other people add and remove rows while you're looking at a page.

2) Get rows by keys. Select the first page. To get the second page select rows with keys higher than row 10. Can't go backwards. May not be consistent.

3) Get all the data and keep it. Copy all rows from the result set into some collection and keep it on the session. You can navigate around the collection by row numbers. May eat up tons of memory for data that is never used. Gets out of date if others add/remove rows.

4) Get all the keys and keep them. Copy all the primary keys from the result set into a collection and keep it. Retrieve the rows you need by the primary keys. Much smaller in memory than #3. Gets out of date.

5) Keep an open cursor on the session. I don't know much about this one, but it sounds expensive.

Any other ideas? Make out a little matrix of the pros and cons for each of these and see if any suit your application. Let us know what you come up with!!
reply
    Bookmark Topic Watch Topic
  • New Topic