Chapter 20.  XmlQueryContext

#include <DbXml.hpp>

class DbXml::XmlQueryContext {
public:
	XmlQueryContext();
	XmlQueryContext(const XmlQueryContext &);
	~XmlQueryContext();
	XmlQueryContext &operator = (const XmlQueryContext &)
	...
};

The XmlQueryContext class encapsulates the context within which a query is performed against an XmlContainer . The context includes namespace mappings, variable bindings, and flags that indicate how the query result set should be determined and returned to the caller. Multiple queries can be executed within the same XmlQueryContext; however, XmlQueryContext is not thread-safe, and can only be used by one thread at a time.

XmlQueryContext objects are instantiated using XmlManager::createQueryContext.

XmlQueryContext allows you to define whether queries executed within the context are to be evaluated lazily or eagerly, and whether the query is to return live or dead values. For detailed descriptions of these parameters see XmlQueryContext::setReturnType and XmlQueryContext::setEvaluationType. Note that these values are also set when you create a query context using XmlManager::createQueryContext.

The XQuery syntax permits expressions to refer to namespace prefixes, and to define them. The XmlQueryContext class provides namespace management methods so that the caller may manage the namespace prefix to URI mapping outside of a query. By default the prefix "dbxml" is defined to be "http://www.sleepycat.com/2002/dbxml".

The XQuery syntax also permits expressions to refer to externally defined variables. The XmlQueryContext class provides methods that allow the caller to manage the externally-declared variable to value bindings.

A copy constructor and assignment operator are provided for this class. The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body. This object is not thread-safe, and can only be safely used by one thread at a time in an application.

XmlQueryContext Methods