XQC_Query_s Struct Reference

The XQC_Expression struct represents a pre-parsed query, and allows the user to execute that query any number of times. More...

#include <zorba/zorbac.h>


Data Fields

XQUERY_ERROR(* apply_updates )(XQC_Query query)
 Applies the updates declared in the query represented by the XQC_Query object.
void * data
 for internal use only
XQUERY_ERROR(* execute )(XQC_Query query, FILE *file)
 Executes the query represented by the XQC_Query object and prints the serialized XML output to the given FILE pointer.
void(* free )(XQC_Query query)
 Called to free the resources associated with the XQC_Query.
XQUERY_ERROR(* get_dynamic_context )(XQC_Query query, XQC_DynamicContext_Ref context)
 This function returns the dynamic context that belongs to this query and is used during query execution.
XQUERY_ERROR(* get_static_context )(XQC_Query, XQC_StaticContext_Ref context)
 This function returns the static context that belongs to this query.
int(* is_update_query )(XQC_Query query)
 Checks if the query is an updating query.
XQUERY_ERROR(* sequence )(XQC_Query query, XQC_Sequence_Ref sequence)
 Executes the query represented by the XQC_Query object.
XQUERY_ERROR(* serialize_file )(XQC_Query query, const Zorba_SerializerOptions_t *options, FILE *file)
 Executes the query represented by the XQC_Query object and prints the serialized output to the given FILE pointer.
XQUERY_ERROR(* serialize_stream )(XQC_Query query, const Zorba_SerializerOptions_t *options, XQC_OutputStream stream)
 Executes the query represented by the XQC_Query object and writes the serialized output to the given XQC_OutputStream.
void(* set_error_handler )(XQC_Query query, XQC_ErrorHandler handler)
 Sets the error handler whose error function is called if an error occurs when executing the query.


Detailed Description

The XQC_Expression struct represents a pre-parsed query, and allows the user to execute that query any number of times.

An XQC_Expression object is thread-safe and can be used by multiple threads of execution at the same time.

XQC_Expression objects are created by calling the XQC_Implementation::prepare() or XQC_Implementation::prepare_file() functions. Once created, the user is responsible for freeing the object by calling the free() function. The XQC_Expression object should be freed before the XQC_Implementation object that created it.

Examples:

ccontext.c, cdatamanager.c, cerror.c, cexternal_functions.c, cserialization.c, and csimple.c.

Definition at line 261 of file zorbac.h.


Field Documentation

XQUERY_ERROR(* XQC_Query_s::apply_updates)(XQC_Query query)

Applies the updates declared in the query represented by the XQC_Query object.

Parameters:
query The XQC_Query that this function pointer is a member of.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
API0023_CANNOT_SERIALIZE_UPDATE_QUERY 
An XQuery dynamic or type error (e.g. XPDY*, XPTY*)

void* XQC_Query_s::data

for internal use only

Definition at line 407 of file zorbac.h.

XQUERY_ERROR(* XQC_Query_s::execute)(XQC_Query query, FILE *file)

Executes the query represented by the XQC_Query object and prints the serialized XML output to the given FILE pointer.

The user remains responsible for closing the file.

Parameters:
query The XQC_Query that this function pointer is a member of.
file The FILE pointer to print the serialized result to.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
API0023_CANNOT_SERIALIZE_UPDATE_QUERY 
An XQuery dynamic or type error (e.g. XPDY*, XPTY*)
Examples:
ccontext.c, cdatamanager.c, cerror.c, cexternal_functions.c, and csimple.c.

void(* XQC_Query_s::free)(XQC_Query query)

Called to free the resources associated with the XQC_Query.

Parameters:
query The XQC_Query that this function pointer is a member of.
Examples:
ccontext.c, cdatamanager.c, cerror.c, cexternal_functions.c, cserialization.c, and csimple.c.

XQUERY_ERROR(* XQC_Query_s::get_dynamic_context)(XQC_Query query, XQC_DynamicContext_Ref context)

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 ResultIterator is opened). The user is responsible for freeing the XQC_DynamicContext object returned by calling XQC_DynamicContext::free().

Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
ccontext.c, and cdatamanager.c.

XQUERY_ERROR(* XQC_Query_s::get_static_context)(XQC_Query, XQC_StaticContext_Ref context)

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 have been set by the either the static context that was passed when creating the query and 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. The user is responsible for freeing the XQC_StaticContext object returned by calling XQC_StaticContext::free().

Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
ccontext.c.

int(* XQC_Query_s::is_update_query)(XQC_Query query)

Checks if the query is an updating query.

Parameters:
query The XQC_Query that this function pionter is a member of.
Return values:
1 if query is updating query, else 0

XQUERY_ERROR(* XQC_Query_s::sequence)(XQC_Query query, XQC_Sequence_Ref sequence)

Executes the query represented by the XQC_Query object.

An XQC_Sequence object is returned which can be used to examine the results of the query execution. The user is responsible for freeing the XQC_Sequence object returned by calling XQC_Sequence::free().

Parameters:
query The XQC_Query that this function pointer is a member of.
[out] sequence The newly created XQC_Sequence object.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
API0024_CANNOT_ITERATE_OVER_UPDATE_QUERY 
An XQuery dynamic or type error (e.g. XPDY*, XPTY*)
Examples:
ccontext.c, cerror.c, and csimple.c.

XQUERY_ERROR(* XQC_Query_s::serialize_file)(XQC_Query query, const Zorba_SerializerOptions_t *options, FILE *file)

Executes the query represented by the XQC_Query object and prints the serialized output to the given FILE pointer.

The target format of the serialization is specified by the passed serializer options.

Parameters:
query The XQC_Query that this function pointer is a member of.
options The Zorba_SerializerOptions_t that specifies serializer options.
file The FILE pointer to print the serialized result to.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
API0023_CANNOT_SERIALIZE_UPDATE_QUERY 
An XQuery dynamic or type error (e.g. XPDY*, XPTY*)
Examples:
cserialization.c.

XQUERY_ERROR(* XQC_Query_s::serialize_stream)(XQC_Query query, const Zorba_SerializerOptions_t *options, XQC_OutputStream stream)

Executes the query represented by the XQC_Query object and writes the serialized output to the given XQC_OutputStream.

The target format of the serialization is specified by the passed serializer options.

Parameters:
query The XQC_Query that this function pointer is a member of.
options The Zorba_SerializerOptions_t that specifies serializer options.
file The XQC_OutputStream to print the serialized result to.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
API0023_CANNOT_SERIALIZE_UPDATE_QUERY 
An XQuery dynamic or type error (e.g. XPDY*, XPTY*)
Examples:
cserialization.c.

void(* XQC_Query_s::set_error_handler)(XQC_Query query, XQC_ErrorHandler handler)

Sets the error handler whose error function is called if an error occurs when executing the query.

The user keeps the ownership of this object and is required to freeing the aquired resources.

Examples:
cerror.c.


The documentation for this struct was generated from the following file: