Print Thread
How to use ReadBuffer?
#325 02/21/00 11:14 AM
Joined: Feb 2000
Posts: 1
T
Member
OP Offline
Member
T
Joined: Feb 2000
Posts: 1
I would like to limit the number of records returned by a query and support "paging" through the result set similar to what you would expect on a search engine like..."records 26-50 of 250 displayed" with previous and next buttons. This is for a web application, so I am looking for both CGI and ISAPI solutions. Any examples or code snippets?

TIA,

Anthony

Re: How to use ReadBuffer?
#326 05/25/00 12:36 PM
Joined: Oct 1999
Posts: 10
Rotterdam, ZH, Netherlands
J
Member
Offline
Member
J
Joined: Oct 1999
Posts: 10
Rotterdam, ZH, Netherlands
To make a query return only the records you want, you want the query to look like this:

select COLUMN from TABLE where rowid in (
select rowid from TABLE where rownum <= :MAX
minus
select rowid from TABLE where rownum < :MIN)

The OracleQuery has 2 parameters:
:MAX Integer
:MIN Integer

:MAX is the upper limit of your query
:MIN is the lower limit of your query

So, if you want the records 25 to 45 you set the :MAX to 45
and the :MIN to 25 and execute the query.

To make it work like you want, you have to do the following.
(You need 2 buttons labeled 'Prev' and 'Next')
(The 'Next' button adds 10 to the :MIN and :MAX and excecute the query)
(The 'Prev' button substracts 10 from the :MIN and :MAX and execute the query)

1 Get the number of records in the table [Select count(rowid) from TABLE]
2 Set the :MAX to 10 and the :MIN to 1
3 Execute the query
4 For the next 10 records press the 'Next' button
5 For the previous 10 records press the 'Prev' button

You have to check if you have the first records to disable the 'Prev'
button and if you have the last records to disable the 'Next' button.
It doesn't crash, but simply don't give any records.

------------------
JohaViss


JohaViss

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.021s Queries: 13 (0.005s) Memory: 2.5010 MB (Peak: 3.0430 MB) Data Comp: Off Server Time: 2024-05-19 17:11:26 UTC
Valid HTML 5 and Valid CSS