Subject | IBO 3.6 (probably also IBO4): PSReset question |
---|---|
Author | Jeroen W. Pluimers (mailings) |
Post date | 2001-08-30T07:44:51Z |
This is the current implementation of TIBODataSet.PSReset:
procedure TIBODataSet.PSReset;
begin
inherited PSReset;
if Active then
begin
Close;
Open;
end;
end;
I'm wondering why it is implemented like this, and if there could be an
implementation that does not perform a Close/Open.
The reason has to do with a TClientDataSet and TDataSetProvider bound to a
TIBODataSet:
The TDataSourceProvider to bound to a TIBODataSet.
The TClientDataSet is bound to the TDataSetProvider.
An obvious way to Open/Close the TClientDataSet is in the
AfterOpen/BeforeClose events of the TIBODataSet.
This causes the following sequence of events:
1. TIBODataSet is opened and calls the AfterOpen event.
2. The AfterOpen event tries to open the TClientDataSet
3. The TClientDataSet fetches the records through the TDataSetProvider
4. The TDataSetProvider fetches the data from the TIBODataSet
5. The TDataSetProvider finally calls IProviderSupport(DataSet).PSReset,
which in turn calls TIBODataSet.PSReset.
6. TIBODataSet.PSReset calls Close, and the BeforeClose event
7. The BeforeClose event calles TClientDataSet.Close
8. TIBODataSet.PSReset calls Open, and the AfterOpen event
9. we return at step 2 in an endless loop.
This TClientDataSet specific issue is about the only place where you can't
use AfterOpen/BeforeClose to manage depending datasets (it works fine with
master-detail relations and other dependencies), so I would appreciate if
PSReset could be reimplemented somehow.
--
Jeroen W. Pluimers
Consultant at All I M
http://www.all-im.com
procedure TIBODataSet.PSReset;
begin
inherited PSReset;
if Active then
begin
Close;
Open;
end;
end;
I'm wondering why it is implemented like this, and if there could be an
implementation that does not perform a Close/Open.
The reason has to do with a TClientDataSet and TDataSetProvider bound to a
TIBODataSet:
The TDataSourceProvider to bound to a TIBODataSet.
The TClientDataSet is bound to the TDataSetProvider.
An obvious way to Open/Close the TClientDataSet is in the
AfterOpen/BeforeClose events of the TIBODataSet.
This causes the following sequence of events:
1. TIBODataSet is opened and calls the AfterOpen event.
2. The AfterOpen event tries to open the TClientDataSet
3. The TClientDataSet fetches the records through the TDataSetProvider
4. The TDataSetProvider fetches the data from the TIBODataSet
5. The TDataSetProvider finally calls IProviderSupport(DataSet).PSReset,
which in turn calls TIBODataSet.PSReset.
6. TIBODataSet.PSReset calls Close, and the BeforeClose event
7. The BeforeClose event calles TClientDataSet.Close
8. TIBODataSet.PSReset calls Open, and the AfterOpen event
9. we return at step 2 in an endless loop.
This TClientDataSet specific issue is about the only place where you can't
use AfterOpen/BeforeClose to manage depending datasets (it works fine with
master-detail relations and other dependencies), so I would appreciate if
PSReset could be reimplemented somehow.
--
Jeroen W. Pluimers
Consultant at All I M
http://www.all-im.com