jlcox
Member³
I am inserting new master/detail information from a user form. The master and detail queries are both set to use cached updates. Since the detail records must have a valid reference to the master's primary key, I set that value to 0 when initializing the form. When posting the information, I'm using this bit of code:
try
dm.OracleSession1.ApplyUpdates([dm.qryRequest], False);
except
dm.OracleSession1.Rollback;
raise;
end;
dm.OracleSession1.CommitUpdates([dm.qryRequest]);
The real primary key of the qryRequest (the master table) is generated by a trigger, so until the master is posted, the details can't know the real value. I'm handling this part through the OnApplyRecord event handler for the detail query, ie.,
if Action = 'I' then
qryReqItems['REQUEST_ID'] := qryRequest['REQUEST_ID'];
Applied := False;
So far this seems to work fine, except for one small problem. If I create a second request, the original information is still displayed, i.e., CommitUpdates doesn't clear the cache.
First question: Is my approach to the basic problem (setting bogus primary key, then generating a new one and updating the details as they are applied) a safe or recommended methodology?
Second: What have a probably failed to set properly to make the local cache evaporate?
try
dm.OracleSession1.ApplyUpdates([dm.qryRequest], False);
except
dm.OracleSession1.Rollback;
raise;
end;
dm.OracleSession1.CommitUpdates([dm.qryRequest]);
The real primary key of the qryRequest (the master table) is generated by a trigger, so until the master is posted, the details can't know the real value. I'm handling this part through the OnApplyRecord event handler for the detail query, ie.,
if Action = 'I' then
qryReqItems['REQUEST_ID'] := qryRequest['REQUEST_ID'];
Applied := False;
So far this seems to work fine, except for one small problem. If I create a second request, the original information is still displayed, i.e., CommitUpdates doesn't clear the cache.
First question: Is my approach to the basic problem (setting bogus primary key, then generating a new one and updating the details as they are applied) a safe or recommended methodology?
Second: What have a probably failed to set properly to make the local cache evaporate?