## xb-query-context

xb-query-context

## Functions

#define | XB_QUERY_CONTEXT_INIT
void | xb_query_context_init ()
void | xb_query_context_clear ()
XbQueryContext * | xb_query_context_copy ()
void | xb_query_context_free ()
XbValueBindings * | xb_query_context_get_bindings ()
guint | xb_query_context_get_limit ()
void | xb_query_context_set_limit ()
XbQueryFlags | xb_query_context_get_flags ()
void | xb_query_context_set_flags ()

## Types and Values

| XbQueryContext

## Description

## Functions

### XB_QUERY_CONTEXT_INIT

    #define             XB_QUERY_CONTEXT_INIT()

Static initialiser for XbQueryContext so it can be used on the stack.

Use it in association with `g_auto()`, to ensure the bindings are freed once finished with:

    1
    2
    3

    g_auto(XbQueryContext) context = XB_QUERY_CONTEXT_INIT ();

    xb_query_context_set_limit (&context, 0);

Since: 0.3.0

### xb_query_context_init ()

    void
    xb_query_context_init (XbQueryContext *self);

Initialise a stack-allocated XbQueryContext struct so it can be used.

Stack-allocated XbQueryContext instances should be freed once finished with, using `xb_query_context_clear()` (or `g_auto(XbQueryContext)`, which is equivalent).

#### Parameters

self | an uninitialised XbQueryContext to initialise |

Since: 0.3.0

### xb_query_context_clear ()

    void
    xb_query_context_clear (XbQueryContext *self);

Clear an XbQueryContext, freeing any allocated memory it points to.

After this function has been called, the contents of the XbQueryContext are undefined, and it’s only safe to call `xb_query_context_init()` on it.

#### Parameters

self | an XbQueryContext |

Since: 0.3.0

### xb_query_context_copy ()

    XbQueryContext *
    xb_query_context_copy (XbQueryContext *self);

Copy `self` into a new heap-allocated XbQueryContext instance.

#### Parameters

self | an XbQueryContext |

#### Returns

a copy of `self` .

[transfer full]

Since: 0.3.0

### xb_query_context_free ()

    void
    xb_query_context_free (XbQueryContext *self);

Free a heap-allocated XbQueryContext instance. This should be used on XbQueryContext instances created with `xb_query_context_copy()`.

For stack-allocated instances, `xb_query_context_clear()` should be used instead.

#### Parameters

self | a heap-allocated XbQueryContext |

Since: 0.3.0

### xb_query_context_get_bindings ()

    XbValueBindings *
    xb_query_context_get_bindings (XbQueryContext *self);

Get the XbValueBindings for this query context.

#### Parameters

self | an XbQueryContext |

#### Returns

bindings.

[transfer none][not nullable]

Since: 0.3.0

### xb_query_context_get_limit ()

    guint
    xb_query_context_get_limit (XbQueryContext *self);

Get the limit on the number of query results. See `xb_query_context_set_limit()`.

#### Parameters

self | an XbQueryContext |

#### Returns

limit on results, or `0` if unlimited

Since: 0.3.0

### xb_query_context_set_limit ()

    void
    xb_query_context_set_limit (XbQueryContext *self,
                                guint limit);

Set the limit on the number of results to return from the query.

#### Parameters

self | an XbQueryContext |
limit | number of query results to return, or `0` for unlimited |

Since: 0.3.0

### xb_query_context_get_flags ()

    XbQueryFlags
    xb_query_context_get_flags (XbQueryContext *self);

Get the flags set on the context. See `xb_query_context_set_flags()`.

#### Parameters

self | an XbQueryContext |

#### Returns

query flags

Since: 0.3.0

### xb_query_context_set_flags ()

    void
    xb_query_context_set_flags (XbQueryContext *self,
                                XbQueryFlags flags);

Set flags which affect the behaviour of the query.

#### Parameters

self | an XbQueryContext |
flags | query flags, or `XB_QUERY_FLAG_NONE` for none |

Since: 0.3.0

## Types and Values

### XbQueryContext

    typedef struct {
    } XbQueryContext;

An opaque struct which contains context for executing a query in, such as the number of results to return, or values to bind to query placeholders.

Since: 0.3.0