XQC_Implementation_s Struct Reference

The XQC_Implementation struct provides factory functions for parsing queries. More...

#include <zorba/zorbac.h>


Data Fields

XQUERY_ERROR(* create_context )(XQC_Implementation impl, XQC_StaticContext_Ref context)
 Creates a static context suitable for use in the parse() and parse_file() functions.
XQUERY_ERROR(* create_item )(XQC_Implementation implementation, XQC_Item_Ref item)
 Creates an item wrapper suitable for use in the XQC_Sequence::next function or the XQC_ItemFactory::create functions.
void * data
 for internal use only
XQUERY_ERROR(* data_manager )(XQC_Implementation implementation, XQC_DataManager_Ref data_manager)
 Creates a XQC_DataManager that can be used for managing collections and documents.
void(* free )(XQC_Implementation implementation)
 Called to free the resources associated with the XQC_Implementation.
XQUERY_ERROR(* item_factory )(XQC_Implementation implementation, XQC_ItemFactory_Ref factory)
 Creates a XQC_ItemFactory that can be used for creating items, i.e.
XQUERY_ERROR(* prepare )(XQC_Implementation implementation, const char *query_string, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)
 Prepares a query from a string, returning an XQC_Query object.
XQUERY_ERROR(* prepare_file )(XQC_Implementation implementation, FILE *query_file, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)
 Prepares a query from a FILE pointer, returning an XQC_Query object.
XQUERY_ERROR(* prepare_stream )(XQC_Implementation implementation, XQC_InputStream stream, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)
 Prepares a query from a XQC_InputStream, returning an XQC_Query object.


Detailed Description

The XQC_Implementation struct provides factory functions for parsing queries.

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

Creating an XQC_Implementation object can be done using the zorba_implementation function. Once created, the user is responsible for freeing the object by calling the free() function. The XQC_Implementation object should not be freed before all objects created using it's functions have been freed - doing so causes undefined behaviour.

Examples:

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

Definition at line 100 of file zorbac.h.


Field Documentation

XQUERY_ERROR(* XQC_Implementation_s::create_context)(XQC_Implementation impl, XQC_StaticContext_Ref context)

Creates a static context suitable for use in the parse() and parse_file() functions.

The user is responsible for freeing the XQC_StaticContext object returned by calling XQC_StaticContext::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of
[out] context The newly created XQC_StaticContext object.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
ccontext.c, and cexternal_functions.c.

XQUERY_ERROR(* XQC_Implementation_s::create_item)(XQC_Implementation implementation, XQC_Item_Ref item)

Creates an item wrapper suitable for use in the XQC_Sequence::next function or the XQC_ItemFactory::create functions.

The user is responsible for freeing the XQC_Item object returned by calling XQC_Item::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of
[out] item The newly created XQC_Item wrapper object.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
ccontext.c, cerror.c, cexternal_functions.c, and csimple.c.

void* XQC_Implementation_s::data

for internal use only

Definition at line 247 of file zorbac.h.

XQUERY_ERROR(* XQC_Implementation_s::data_manager)(XQC_Implementation implementation, XQC_DataManager_Ref data_manager)

Creates a XQC_DataManager that can be used for managing collections and documents.

The user is responsible for freeing the XQC_DataManager object returned by calling XQC_DataManager::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of
[out] data_manager The newly created XQC_DataManager object.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
cdatamanager.c.

void(* XQC_Implementation_s::free)(XQC_Implementation implementation)

Called to free the resources associated with the XQC_Implementation.

Parameters:
implementation The XQC_Implementation 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_Implementation_s::item_factory)(XQC_Implementation implementation, XQC_ItemFactory_Ref factory)

Creates a XQC_ItemFactory that can be used for creating items, i.e.

instances of the XQuery data model (XDM). The user is responsible for freeing the XQC_ItemFactory object returned by calling XQC_ItemFactory::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of
[out] factory The newly created XQC_ItemFactory object.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
Examples:
ccontext.c, and cexternal_functions.c.

XQUERY_ERROR(* XQC_Implementation_s::prepare)(XQC_Implementation implementation, const char *query_string, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)

Prepares a query from a string, returning an XQC_Query object.

The user is responsible for freeing the XQC_Query object returned by calling XQC_Query::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of.
string The query to prepare as a string.
context The initial static context for this query, or null to use the default static context.
handler An optional error handler whose error function is called if preparing the query fails.
[out] expression The resulting prepared expression.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
An XQuery static or type error (e.g. XPST*, XPTY*)
Examples:
ccontext.c, cdatamanager.c, cerror.c, cexternal_functions.c, cserialization.c, and csimple.c.

XQUERY_ERROR(* XQC_Implementation_s::prepare_file)(XQC_Implementation implementation, FILE *query_file, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)

Prepares a query from a FILE pointer, returning an XQC_Query object.

The user remains responsible for closing the file after parsing. The user is responsible for freeing the XQC_Query object returned by calling XQC_Query::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of.
file The file containing the query to prepare.
context The initial static context for this query, or null to use the default static context.
handler An optional error handler whose error function is called if preparing the query fails.
[out] expression The resulting prepared expression.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
An XQuery static or type error (e.g. XPST*, XPTY*)

XQUERY_ERROR(* XQC_Implementation_s::prepare_stream)(XQC_Implementation implementation, XQC_InputStream stream, XQC_StaticContext context, XQC_ErrorHandler handler, XQC_Query_Ref query)

Prepares a query from a XQC_InputStream, returning an XQC_Query object.

The user is responsible for freeing the XQC_Query object returned by calling XQC_Query::free().

Parameters:
implementation The XQC_Implementation that this function pointer is a member of.
stream The input stream returning the query to prepare. free will be called on the XQC_InputStream after the query has been read.
context The initial static context for this query, or null to use the default static context.
handler An optional error handler whose error function is called if preparing the query fails.
[out] expression The resulting prepared expression.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
An XQuery static or type error (e.g. XPST*, XPTY*)
Examples:
csimple.c.


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