Show/Hide Toolbars

TMS Aurelius Documentation

Navigation: Manipulating Objects

Transaction Usage

Scroll Prev Top Next More

You can use transactions when manipulating objects, so that you make sure all operations under the transaction are performed successfully (commit) or anything is reverted (rollback). Usage is simple and is done pretty much the same way you would do when accessing a database in a traditional way.


The transactions are started under the IDBConnection interface context. You can start a transaction using IDBConnection.BeginTransaction method, which will return a IDBTransaction interface. The IDBTransaction in turn has only two methods: Commit and Rollback.


uses {...}, Aurelius.Drivers.Interfaces;
  Transaction: IDBTransaction;
  Transaction := Manager.Connection.BeginTransaction;
    { Perform manager operations}


Transactions in Aurelius can be nested. This means that if a transaction was already started in IDBConnection but not commited or rolled back yet, creating a new transaction and commiting or rolling it back has no effect. For example:


OuterTransaction := Manager.Connection.BeginTransaction;
InnerTransaction := Manager.Connection.BeginTransaction;
InnerTransaction.Commit; // This has NO effect, the same for rollback.
OuterTransaction.Commit; // Commit (or Rollback) is effectively performed here