XmlTransaction::commit

#include <DbXml.hpp>

void XmlTransaction::commit(u_int32_t flags = 0)

The XmlTransaction::commit method ends the transaction. Container and document modifications made within the scope of the transaction are by default written to stable storage.

After XmlTransaction::commit has been called, regardless of its return, the XmlTransaction handle may not be accessed again. If XmlTransaction::commit encounters an error, the transaction and all child transactions of the transaction are aborted.

The XmlTransaction::commit method throws an exception that encapsulates a non-zero error value on failure.

Parameters

flags

This parameter must be set to 0 or one of the following values:

  • DB_TXN_NOSYNC

    Do not synchronously flush the log. This means the transaction will exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but it is possible that this transaction may be undone during recovery.

    This behavior may also be set for a Berkeley DB environment using the DbEnv::set_flags() method or for a single transaction using the XmlManager::createTransaction method. Any value specified to this method overrides both of those settings.

  • DB_TXN_SYNC

    Synchronously flush the log. This means the transaction will exhibit all of the ACID (atomicity, consistency, isolation, and durability) properties.

    This behavior is the default for Berkeley DB environments unless the DB_TXN_NOSYNC flag was specified to the DbEnv::set_flags() method. This behavior may also be set for a single transaction using the XmlManager::createTransaction method. Any value specified to this method overrides both of those settings.

Errors

The XmlTransaction::commit method may fail and throw XmlException , encapsulating one of the following non-zero errors:

TRANSACTION_ERROR

Cannot use XmlTransaction once committed or aborted.

DB_REP_LEASE_EXPIRED

You are using a replicated enviroment, the master lease is expired, and DBXML_IGNORE_LEASE is not enabled.

DB_RUNRECOVERY

You are using a replicated enviroment, the master lease is expired, and DBXML_IGNORE_LEASE is not enabled.

Class

XmlTransaction

See Also

XmlTransaction Methods