XmlManager::query |
![]() ![]() |
#include <DbXml.hpp>XmlResults XmlManager::query(const std::string &xquery, XmlQueryContext &context, u_int32_t flags = 0)
XmlResults XmlManager::query(XmlTransaction &txn, const std::string &xquery, XmlQueryContext &context, u_int32_t flags = 0)
Executes a query in the context of the XmlManager object. This method is the equivalent of calling XmlManager::prepare and then XmlQueryExpression::execute on the prepared query.
The scope of the query can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"
or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate contextItem object to XmlQueryExpression::execute.
Note that this method is suitable for performing one-off queries. If you want to execute a query more than once, you should use XmlManager::prepare to compile the expression, and then use XmlQueryExpression::execute to run it.
This method returns an XmlResults object. You then iterate over the results set contained in that object using XmlResults::next and XmlResults::previous.
For more information on querying containers and documents, see the Berkeley DB XML Getting Started Guide.
The XmlManager::query method may fail and throw XmlException, encapsulating one of the following non-zero errors:
![]() ![]() |
Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.