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. More... | |
void | compile (const std::string &aQuery, StaticContext &aStaticContext) |
Compile a query given as a String, using a given static context and compiler hints. More... | |
void | destroy () |
/brief deletes this object from memory More... | |
std::string | execute () |
Execute the query. More... | |
void | execute (ZorbaIOStream &stream) |
Execute the query and write the result to the given output stream. More... | |
void | execute (ZorbaIOStream &stream, SerializationOptions &serOptions) |
Execute the query and write the result to the given output stream. More... | |
std::string | execute (SerializationOptions &serOptions) |
Execute the query. More... | |
DynamicContext | getDynamicContext () |
Get the dynamic context of this query. More... | |
void | getExternalVariables (Iterator &vars) const |
Returns the QName of all external variables. More... | |
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. More... | |
StaticContext | getStaticContext () |
Get the static context of this query. More... | |
Iterator | iterator () |
Get an iterator for the result of the query. More... | |
std::string | printPlanAsDOT () |
Print the execution plan of this query to a given string. More... | |
std::string | printPlanAsXML () |
Print the execution plan of this query to a given string. More... | |
XQuery () | |
XQuery (const XQuery &aXQuery) | |
XQuery (zorba::XQuery_t aQuery) | |
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.
void XQuery::compile | ( | const std::string & | aQuery | ) |
Compile a query given as a String.
aQuery | the query String to compile. |
ZorbaException | if 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.
aQuery | the query String to compile. |
aStaticContext | the static context. |
ZorbaException | if 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.
ZorbaException | if 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.
stream | The 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.
stream | The output stream on which the result is written. |
serOptions | The 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.
serOptions | The serialization options for this Query result |
ZorbaException | if 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.
SystemException | if the query has not been compiled or is closed. |
void XQuery::getExternalVariables | ( | Iterator & | vars | ) | const |
Returns the QName of all external variables.
vars | iterator to store the results. |
ZorbaException | if 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.
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.
SystemException | if the query has not been compiled or is closed. |
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.
ZorbaException | if 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.
ZorbaException | if the query has been closed or is not compiled. |
std::string XQuery::printPlanAsXML | ( | ) |
Print the execution plan of this query to a given string.
ZorbaException | if the query has been closed or is not compiled. |