Used to permit or prevent permanent updates, insertions, and deletions of data against the database server.
property AutoCommit: boolean;
Use the AutoCommit property to permit or prevent permanent updates, insertions, and deletions of data against the database server without explicit calls to Commit or Rollback methods.
Set AutoCommit to True to permit implicit call to Commit method after every database access. The default value is True.
Note: The AutoCommit property in TUniConnection globally specifies whether all queries to modify database are implicitly committed or not. When using the InterBase provider, TUniTable, TUniQuery, TUniStoredProc, TUniSQL and TUniLoader components have their own AutoCommit specific options. This allows them to selectively specify their implicit transaction committing behavior after each data modifying access. The AutoCommit specific option behaviour is described in the UniDAC and InterBase/Firebird article.
This procedure removes all records from Dept table and makes this change permanent.
procedure TForm1.DeleteClick(Sender: TObject); begin UniSQL.Connection := UniConnection; UniConnection.AutoCommit := False; UniSQL.SQL.Text := 'DELETE FROM Dept'; UniSQL.Execute; // delete all records, commit is not performed UniConnection.Rollback; // restore deleted records UniConnection.AutoCommit := True; UniSQL.SQL.Text := 'DELETE FROM Dept'; UniSQL.Execute; // delete all records, commit is performed UniConnection.Rollback; // couldn't restore deleted records end;