XmlManager::createTransaction
|
 |
#include <DbXml.hpp>
XmlTransaction XmlManager::createTransaction(DbTxn *toAdopt)
XmlTransaction XmlManager::createTransaction(u_int32_t flags = 0)
Description: XmlManager::createTransaction
The XmlManager::createTransaction method method creates a new
XmlTransaction object. If a DbTxn object is not
provided to this method, then a new transaction is begun (a
DbTxn object is instantiated and DbEnv::txn_begin is called).
If transactions were not initialized when this XmlManager object was
opened (that is, DB_INIT_TXN was not specified) then this method throws
an exception.
Parameters
- DbTxn
- If a DbTxn is passed to this method, the new
XmlTransaction is simply another handle for the DbTxn
object. In this case, if the XmlTransaction object is destroyed
or goes out of scope before XmlTransaction::commit or
XmlTransaction::abort are called, the state of the underlying
transaction is left unchanged. This allows a transaction to be
controlled external to its XmlTransaction object. If no
DbTxn is passed, and the XmlTransaction object is
destroyed or goes out of scope, the transaction is implicitly aborted.
- flags
- The flags parameter must be set to 0 or by bitwise inclusively OR'ing together one
or more of the following values:
- DB_DEGREE_2
- This transaction will have degree 2 isolation. This provides for cursor
stability but not repeatable reads. Data items which have been
previously read by this transaction may be deleted or modified by other
transactions before this transaction completes.
- DB_DIRTY_READ
- All read operations performed by the transaction may read modified but
not yet committed data. Silently ignored if the DB_DIRTY_READ
flag was not specified when the underlying database was opened.
- DB_TXN_NOSYNC
- Do not synchronously flush the log when this transaction commits or
prepares. This means the transaction will exhibit the ACI (atomic,
consistent, and isolated) properties, but not D (durable); that is,
database integrity will be maintained but it is possible that this
transaction may be undone during recovery.
This behavior may be set for a Berkeley DB environment using the
DbEnv::set_flags method. Any value specified to this method
overrides that setting.
- DB_TXN_NOWAIT
- If a lock is unavailable for any Berkeley DB operation performed in the context
of this transaction, cause the operation to
return DB_LOCK_DEADLOCK or throw a DbDeadlockException
immediately instead of blocking on the lock.
- DB_TXN_SYNC
- Synchronously flush the log when this transaction commits or prepares.
This means the transaction will exhibit all of the ACID (atomic,
consistent, isolated, and durable) properties.
This behavior is the default for Berkeley DB environments unless the
DB_TXN_NOSYNC flag was specified to the
DbEnv::set_flags method. Any value specified to this method
overrides that setting.
Errors
The XmlManager::createTransaction method
may fail and throw
XmlException,
encapsulating one of the following non-zero errors:
- INVALID_VALUE
- Cannot call XmlManager::createTransaction when transactions are not
initialized
- INVALID_VALUE
- XmlManager::createTransaction(DbTxn*) requires a valid DbTxn object
Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.