Question: How to obtain a correct number of records in TpFIBDataSet?

Answer: FIBPlus works with the server at the level of SQL queries. The server does not return the record number to the client after the SELECT query, because all the records are retrieved one after another by the Fetch method. 
In practice we know the number of records fetched only when the server reports that there are no more records in the query result after the regular Fetch.
The simplest thing you can do to obtain the correct number of records in the TpFIBDataSet is to use the poFetchAll option. After opening the query you should check the RecordCount value (it will be correct) or to use the psAskRecordCount option. If psAskRecordCount = True, then after opening SelectSQL TpFIBDataSet will automatically execute a supplementary query "SELECT count(*)" in order to make the server report about the record number.
This mechanism does not guarantee correct work because the COUNT() use is restricted by InterBase/Firebird features.
Besides sometimes FIBPlus cannot convert the main query from SelectSQL (it can be very complex) into a simple query which will only get the record number.
Such a behaviour is common for any InterBase/Firebird library.

Preview text: 
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...


Our 911 dispatch center needed a program to monitor the status of equipment used in emergency situations. If one dispatcher modified the status of a piece of equipment, all the other dispatchers needed to see this change immediately. The most elegant way to implement this was by using Firebird Events to asynchronously notify all the users whenever a pertinent change had occurred at the database server. After failing to implement this myself using the Firebird API, I bought a copy of FIBPlus. I dropped a Database, EventAlert and ErrorHandler control into a C++ Builder DataModule and within minutes I had all the functionality I needed. I was able to complete the project quickly and the users are thrilled with the results because I gave them more features than they originally asked for. >>

Darryl Caillouet Programmer City of Little Rock
Download full versions and updates in your Personal Area