Permits or prevents permanent updates, insertions, and deletions of data associated with the current transaction against the database server.
property AutoCommit: boolean;
Use the AutoCommit property to permit or prevent permanent updates, insertions, and deletions of data associated with the current transaction against the database server without explicit calls to the Commit or Rollback methods.
Set AutoCommit to True to permit an implicit call to the Commit method after every database access.
The AutoCommit property in TPgQuery has lower priority than the same properties in TPgConnection components. Its default value is True.
This is an example of a procedure that removes all records from the Dept table and makes this change permanent.
procedure TForm1.DeleteClick(Sender: TObject); begin PgQuery.Session := OraSession; PgConnection.AutoCommit := True; PgQuery.AutoCommit := False; PgQuery.SQL.Text := 'DELETE FROM Dept'; PgQuery.Execute; // delete all records, commit is not performed PgConnection.Rollback;// restore deleted records PgConnection.AutoCommit := False; PgQuery.AutoCommit := True; PgQuery.SQL.Text := 'DELETE FROM Dept'; PgQuery.Execute; // delete all records, commit is not performed PgConnection.Rollback; // restore deleted records PgConnection.AutoCommit := True; PgQuery.AutoCommit := True; PgQuery.SQL.Text := 'DELETE FROM Dept'; PgQuery.Execute; // delete all records, commit is performed PgConnection.Rollback; // couldn't restore deleted records end;