# XQilla XQC API Documentation

# XQC_Expression_s Struct Reference

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

`#include <xqc.h>`

List of all members.

## Public Attributes

XQC_Error(* | create_context )(const XQC_Expression *expression, XQC_DynamicContext **context)
| Creates a dynamic context suitable for use in the execute() function.
XQC_Error(* | execute )(const XQC_Expression *expression, const XQC_DynamicContext *context, XQC_Sequence **sequence)
| Executes the query represented by the XQC_Expression object using the values in the XQC_DynamicContext if provided.
void *(* | get_interface )(const XQC_Expression *expression, const char *name)
| Called to retrieve an implementation specific interface.
void(* | free )(XQC_Expression *expression)
| Called to free the resources associated with the XQC_Expression.

## Detailed Description

The XQC_Expression struct represents a prepared 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(), XQC_Implementation::prepare_file() and XQC_Implementation::prepare_stream() 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:

  xqc-basic.c, and xqc-context-item.c.

## Member Data Documentation

XQC_Error(* XQC_Expression_s::create_context)(const XQC_Expression *expression, XQC_DynamicContext **context)

Creates a dynamic context suitable for use in the execute() function.

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

Parameters:

  | expression | The XQC_Expression that this function pointer is a member of.
  `[out]` | context | The newly created XQC_DynamicContext object.

Return values:

  | XQC_NO_ERROR |
  | XQC_INTERNAL_ERROR |

Examples:
  xqc-context-item.c.

XQC_Error(* XQC_Expression_s::execute)(const XQC_Expression *expression, const XQC_DynamicContext *context, XQC_Sequence **sequence)

Executes the query represented by the XQC_Expression object using the values in the XQC_DynamicContext if provided.

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:

  | expression | The XQC_Expression that this function pointer is a member of.
  | context | The dynamic context information to use when executing the query, or 0 to use the implementation defined default dynamic context.
  `[out]` | sequence | The newly created XQC_Sequence object.

Return values:

  | XQC_NO_ERROR |
  | XQC_INTERNAL_ERROR |
  | XQC_TYPE_ERROR |
  | XQC_DYNAMIC_ERROR |

Examples:
  xqc-basic.c, and xqc-context-item.c.

void(* XQC_Expression_s::free)(XQC_Expression *expression)

Called to free the resources associated with the XQC_Expression.

Parameters:

  | expression | The XQC_Expression that this function pointer is a member of

Examples:
  xqc-basic.c, and xqc-context-item.c.

void*(* XQC_Expression_s::get_interface)(const XQC_Expression *expression, const char *name)

Called to retrieve an implementation specific interface.

Parameters:

  | expression | The XQC_Expression that this function pointer is a member of.
  | name | The name that identifies the interface to return

Returns:
  A pointer to the interface, or 0 if the name is not recognized by this implementation of XQC.

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

- xqc.h