Note that there are some explanatory texts on larger screens.

plurals
  1. POTClientDataSet and processing records with StatusFilter
    primarykey
    data
    text
    <p>I'm using a <code>TClientDataSet</code> as a local dataset without the provider concept. After working with it a method is called that should generate the corresponding SQL statements using the <code>StatusFilter</code> to resolve the changes (generate SQL basically).</p> <p>This looked easy initially after reading documentation (set <code>StatusFilter to [dsInsert]</code>, process all inserts SQL, set <code>StatusFilter to [dsModified]</code> process all updates, the same with deletes) but after a few tests now looks far from trivial, for example:</p> <p>If I add a record, then edit it: setting the <code>StatusFilter to [dsInserted]</code> displays it, but with the original data.</p> <p>If I add a record, then edit, then delete it: the record appears with <code>StatusFilter set to [dsInserted] and [dsModified]</code> also.</p> <p>And other similar situations..</p> <p>1) I know that if first I process all inserts, then all updates then all deletes the database will be updated in the correct state but it looks far from right this approach (generating useless sql statements).</p> <p>2) I've tried to access the <code>PRecInfo(ClientDataSet.ActiveBuffer + ClientDataSet.RecordSize).Attribute</code> information (dsRecNew, dsRecOrg, etc.) but still not manage to resolve the logic.</p> <p>3) I can program the logic to resolve it, for example before processing and insert, set <code>StatusFilter to [dsDeleted]</code>, and locating by the primary key if the record to see if its deleted thereafter.. the same with edits, before inserting, checking if the record was updated after so the insert sql in the updated version and so on.. but it should be more easy..</p> <p>¿Did someone tried to solve this in an elegant and straightforward way? ¿I'm missing something? Thanks </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload