"Robert B. Easter" wrote:
> If someone has done it a better way, I'd like to hear how. However,
> sometimes it is possible to cache a count(*) value somewhere in the database
> so it doesn't have to be found everytime - it depends on your database and
> what the select is if you can store the count in advance somehow.
I don't know how it was implemented (source code is available), but the
PostgreSQL driver for AOLserver (a kick-butt web server for
database-backed websites) has a function that does that. All I do after
a SQL statement is:
set rowcount [ns_pg ntuples]
in my Tcl code and there it is. The driver is available at either
http://www.aolserver.com or http://www.openacs.org (the latter has a
more elaborate version of the driver).
-Roberto
--
Computer Science Utah State University
Space Dynamics Laboratory Web Developer
USU Free Software & GNU/Linux Club http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto