XQuery

#include </home/jenkins/.jenkins/ubuntu-remote-queue/jenkins-BuildZorbaUbuntu-462/source/zorba/swig/XQuery.h>

This class is the representation of an XQuery in the Zorba engine. To compile and execute an XQuery, an instance of this class must be created. This is done by using either the createQuery or compileQuery methods of the Zorba class.

Private Attributes

bool

closed

zorba::XQuery_t

theQuery

Public Functions

void

compile(const std::string &aQuery)

Compile a query given as a String.

void

compile(const std::string &aQuery, StaticContext &aStaticContext)

Compile a query given as a String, using a given static context and compiler hints.

void

destroy()

/brief deletes this object from memory

std::string

execute()

Execute the query.

void

execute(ZorbaIOStream &stream)

Execute the query and write the result to the given output stream.

void

execute(ZorbaIOStream &stream, SerializationOptions &serOptions)

Execute the query and write the result to the given output stream.

std::string

execute(SerializationOptions &serOptions)

Execute the query.

DynamicContext

getDynamicContext()

Get the dynamic context of this query.

void

getExternalVariables(Iterator &vars) const

Returns the QName of all external variables.

StaticCollectionManager

getStaticCollectionManager()

Returns a CollectionManager responsible for all collections which are statically declared in the static context of this query (main module) or any transitively imported library module.

StaticContext

getStaticContext()

Get the static context of this query.

Iterator

iterator()

Get an iterator for the result of the query.

std::string

printPlanAsDOT()

Print the execution plan of this query to a given string.

std::string

printPlanAsXML()

Print the execution plan of this query to a given string.

XQuery()

XQuery(const XQuery &aXQuery)

XQuery(zorba::XQuery_t aQuery)

Private Attributes

closed

bool closed

theQuery

zorba::XQuery_t theQuery

Public Functions

compile

void compile(const std::string &aQuery)

Compile a query given as a String.

Parameters

aQuery the query String to compile.

Parameters

ZorbaException if the query has been closed, is already compiled, or an error occurs while compiling the query.

compile

void compile(const std::string &aQuery, StaticContext &aStaticContext)

Compile a query given as a String, using a given static context and compiler hints.

Parameters

aQuery the query String to compile.
aStaticContext the static context.

Parameters

ZorbaException if the query has been closed, is already compiled, or an error occurs while compiling the query.

destroy

void destroy()

/brief deletes this object from memory

execute

std::string execute()

Execute the query.

The query can be executed with this function. The query only has a result if it's a non-updating query.

Parameters

ZorbaException if an error occurs (e.g. the query is closed or has not been compiled or is not updating)

execute

void execute(ZorbaIOStream &stream)

Execute the query and write the result to the given output stream.

The query only has a result if it's a non-updating query.

Parameters

stream The output stream on which the result is written.

execute

void execute(ZorbaIOStream &stream, SerializationOptions &serOptions)

Execute the query and write the result to the given output stream.

The query only has a result if it's a non-updating query.

Parameters

stream The output stream on which the result is written.
serOptions The serialization options for this Query result

execute

std::string execute(SerializationOptions &serOptions)

Execute the query.

The query can be executed with this function. The query only has a result if it's a non-updating query.

Parameters

serOptions The serialization options for this Query result

Parameters

ZorbaException if an error occurs (e.g. the query is closed or has not been compiled or is not updating)

getDynamicContext

DynamicContext getDynamicContext()

Get the dynamic context of this query.

This function returns the dynamic context that belongs to this query and is used during query execution. The context can be used, for example, to set values of external variables, the default collation, or the current datetime. It is only available if the query has been compiled, otherwise an error is reported. Moreover, the context must not be modified during the execution of a query (i.e. if a Iterator is opened). The lifetime of the context returned by this function is restricted by the lifetime of the according query object.

Parameters

SystemException if the query has not been compiled or is closed.

Returns

DynamicContext of this query.

getExternalVariables

void getExternalVariables(Iterator &vars) const

Returns the QName of all external variables.

Parameters

vars iterator to store the results.

Parameters

ZorbaException if an error occured.

getStaticCollectionManager

StaticCollectionManager getStaticCollectionManager()

Returns a CollectionManager responsible for all collections which are statically declared in the static context of this query (main module) or any transitively imported library module.

The collection manager provides a set of functions for managing collections and their contents.

Returns

The collection manager responsible for managing collections of this query.

getStaticContext

StaticContext getStaticContext()

Get the static context of this query.

This function returns the static context that belongs to this query. The static context is only available if the query has been compiled, otherwise an error is reported. The context has all the components and values that were set in the static context that was passed when creating the query and those that were set in the prolog of the query. Note that after compilation of the query the static context is a read only structure. Moreover, the lifetime of the context returned by this function is restricted by the lifetime of the corresponding query object.

Parameters

SystemException if the query has not been compiled or is closed.

Returns

StaticContext of this query.

iterator

Iterator iterator()

Get an iterator for the result of the query.

Allows an application to lazily execute the query, retrieving the result one item at a time.

Returns

Iterator iterator over the result sequence.

Parameters

ZorbaException if an error occurs (e.g. the query is closed or has not been compiled).

printPlanAsDOT

std::string printPlanAsDOT()

Print the execution plan of this query to a given string.

Returns

A String with the output.

Parameters

ZorbaException if the query has been closed or is not compiled.

printPlanAsXML

std::string printPlanAsXML()

Print the execution plan of this query to a given string.

Returns

A String with the output.

Parameters

ZorbaException if the query has been closed or is not compiled.

XQuery

 XQuery()

XQuery

 XQuery(const XQuery &aXQuery)

XQuery

 XQuery(zorba::XQuery_t aQuery)