Does TOraSession.AutoCommit overrides TOraQuery.AutoCommit ?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lior
Posts: 36
Joined: Mon 01 Aug 2011 07:11

Does TOraSession.AutoCommit overrides TOraQuery.AutoCommit ?

Post by lior » Sun 20 Nov 2011 08:48

Which Autocommit rules if TOraSession.AutoCommit=False and TOraQuery/TOraTable.AutoCommit=True ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 21 Nov 2011 09:01

Hello,

The TOraSession.AutoCommit property defines global behaviour for all DataSets connected to this TOraSession, the TOraQuery.AutoCommit property defines behaviour of the current DataSet. Below is a small example that demonstrates differences in behaviour depending on the values of these properties:

Code: Select all

   OraSQL.Session := OraSession;
   OraSession.AutoCommit := True;
   OraSQL.AutoCommit := False;
   OraSQL.SQL.Text := 'DELETE FROM TABLE';
   OraSQL.Execute;         // delete all records, commit is not performed
   OraSession.Rollback;// restore deleted records
   OraSession.AutoCommit := False;
   OraSQL.AutoCommit := True;
   OraSQL.SQL.Text := 'DELETE FROM TABLE';
   OraSQL.Execute;         // delete all records, commit is not performed
   OraSession.Rollback; // restore deleted records
   OraSession.AutoCommit := True;
   OraSQL.AutoCommit := True;
   OraSQL.SQL.Text := 'DELETE FROM TABLE';
   OraSQL.Execute;         // delete all records, commit is performed
   OraSession.Rollback; // couldn't restore deleted records

Post Reply