zorba::Zorba

#include <zorba/zorba.h>

The Zorba class is the single point of access to the Zorba engine. There exists one instance of the Zorba class per process. It can be used to (1) create and compile queries, (2) create static contexts, (3) provides access to the XmlDataManager, (4) provides access to the ItemFactory, and (5) provides access to the PropertiesGlobal.

Public Static Functions

Zorba *

getInstance(void *store)

Gets the singleton instance of the Zorba object.

const Version &

version()

Get information about the used version of Zorba.

Public Functions

XQuery_t

compileQuery(const String &aQuery, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object.

XQuery_t

compileQuery(const String &aQuery, const StaticContext_t &aContext, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using a StaticContext.

XQuery_t

compileQuery(const String &aQuery, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints.

XQuery_t

compileQuery(const String &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

XQuery_t

compileQuery(std::istream &aQuery, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object.

XQuery_t

compileQuery(std::istream &aQuery, const StaticContext_t &aContext, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using a StaticContext.

XQuery_t

compileQuery(std::istream &aQuery, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints.

XQuery_t

compileQuery(std::istream &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

XQuery_t

createQuery(DiagnosticHandler *aDiagnosticHandler=0)=0

Creates an XQuery object.

StaticContext_t

createStaticContext(DiagnosticHandler *aDiagnosticHandler=0)=0

Creates a new StaticContext.

audit::Provider *

getAuditProvider()=0

Gets the singleton instance of Zorba's audit provider object.

ItemFactory *

getItemFactory()=0

Gets the singleton instance of the ItemFactory.

PropertiesGlobal *

getPropertiesGlobal()=0

Gets the singleton instance of Zorba's properties object.

XmlDataManager_t

getXmlDataManager()=0

Returns an XmlDataManager object.

void

shutdown()=0

Releases all resources aquired by the Zorba XQuery Engine.

~Zorba()

Destructor.

Public Static Functions

getInstance

Zorba * getInstance(void *store)

Gets the singleton instance of the Zorba object.

The Zorba object provides factory methods for creating and/or compiling XQuery objects, creating StaticContext objects, and accessing components as, for example, the ItemFactory or the XmlDataManager.The first time this function is called, the Zorba Engine is initialized. Thereby, it initializes all the libraries that are used in the system, i.e. ICU, libxml2, xerces, and libcurl.

Returns

Zorba the singleton Zorba object

version

const Version & version()

Get information about the used version of Zorba.

Returns

Version information about the used Zorba version.

Public Functions

compileQuery

XQuery_t compileQuery(const String &aQuery, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object.

This methods creates an XQuery object and compiles the query string passed to this method.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the query string for the new XQuery object.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(const String &aQuery, const StaticContext_t &aContext, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using a StaticContext.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation is done using the information contained in the StaticContext that is passed as parameter.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the query string for the new XQuery object.
aContext the StaticContext that contains information used for compiling the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(const String &aQuery, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation and optimization is done with respect to the given CompilerHints.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the query string for the new XQuery object.
aCompilerHints the CompilerHints used to compile the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(const String &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation and optimization is done with respect to the given CompilerHints. Moreover, compilation is done using the information contained in the StaticContext.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the query string for the new XQuery object.
aContext the StaticContext that contains information used for compiling the query.
aCompilerHints the CompilerHints used to compile the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(std::istream &aQuery, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the input stream providing the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(std::istream &aQuery, const StaticContext_t &aContext, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using a StaticContext.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation is done using the information contained in the StaticContext that is passed as parameter.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the input stream providing the query.
aContext the StaticContext that contains information used for compiling the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(std::istream &aQuery, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation and optimization is done with respect to the given CompilerHints.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the input stream providing the query.
aCompilerHints the CompilerHints used to compile the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

compileQuery

XQuery_t compileQuery(std::istream &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, DiagnosticHandler *aDiagnosticHandler=0)=0

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation and optimization is done with respect to the given CompilerHints. Moreover, compilation is done using the information contained in the StaticContext.Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aQuery the input stream providing the query.
aContext the StaticContext that contains information used for compiling the query.
aCompilerHints the CompilerHints used to compile the query.
aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created and compiled XQuery object.

createQuery

XQuery_t createQuery(DiagnosticHandler *aDiagnosticHandler=0)=0

Creates an XQuery object.

This methods creates an XQuery object without implicitliy assigning it a query. An object returned by this method can be compiled (see compileQuery).Optionally, this method takes an DiagnosticHandler as parameter. In the case an DiagnosticHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If no DiagnosticHandler is given, exceptions are thrown for each of these errors.

Parameters

aDiagnosticHandler the DiagnosticHandler to which errors should be reported.

Returns

XQuery the newly created XQuery object.

createStaticContext

StaticContext_t createStaticContext(DiagnosticHandler *aDiagnosticHandler=0)=0

Creates a new StaticContext.

The method returns a smart pointer to a new StaticContext object that can be used for compiling a query.

Parameters

aDiagnosticHandler the DiagnosticHandler to which errors should be reported. If not DiagnosticHandler is given, exceptions are thrown for each of these errors.

Returns

StaticContext_t a smart pointer to a new StaticContext object.

getAuditProvider

audit::Provider * getAuditProvider()=0

Gets the singleton instance of Zorba's audit provider object.

Returns

audit::Provider the singeleton instance of Zorba's audit provider.

getItemFactory

ItemFactory * getItemFactory()=0

Gets the singleton instance of the ItemFactory.

Returns

ItemFactory the singleton instance of the ItemFactory.

getPropertiesGlobal

PropertiesGlobal * getPropertiesGlobal()=0

Gets the singleton instance of Zorba's properties object.

Returns

zorba::Properties the singleton instance of Zorba's properties object.

getXmlDataManager

XmlDataManager_t getXmlDataManager()=0

Returns an XmlDataManager object.

shutdown

void shutdown()=0

Releases all resources aquired by the Zorba XQuery Engine.

Also releases resources aquired by the libraries used (i.e. icu, libxml2, xerces, libcurl).Before calling shutdown, all xquery objects, items, contexts, ... have to be closed or gone out of scope; otherwise this call may fail.After shutdown has been called, any calls to zorba are invalid.getInstance may be used to reinitialize the engine.

~Zorba

 ~Zorba()

Destructor.

The destructor is called during static deinitialization if getInstance has been called at least once before.