Subject Re: [IBO] recordcount.. more used than i thought
Author Lucas Franzen
Dennis Fantoni schrieb:
>
> 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
> manually.

Using RecordCount to step through all records of a query is nonsense
anyway; using while not EOF is much more efficient. (using RecordCOunt
implies that ALL Records have to be fetched first; you can easily test
this: open up a table in IBO_WISQL; records are shown pretty quick - now
hit the RecordCount-button and if there are lots of records you'll
notice that it might take some time to get the result since all records
have to be fetched to be counted)

The only reason to use RecordCount is when you want to show a
ProgressBar to keep the users informed how much of their request is
completed (and I think this will take a big amount of process time
itself for all the messages bein processed).

So if the RecordCount isn't quite correct it isn't that big a problem
for that purpose...

Of course you could use a second query and get the result with 'select
count (*)' or 'select count (PRIMARY KEY FIELD)'.

Just another note:
when stepping through a TIB_Query with while not EOF it might be a good
idea to wrap that in construct like:

try
DisableControls;
while not EOF do ...
finally
EnableControls;
end;

to speed things up.

Regards
Luc.