Subject Re: [IBO] recordcount.. more used than i thought
Author Dennis Fantoni
I searched the entire project for use of recordcount. To my surprise the
former developer has used it quite consistently in several different
situations. 63 occourences in total. I'll have to deal with all of them

The project i'm converting is about 150.000 lines in total. i think 100.000
lines are our standard library and other libraries, 50.000 lines are unique
for the project itself.

I think it looks like it should be a priority to get recordcount to work as
the BDE worked. I know it might not be extremely easy to make a fast
recordcunt, especially if the query is complicated. lots of my recordcounts
are on queries that is simply "Select * from tablename" or select * from
tablename where (field=:param) and tablename has a unique not null field
that is primary key. In that case you could do a select count (keyfieldname)
from tablename (or whatever the interbase syntax is) to get the number fast.
So maby your recordcount implementation should try to look at the query.text
and figure out if a shortcut fast count is possible.

Btw. we bot the full source ibo yesterday. It's nice to get rid of the popup
message ;-)

Dennis Fantoni

C/S Developer ( Delphi & Interbase ) at Danasoft A/S -

----- Original Message -----
From: "Dennis Fantoni" <df@...>
To: <>
Sent: Wednesday, November 29, 2000 11: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
> that had a procedure..
> 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
> 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
> 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
> 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
> something.
> still, sometimes it is nice to show to the user, the number of records
> 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 -