I am using TClientDataSet as a local dataset without a provider concept. After working with it, a method is called that should generate the corresponding SQL statements using the StatusFilter to allow changes (generate SQL mainly).
It looked easy initially after reading the documentation (set StatusFilter to [dsInsert] , process all SQL inserts, set StatusFilter to [dsModified] process all updates, the same with removal), but now after several tests it looks far from trivial, for example:
If I add an entry, then edit it: setting StatusFilter to [dsInserted] display it, but with the original data.
If I add an entry and then edit and then delete it: the entry also appears with StatusFilter set to [dsInserted] and [dsModified] .
And other similar situations.
1) I know that if I process all the inserts first, then all updates, and then everything deletes the database, will be updated in the correct state, but it looks far from this approach (generating useless sql statements).
2) I tried to access PRecInfo(ClientDataSet.ActiveBuffer + ClientDataSet.RecordSize).Attribute information PRecInfo(ClientDataSet.ActiveBuffer + ClientDataSet.RecordSize).Attribute (dsRecNew, dsRecOrg, etc.), but still cannot solve this logic.
3) I can program the logic to resolve it, for example, before processing and StatusFilter to [dsDeleted] , set StatusFilter to [dsDeleted] and localize by primary key if the record sees if it was deleted after that .. the same with the changes, before pasting, checking whether the record was updated after we paste sql into the updated version, etc., but it should be easier ..
¿Did someone try to solve this in an elegant and simple way? ¿Am I missing something? thanks