Re: Perl/DBI

[email protected] (David Busby)
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
Shawn Hinchy wrote:
> Hello all,
> 
> I am getting to the point where I need to start thinking about doing 
> pagination for search results.
> 
> I did some searches and it looks like there are some pagination modules, 
> but I am not quite interested in going that route yet.  I am using a 
> handful of columns from the search so I do not think that retrieving all 
> results and then only showing a subset will be very efficient.  It also 
> looks like you can execute FOUND_ROWS() after doing your initial query 
> and it will give you the total results.  This is probably the best 
> route, but it is not easily implemented with the way I have set up my 
> functions.
> 
> Are there any other options that I have missed?  Suggestions?
> 
> Thanks,
> 
> Shawn
> 
> --------------------
> Shawn Michael Hinchy
> [email protected]

Shawn; I can only speak to Oracle but if your looking at counts be sure 
that you use it something like this.

Select * from (your real query here) where rownum >=lownum and rownum<= 
highnum or something of that nature where the lownum and highnum 
represents the beginning and end of rows you want to get.  Say you want 
to run the query get the first 5K rows.  You could write the low as 1 
and the high as 5000.  Use binds.  You could run your query first with 
something like select count(*) from (inner query) to return the total 
number of rows but you may just be wasting resources in that case.

Let me know if you have any further questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.