Subject Re: [IBO] recordcount..
Author Jason Wharton
IBO will do it that way if you set AutoFetchAll to true (which is what the
BDE does to accomplish record counts). Then, you are not dealing with a
count performed separately on the server but instead your query fetches all
the records into the buffer and then recordcount simply returns the count of
records fetched.

I need to add this into the conversion guide.

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Dennis Fantoni" <df@...>
To: <IBObjects@egroups.com>
Sent: Wednesday, November 29, 2000 3:48 AM
Subject: [IBO] recordcount..


> I found my first error coming from the conversion from BDE.
>
> I had a routine in a component (written by someone not working here
anymore)
> that had a procedure..
>
> query.open
> for n:=0 to query.recordcount-1 do begin
> read data
> end;
> query.close;
>
> This routine did not read all data in the query, bc. recordcount seems not
> to return the number of records that match a query's where clause.
>
> BDE would have returned the correct recordcout.
>
> But... the problem is of course that my former colleque used a very bad
> approach in the first place. What if someone deleted a record after you
read
> recordcount? you will read a deleted record, and will be relying on
> transactions to help you out.
>
> the correct way to read is
>
> dataset.first
> while not dataset.eof do begi
> read data
> dataset.next
> end;
>
> I suggest that ibobjects implemented recordcount to be the same as the BDE
> recordcount (that is - the total number of rows that this query would
fetch)
> and that we might get another property that gives us the number of records
> that are read into the query buffers right now. Call it clientrecordcount
or
> something.
>
> still, sometimes it is nice to show to the user, the number of records
that
> match a certain search criteria. A query.recordcount would be "nice to
> have".
>
> I think everyone who are converting projects should do a search on
> recordcount and fix the code where it is used. the code will most probably
> misbehave when running ibo instead of bde..
>
> A warning should also be added to the conversion document. (urge user to
> search entire project for "recordcount" and see to that other measures are
> used.
>
>
> Regards
> Dennis Fantoni
>
> dennis@...
> C/S Developer ( Delphi & Interbase ) at Danasoft A/S -
> http://www.danasoft.dk
>
>
>
>
>
>