XQC_StaticContext_s Struct Reference

The XQC_StaticContext struct provides a way to specify values for the static context of the query to be prepared. More...

#include <zorba/zorbac.h>


Data Fields

XQUERY_ERROR(* add_collation )(XQC_StaticContext context, const char *uri)
 Add a collation URI.
XQUERY_ERROR(* create_child_context )(XQC_StaticContext context, XQC_StaticContext_Ref child_context)
 Creates a child context of the given static context.
void * data
 for internal use only
XQUERY_ERROR(* declare_ns )(XQC_StaticContext context, const char *prefix, const char *uri)
 Adds a (prefix, uri) pair to the set of statically known namespaces of the given context.
void(* free )(XQC_StaticContext context)
 Called to free the resources associated with the XQC_StaticContext.
XQUERY_ERROR(* get_base_uri )(XQC_StaticContext context, const char **base_uri)
 Returns the base uri that is set in the given static context.
XQUERY_ERROR(* get_boundary_space_policy )(XQC_StaticContext context, boundary_space_mode_t *mode)
 Returns the boundary space policy that is set in the given static context.
XQUERY_ERROR(* get_construction_mode )(XQC_StaticContext context, construction_mode_t *mode)
 Returns the construction mode that is set in the given static context.
XQUERY_ERROR(* get_copy_ns_mode )(XQC_StaticContext context, preserve_mode_t *aPreserve, inherit_mode_t *aInherit)
 Returns the copy namespace mode as a pair consisting of the preserve and the inherit mode.
XQUERY_ERROR(* get_default_collation )(XQC_StaticContext context, const char **uri)
 Get the URI of the default collation.
XQUERY_ERROR(* get_default_element_and_type_ns )(XQC_StaticContext context, const char **uri)
 Returns the default namespace for elements and types.
XQUERY_ERROR(* get_default_function_ns )(XQC_StaticContext context, const char **uri)
 Returns the default namespace for functions set in this static context.
XQUERY_ERROR(* get_default_order_empty_sequences )(XQC_StaticContext context, order_empty_mode_t *mode)
 Returns the default order mode for empty sequences that is set in the given static context.
XQUERY_ERROR(* get_ns_by_prefix )(XQC_StaticContext context, const char *prefix, const char **result_ns)
 Returns the namespace uri that belongs to the given prefix.
XQUERY_ERROR(* get_ordering_mode )(XQC_StaticContext context, ordering_mode_t *mode)
 Returns the ordering mode that is set in the given static context.
XQUERY_ERROR(* get_xpath1_0_mode )(XQC_StaticContext context, xpath1_0compatib_mode_t *mode)
 Returns the XPath 1.0 compatibility that is set in the given static context.
XQUERY_ERROR(* register_external_function )(XQC_StaticContext context, const char *uri, const char *localname, external_function_init init, external_function_next next, external_function_release release, void *global_user_data)
 Register an external function that can be called within a query.
XQUERY_ERROR(* set_base_uri )(XQC_StaticContext context, const char *base_uri)
 Sets the base uri in the given static context.
XQUERY_ERROR(* set_boundary_space_policy )(XQC_StaticContext context, boundary_space_mode_t mode)
 Sets the boundary space policy to either preserve_space or strip_space.
XQUERY_ERROR(* set_construction_mode )(XQC_StaticContext context, construction_mode_t mode)
 Sets the construction mode to either preserve_cons or strip_cons.
XQUERY_ERROR(* set_copy_ns_mode )(XQC_StaticContext context, preserve_mode_t preserve, inherit_mode_t inherit)
 Sets the copy namespace mode which consists of the preserve and the inherit mode.
XQUERY_ERROR(* set_default_collation )(XQC_StaticContext context, const char *uri)
 Set the URI of the default collation.
XQUERY_ERROR(* set_default_element_and_type_ns )(XQC_StaticContext context, const char *uri)
 Sets the value of the default namespace for elements and types.
XQUERY_ERROR(* set_default_function_ns )(XQC_StaticContext context, const char *uri)
 Sets the default namespace for functions.
XQUERY_ERROR(* set_default_order_empty_sequences )(XQC_StaticContext context, order_empty_mode_t mode)
 Sets the default order mode for empty sequences to either empty_least or empty_greatest.
