Page 1 of 1

Does TOraSession.AutoCommit overrides TOraQuery.AutoCommit ?

Posted: Sun 20 Nov 2011 08:48
by lior
Which Autocommit rules if TOraSession.AutoCommit=False and TOraQuery/TOraTable.AutoCommit=True ?

Posted: Mon 21 Nov 2011 09:01
by AlexP
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