XmlContainer::getDocument

APIRef

#include <DbXml.hpp>

XmlDocument XmlContainer::getDocument(DbTxn *txnid, u_int32_t id, u_int32_t flags);

Description

The XmlContainer::getDocument method returns the document identified by the id parameter.

If the operation is to be transaction-protected, the txnid parameter is a transaction handle returned from DbEnv::txn_begin; otherwise, NULL.

The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:

DB_DIRTY_READ
Read modified but not yet committed data. Silently ignored if the DB_DIRTY_READ flag was not specified when the underlying XmlContainer was opened.

DB_RMW
Acquire write locks instead of read locks when doing the retrieval. Setting this flag can eliminate deadlock during a read-modify-write cycle by acquiring the write lock during the read part of the cycle so that another thread of control acquiring a read lock for the same item, in its own read-modify-write cycle, will not result in deadlock.

Because the XmlContainer::getDocument interface will not hold locks across Berkeley DB interface calls in non-transactional environments, the DB_RMW flag to the XmlContainer::getDocument call is meaningful only in the presence of transactions.

If the specified document is not in the container, the XmlContainer::getDocument method will return DB_NOTFOUND. Otherwise, the XmlContainer::getDocument method throws an exception that encapsulates a non-zero error value on failure.

Errors

If the operation was selected to resolve a deadlock, the XmlContainer::getDocument method will fail and throw a DbDeadlockException exception.

The XmlContainer::getDocument method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the XmlContainer::getDocument method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

XmlContainer, XmlDocument, XmlQueryContext

See Also

XmlContainer::close, XmlContainer::declareIndex, XmlContainer::deleteDocument, XmlContainer::getDocument, XmlContainer::getName, XmlContainer::open, XmlContainer::putDocument and XmlContainer::queryWithXPath.

XmlDocument::getAttributeValue, XmlDocument::getContent, XmlDocument::getID, XmlDocument::getName, XmlDocument::getType, XmlDocument::setContent, XmlDocument::setName, and XmlDocument::setType.

APIRef

Copyright Sleepycat Software