XQUERY_ERROR(* set_ordering_mode )(XQC_StaticContext context, ordering_mode_t mode)
 Sets the ordering mode to either order or unordered.
XQUERY_ERROR(* set_xpath1_0_mode )(XQC_StaticContext context, xpath1_0compatib_mode_t mode)
 Sets the XPath 1.0 compatibility mode to either xpath1_0 or xpath2_0.


Detailed Description

The XQC_StaticContext struct provides a way to specify values for the static context of the query to be prepared.

An XQC_StaticContext object is not thread-safe - threads should each use their own instance of a XQC_StaticContext object (see create_child_context).

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

Examples:

ccontext.c, and cexternal_functions.c.

Definition at line 421 of file zorbac.h.


Field Documentation

XQUERY_ERROR(* XQC_StaticContext_s::add_collation)(XQC_StaticContext context, const char *uri)

Add a collation URI.

The URI specifies the locale and collation strength of the collation that is added. A valid collation URI must begin with http://www.flworfound.org/collations/. This prefix is followed by a collation strength (i.e. PRIMARY, SECONDARY, TERTIARY, QUATTERNARY, or IDENTICAL) followed by a '/'. After the strength a lower-case two- or three-letter ISO-639 language code must follow. The URI may end with an upper-case two-letter ISO-3166. For example, http://www.flworfound.org/collations/PRIMARY/en/US specifies an english language with US begin the country..

Internally, ICU is used for comparing strings. For detailed description see http://www.icu-project.org/apiref/icu4c/classCollator.html and http://www.icu-project.org/apiref/icu4c/classLocale.html

Parameters:
context The XQC_StaticContext that this function pointer is a member of
uri The URI of the collation to add.
Return values:
XQC_NO_ERROR 
XQST0038 
XQC_INTERNAL_ERROR 
Examples:
ccontext.c.

XQUERY_ERROR(* XQC_StaticContext_s::create_child_context)(XQC_StaticContext context, XQC_StaticContext_Ref child_context)

Creates a child context of the given static context.

A child context contains the same information as it's parent context but it allows the user to override and add information. The user is responsible for freeing the XQC_StaticContext object returned by calling XQC_StaticContext::free().

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] child_context The newly created XQC_StaticContext object which is a child of the given context.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 

void* XQC_StaticContext_s::data

for internal use only

Definition at line 783 of file zorbac.h.

XQUERY_ERROR(* XQC_StaticContext_s::declare_ns)(XQC_StaticContext context, const char *prefix, const char *uri)

Adds a (prefix, uri) pair to the set of statically known namespaces of the given context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of.
prefix The prefix of the namespace to add to the given XQC_StaticContext.
uri The uri of the namespace to add to the given XQC_StaticContext.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

void(* XQC_StaticContext_s::free)(XQC_StaticContext context)

Called to free the resources associated with the XQC_StaticContext.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
Examples:
ccontext.c, and cexternal_functions.c.

XQUERY_ERROR(* XQC_StaticContext_s::get_base_uri)(XQC_StaticContext context, const char **base_uri)

Returns the base uri that is set in the given static context.

The returned base uri is only valid as long as the corresponding static context is valid.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] base_uri The base uri that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 
Examples:
ccontext.c.

XQUERY_ERROR(* XQC_StaticContext_s::get_boundary_space_policy)(XQC_StaticContext context, boundary_space_mode_t *mode)

Returns the boundary space policy that is set in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] mode The boundary_space_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_construction_mode)(XQC_StaticContext context, construction_mode_t *mode)

Returns the construction mode that is set in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] mode The construction_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_copy_ns_mode)(XQC_StaticContext context, preserve_mode_t *aPreserve, inherit_mode_t *aInherit)

Returns the copy namespace mode as a pair consisting of the preserve and the inherit mode.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] preserve The preserve_mode_t that is set in the given context.
[out] inherit The inherit_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_default_collation)(XQC_StaticContext context, const char **uri)

Get the URI of the default collation.

The uri returned is valid as long as the corresponding XQC_StaticContext object is valid.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] uri The URI of the default collation that is currently set in the given context.

XQUERY_ERROR(* XQC_StaticContext_s::get_default_element_and_type_ns)(XQC_StaticContext context, const char **uri)

