commiting cached updates

marek

Member²
Hello,

How is it possible to commit cached updates without commiting session (session.commit) ?

Regards,
Marek
 
Yes, you can call TOracleSession.ApplyUpdates with the Commit parameter set to False. Now all updates are posted to the database, and you need to call TOracleSession.CommitUpdates or TOracleSession.CancelUpdates to end the transaction.

------------------
Marco Kalter
Allround Automations
 
OK, but seems like after TOracleSession.ApplyUpdates(..,false) updates still stay in cache. What does undocumented method TOracleDataSet.CommitUpdates ?
I wrote following procedure. Is it correct ?
procedure SaveUpd(ds: TOracleDataSet);
begin
with ds do try
if State in [dsInsert,dsEdit] then
Post;
if UpdatesPending then begin
Session.ApplyUpdates([ds],false);
ds.CommitUpdates;
end;
except on E:EOracleError do
begin CancelUpdates;
raise;
end;
end;
end;
 
You should not use TOracleDataSet.CommitUpdates. The following modified code should do the trick:
Code:
procedure SaveUpd(ds: TOracleDataSet);
begin
  with ds do
  try
    if State in [dsInsert,dsEdit] then Post;
    if UpdatesPending then
    begin
      Session.ApplyUpdates([ds],false);
      Session.CommitUpdates([ds]);
    end;
  except
    on E:Exception do
    begin
      Session.CancelUpdates([ds]);
      raise;
    end;
  end;
end;

------------------
Marco Kalter
Allround Automations
 
unfortunately, this is not solution:
Session.CommitUpdates() makes Session.Commit
frown.gif


I need the method to clear cache without Session.Commit !
I'm just transforming one BDE-based project and there TBDEDataSet component has a method CommitUpdates to clear the cached updates buffer.
 
Back
Top