Public Member Functions | List of all members
XQuery Class Reference

This class is the representation of an XQuery in the Zorba engine. More...

Public Member 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)

Detailed Description

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.

Definition at line 27 of file XQuery.h.

Constructor & Destructor Documentation

XQuery::XQuery ( )
inline

Definition at line 34 of file XQuery.h.

XQuery::XQuery ( const XQuery aXQuery)
inline

Definition at line 35 of file XQuery.h.

XQuery::XQuery ( zorba::XQuery_t  aQuery)
inline

Definition at line 36 of file XQuery.h.

Member Function Documentation

void XQuery::compile ( const std::string &  aQuery)

Compile a query given as a String.

Parameters
aQuerythe query String to compile.
Exceptions
ZorbaExceptionif the query has been closed, is already compiled, or an error occurs while compiling the query.
void XQuery::compile ( const std::string &  aQuery,
StaticContext aStaticContext 
)

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

Parameters
aQuerythe query String to compile.
aStaticContextthe static context.
Exceptions
ZorbaExceptionif the query has been closed, is already compiled, or an error occurs while compiling the query.
void XQuery::destroy ( )

/brief deletes this object from memory

std::string XQuery::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.

Exceptions
ZorbaExceptionif an error occurs (e.g. the query is closed or has not been compiled or is not updating)
void XQuery::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
streamThe output stream on which the result is written.
void XQuery::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
streamThe output stream on which the result is written.
serOptionsThe serialization options for this Query result
std::string XQuery::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
serOptionsThe serialization options for this Query result
Exceptions
ZorbaExceptionif an error occurs (e.g. the query is closed or has not been compiled or is not updating)
DynamicContext XQuery::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.

Exceptions
SystemExceptionif the query has not been compiled or is closed.
Returns
DynamicContext of this query.
void XQuery::getExternalVariables ( Iterator vars) const

Returns the QName of all external variables.

Parameters
varsiterator to store the results.
Exceptions
ZorbaExceptionif an error occured.
StaticCollectionManager XQuery::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.
StaticContext XQuery::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.

Exceptions
SystemExceptionif the query has not been compiled or is closed.
Returns
StaticContext of this query.
Iterator XQuery::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.
Exceptions
ZorbaExceptionif an error occurs (e.g. the query is closed or has not been compiled).
std::string XQuery::printPlanAsDOT ( )

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

Returns
A String with the output.
Exceptions
ZorbaExceptionif the query has been closed or is not compiled.
std::string XQuery::printPlanAsXML ( )

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

Returns
A String with the output.
Exceptions
ZorbaExceptionif the query has been closed or is not compiled.

The documentation for this class was generated from the following file:
blog comments powered by Disqus