XmlQueryContext::setReturnType

APIRef

#include <DbXml.hpp>

void XmlQueryContext::setReturnType(ReturnType type);

Description

The XmlQueryContext::setReturnType method sets the query return type. The query can return candidate documents, result documents, or result values. A candidate document is a document that may match the XPath expression, a result document is a document that does match the XPath expression, and a result value is the result of executing the XPath expression against the result document.

For some expressions it might be known that the candidate set is in fact equivalent to the result set. For these expressions there is no need to pass the candidate documents through a filter to eliminate false positives. The query processor can detect some expressions of this nature, but not all. The user application may know better, or may want to do its own false positive elimination.

The type must be set to one of the following values:

XmlQueryContext::CandidateDocuments
Return documents that may match the XPath expression.

XmlQueryContext::ResultDocuments
Return documents that match the XPath expression.

XmlQueryContext::ResultValues
Project the XPath expression over the matching document.

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

Errors

The XmlQueryContext::setReturnType 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 XmlQueryContext::setReturnType 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 XmlQueryContext::setReturnType 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