Subject Re: [IBO] Cached Updates Bug Found and Fixed
Author Carlos H. Cantu
Jason, thanks for you efforts on this case. I will test the patches
in a few minutes.

FireBase -

JW> Thanks to the assistance of Carlos Cantu and a full day's work on this
JW> problem, I discovered that cached updates were not working in the
JW> TIBODataset components. Some of you knew that already but I was stubborn...
JW> shame shame shame on me.

JW> There was also a problem in regard to having cached updates in conjunction
JW> with master-detail relationships. It was showing the inserted detail
JW> records regardless of which master record was scrolled to rather than
JW> keeping it associated with the properly linked master record. Keep in mind
JW> all other component sets BDE, IBX, FIB, etc. silently cancel the updates in
JW> a detail dataset if the master scrolls.

JW> For this to work more perfectly I had to plumb in a new event that allows
JW> you to pass back a reference "var ShowRecord: boolean" to tell if the detail
JW> record belongs to the current master record or not.

JW> In the case of Carlos' app, here is what the events looked like:

JW> procedure TForm1.DetailCheckCachedInsert(ADataset: TDataSet;
JW> var ShowRecord: Boolean);
JW> begin
JW> ShowRecord := DetailID.AsInteger = MasterPK.AsInteger;
JW> end;

JW> Also notice the similarity here:

JW> procedure TForm1.DetailNewRecord(DataSet: TDataSet);
JW> begin
JW> DetailID.AsInteger := MasterPK.AsInteger;
JW> end;

JW> He was using a relationship between master and detail that I never could
JW> have guessed or parsed.

JW> I also made sure it worked together with calculated fields too, which was a
JW> bear.

JW> The main problem I cleared up was if you had exceptions during the applying
JW> of updates it was possible to have updates in the buffer get ignored the
JW> next time an attempt to apply the updates was made. It should be totally
JW> correct now.

JW> I'm very sorry I let a bug like this stand for as long as I did.

JW> Jason Wharton