company logo

ObjectSpace :: commitTransaction - Commit transaction

The function stores all changes made in the transaction to the higher transaction level. When terminating a transaction for a given transaction level transactions on lower levels are committed as well.

Committing a subordinated transaction will move modifications to the parent transaction. Committing the top transaction will write data to database and make it available to other processes.

The function throws an exception, when the transaction could not be stored because of an error. This may happen when a top transaction tries to write to the database or when the transaction has set an error within the transaction that does not allow storing the transaction. In this case, the transaction will be discarded ( rollBack() ) automatically.

Implementation overview

Implementation details

  1. Commit current transaction
    ObjectSpace  :: commitTransaction (  )

    The function commits the current (last recently started) transaction.

  2. to list
  3. Commit transaction at certain level
    ObjectSpace  :: commitTransaction ( int32 iTransactionLevel )

    The function commits the transaction on the transaction level passed in iTransactionLevel . The top transaction has got level 1 always, i.e. in order to commit the top transaction, 1 should be passed in iTransactionLevel .

    • iTransactionLevel - Transaction level

      The transaction level identifies a transaction within a hierarchy of nested transactions. The out most transaction starts with number 1.

  4. to list
  5. Versions and transactions
    ObjectSpace  :: commitTransaction ( bool bVersion )

    Creating versions within transactions is not possible. New versions for any kind of versioning scope have to be created outside transactions, since transactions cannot handle database entries of different versions. This is also the case when running databases with workspaces, which are considered as very long transactions. As long as a database entry is reserved within a workspace, versions for the database entry cannot be created.

    ... fragment (Property &person) {

      person.objectSpace.beginTransaction();

      // create, delete or update person instances

      person.objectSpace.commitTransaction(true); // create new version

    }

    • bVersion - - internal feature (not documented)
  6. to list