Returns the default namespace for elements and types.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] uri The uri of the default element and type namespace that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_default_function_ns)(XQC_StaticContext context, const char **uri)

Returns the default namespace for functions set in this static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] uri The uri of the default function namespace that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_default_order_empty_sequences)(XQC_StaticContext context, order_empty_mode_t *mode)

Returns the default order mode for empty sequences that is set in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] mode The order_empty_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_ns_by_prefix)(XQC_StaticContext context, const char *prefix, const char **result_ns)

Returns the namespace uri that belongs to the given prefix.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
prefix The prefix of the namespace to add to the given XQC_StaticContext.
[out] result_ns The namespace uri of the namespace registered with the given prefix.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::get_ordering_mode)(XQC_StaticContext context, ordering_mode_t *mode)

Returns the ordering mode that is set in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] mode The ordering_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 
Examples:
ccontext.c.

XQUERY_ERROR(* XQC_StaticContext_s::get_xpath1_0_mode)(XQC_StaticContext context, xpath1_0compatib_mode_t *mode)

Returns the XPath 1.0 compatibility that is set in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
[out] mode The xpath1_0compatib_mode_t that is set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::register_external_function)(XQC_StaticContext context, const char *uri, const char *localname, external_function_init init, external_function_next next, external_function_release release, void *global_user_data)

Register an external function that can be called within a query.

One external function consists of three function parameters, i.e. init, next, and release.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
uri The URI of the external function to add.
localname The localname of the function to add.
init A callback function pointer that is called once when the external function is initialized. The init function gets the global_user_data pointer as parameter.
next A callback function pointer that is called each time the corresponding XQuery function is executed.
release A callback function pointer that is called once when the external function is deinitialized.
global_user_data User specific data that is passed to the init function as a parameter.
Return values:
XQC_NO_ERROR 
API0019_FUNCTION_ALREADY_REGISTERED,\retval XQC_INTERNAL_ERROR
Examples:
cexternal_functions.c.

XQUERY_ERROR(* XQC_StaticContext_s::set_base_uri)(XQC_StaticContext context, const char *base_uri)

Sets the base uri in the given static context.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
base_uri The base uri to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 
Examples:
ccontext.c.

XQUERY_ERROR(* XQC_StaticContext_s::set_boundary_space_policy)(XQC_StaticContext context, boundary_space_mode_t mode)

Sets the boundary space policy to either preserve_space or strip_space.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
mode The boundary_space_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_construction_mode)(XQC_StaticContext context, construction_mode_t mode)

Sets the construction mode to either preserve_cons or strip_cons.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
mode The construction_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_copy_ns_mode)(XQC_StaticContext context, preserve_mode_t preserve, inherit_mode_t inherit)

Sets the copy namespace mode which consists of the preserve and the inherit mode.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
preserve The preserve_mode_t to set in the given context.
inherit The inherit_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_default_collation)(XQC_StaticContext context, const char *uri)

Set the URI of the default collation.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters:
context The XQC_StaticContext that this function pointer is a member of
uri The URI of the default collation to set
Return values:
XQC_NO_ERROR 
XQST0038 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_default_element_and_type_ns)(XQC_StaticContext context, const char *uri)

Sets the value of the default namespace for elements and types.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
uri The uri of the default element and type namespace to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_default_function_ns)(XQC_StaticContext context, const char *uri)

Sets the default namespace for functions.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
uri The uri of the default function namespace to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_default_order_empty_sequences)(XQC_StaticContext context, order_empty_mode_t mode)

Sets the default order mode for empty sequences to either empty_least or empty_greatest.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
mode The order_empty_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_ordering_mode)(XQC_StaticContext context, ordering_mode_t mode)

Sets the ordering mode to either order or unordered.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
mode The ordering_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 

XQUERY_ERROR(* XQC_StaticContext_s::set_xpath1_0_mode)(XQC_StaticContext context, xpath1_0compatib_mode_t mode)

Sets the XPath 1.0 compatibility mode to either xpath1_0 or xpath2_0.

Parameters:
context The XQC_StaticContext that this function pointer is a member of
mode The xpath1_0compatib_mode_t to set in the given context.
Return values:
XQC_NO_ERROR 
XQC_INTERNAL_ERROR 


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