Subject RecordCount problem with TIBODataset
Author Jason Wharton
Here is the code that resets the flag for the cursor record count being
valid or not in regard to the changing of an input parameter value. It is a
little mired by having the RefreshOnParamChange being set to false, which is
the case for the TDataset compatible components. Because this is false it
did not reset this flag at the time the value had changed and nothing was
triggered later on (closing and reopening) when the parameter change did
actually have an effect on the records returned to the dataset.

In order to make this work the way it should, I need to make it so that it
will delay the setting of the flag until the dataset is closed. Then, when
the dataset is opened again (and the new input parameters will take effect)
the record count flag needs to indicate that a new select needs to be
executed if another call to RecordCount takes place.

The code below contains what should work fine as a temporary fix to this
problem.

This is from the include file: IBA_Dataset.IMP around line # 400.

procedure TIB_Dataset.SysAfterParamsDataChange( Sender: TIB_Row;
AField: TIB_Column );
begin
inherited SysAfterParamsDataChange( Sender, AField );
FParamWasChanged := true;
try
if RefreshOnParamChange or ( MasterDataChangeLevel > 0 ) then
begin
if Active and not IsPosting and not NeedToPost then
begin
if Fetching then
AbortFetching;
RefreshKeys;
end;
// Line below used to be here and was missed if RefreshOnParamChange was
false.
end;
// Moved here so that it would always get flagged and reset the need for the
count to change.
FCursorRecordCountValid := false;
finally
FParamWasChanged := false;
end;
end;

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