Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Re: Perl/DBI
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 1406 of 1496
Post > Topic >>

Re: Perl/DBI

by geekout@[EMAIL PROTECTED] (Tyler Gee) Jun 24, 2007 at 07:36 AM

------=_Part_143690_14502473.1182706569605
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 6/24/07, Shawn Hinchy <shawn@[EMAIL PROTECTED]
> wrote:
>
> Quoting Tyler Gee <geekout@[EMAIL PROTECTED]
>:
>
> > On 6/24/07, Shawn Hinchy <shawn@[EMAIL PROTECTED]
> 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?
> >
> >
> > If you are not interested in using the modules, it is not actually
that
> hard
> > to roll your own.  In the past I have done different things for total
> > counts, either two separate queries, one just a 'SELECT COUNT(*)' and
> the
> > other to actually fetch the data.  Depending on your data you might be
> able
> > to add the count into your data fetching query but probably not.
> >
> > Why do you not want to use the modules?
>
> Thank you Tyler, I hadn't though about just using select COUNT(*).
>
> I was shying away from using the modules because I knew that it wasn't
> too hard and I was afraid that I wouldn't find one that would do
> exactly what i wanted.  Then there is the concern that my needs will
> change in the future and I'll have to find and re-implement another
> module instead of just tweaking my own code.  Or maybe I just like to
> go through the pain on my own. :)
>
> I think two separate queries will work fine for me now, I just didn't
> want to have to load all the results for fear it would be a memory hog
> and slow things down since searches will be frequent.


One thing people sometimes do if they have a lot of rows (a whole lot) is
to
actually keep a separate table that stores the count and then you can just
select from that.  It is not recommended unless you really have a lot of
rows because it de-normalizes the database.  The count() should work fine
however.

Cheers,

Thanks,
>
> Shawn
>
> --------------------
> Shawn Michael Hinchy
> shawn@[EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: beginners-cgi-unsubscribe@[EMAIL PROTECTED]
> For additional commands, e-mail: beginners-cgi-help@[EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>


-- 
~Tyler

------=_Part_143690_14502473.1182706569605--
 




 7 Posts in Topic:
Perl/DBI
shawn@[EMAIL PROTECTED]   2007-06-24 12:31:13 
Re: Perl/DBI
geekout@[EMAIL PROTECTED]  2007-06-24 06:46:16 
Re: Perl/DBI
shawn@[EMAIL PROTECTED]   2007-06-24 13:07:07 
Re: Perl/DBI
geekout@[EMAIL PROTECTED]  2007-06-24 07:36:09 
Re: Perl/DBI
greg@[EMAIL PROTECTED] (  2007-06-24 10:22:09 
Re: Perl/DBI
tigger@[EMAIL PROTECTED]   2007-06-24 20:53:32 
Re: Perl/DBI
dbusby3@[EMAIL PROTECTED]  2007-07-24 10:46:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 11:08:53 CST 2008.