Subject Re: [firebird-support] .recordCountAll
Author Helen Borrie
At 01:07 11/09/2008, you wrote:
>Hi All--
>
>I've got a really simple question....
>
>In my old (now converted) BDE app, I used to use .RecordCount a ton
>to do things like loop through the entire returned query.
>
>In FB using IBO, tIBOQuery.RecordCount is not accurate.

Correct, it is a legacy from TDataset, which was designed for Paradox tables. It doesn't belong in a client/server application.


>Is it better to use tIBOQuery.RecordCountAll (ie. is it reliable
>each and everytime) OR tIBOQuery.RecordCountAccurate := True and
>then, .RecordCount?
>
>If I go with .RecordCountAccurate, does that effect performance at
>all when I don't need the .RecordCount?
>
>.RecordCountAll would be easiest as it's a search/replace
>with .RecordCount.

These questions belong in the IBO list, not here. As a brief answer, RecordCountAccurate is a hack that performs a select count(*) every time it is referenced. It is a performance killer and intended only to "hold the place" while you are redeveloping your converted application code to work effectively with Firebird or IB. Repeat, record counts do not have a role in client/server apps.

In short, do not use the record count as the basis for looping operations. If you must perform client-side loops at all then use a WHILE NOT dataset.EOF loop. But plan to get rid of these loops altogether. You have a database engine that does this work robustly and atomically.

Also have a read of this, if you haven't already:
http://www.ibobjects.com/TechInfo.html#ti_Moving_to_CS

./heLen