Berkeley DB: XmlContainer::queryWithXPath
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# XmlContainer::queryWithXPath |

`

###

    #include <DbXml.hpp>

    XmlResults
    XmlContainer::queryWithXPath(DbTxn *txnid,
        XPathExpression &expression, u_int32_t flags) const;

    XmlResults
    XmlContainer::queryWithXPath(DbTxn *txnid,
        const std::string &query, XmlQueryContext *context, u_int32_t flags);

# Description

Return the results of an XPath 1.0 version query against the container. In the first variant, expression is provided as the results of a call to the XmlContainer::parseXPathExpression method.

In the second variant, query is provided as a string (expected to be in the syntax defined in the W3C XPath 1.0 specification). In this case, the query may optionally be done within the execution context context, which describes how the query is to be performed. If no context is specified, the query will retrieve the set of XmlDocuments matching the XPath expression.

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.

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

# Errors

The XmlContainer::queryWithXPath method may fail and throw an exception encapsulating a non-zero error for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

The XmlContainer::queryWithXPath 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::queryWithXPath 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.

`

Copyright Sleepycat Software