You've basically got two choices:
1) Read through the RecordSet and count the number of records the
query would return and then re-execute the query a second time to
create the RecordSet for actual processing. To the best of my
knowledge the RecordSet returned from MySQL is forward-only; hence the
need to run the query twice.
or
2) Execute the query "Select count(*) from table..." the first time to
let MySQL return the count of the records it would process. and then
Execute a second query to return the records themselves.
The problem with either of these approaches is that if the table has a
lot of activity : adds and/or deletes, then by running two seperate
queries there is a potential that the number of records in Query1
doesn't match the number of records in Query2.
On Thu, 31 Mar 2005 12:07:00 -0500, Steve Suranie <ssuranie at merion dot com>
wrote:
> Is there an easy way or even a hard way to get the recordcount of a MySQL
> db in rb?
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
>
--
Regards,
Mike Bierly
mbierly at gmail dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|