realbasic-nug
[Top] [All Lists]

Re: MySQl recordcount

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: MySQl recordcount
From: Michael Bierly <mbierly at gmail dot com>
Date: Thu, 31 Mar 2005 12:40:54 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=oiTHo0W9soBBzEvyF6ZiyGPW2VvOXa9qRGlJfqI/oaBCLYHsX8dBHiUwrYoekAhxQB5feiZRfWnNJRIZv4Drct5Fh/38ih3vLOa1dQa6hXU5bFOvKPjT1Q/xcqQYGYfaZ50WWr7BGPAEwqyt42OdXY5rI5xoCiTsJgrkA9ZrAo8=
References: <20050331161559 dot 08C2A811D58 at lists dot realsoftware dot com> <BE719864 dot 2899%ssuranie at Merion dot com>
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>

<Prev in Thread] Current Thread [Next in Thread>