XbQuery: libxmlb Reference Manual

## XbQuery XbQuery |

## Functions

XbQuery * | xb_query_new ()
XbQuery * | xb_query_new_full ()
const gchar * | xb_query_get_xpath ()
guint | xb_query_get_limit ()
void | xb_query_set_limit ()
XbQueryFlags | xb_query_get_flags ()
void | xb_query_set_flags ()
gboolean | xb_query_bind_str ()
gboolean | xb_query_bind_val ()

## Types and Values

#define | XB_TYPE_QUERY
struct | XbQueryClass
enum | XbQueryFlags
| XbQuery

## Description

## Functions

### xb_query_new ()

    XbQuery *
    xb_query_new (XbSilo *silo,
                  const gchar *xpath,
                  GError **error);

Creates a query to be used by `silo` . It may be quicker to create a query manually and re-use it multiple times.

#### Parameters

silo | a XbSilo |
xpath | The XPath query |
error | the GError, or `NULL` |

#### Returns

a XbQuery.

[transfer full]

Since: 0.1.4

### xb_query_new_full ()

    XbQuery *
    xb_query_new_full (XbSilo *silo,
                       const gchar *xpath,
                       XbQueryFlags flags,
                       GError **error);

Creates a query to be used by `silo` . It may be quicker to create a query manually and re-use it multiple times.

The query will point to strings inside `silo` , so the lifetime of `silo` must exceed the lifetime of the returned query.

#### Parameters

silo | a XbSilo |
xpath | The XPath query |
flags | some XbQueryFlags, e.g. XB_QUERY_FLAG_USE_INDEXES |
error | the GError, or `NULL` |

#### Returns

a XbQuery.

[transfer full]

Since: 0.1.6

### xb_query_get_xpath ()

    const gchar *
    xb_query_get_xpath (XbQuery *self);

Gets the XPath string that created the query.

#### Parameters

self | a XbQuery |

#### Returns

string

Since: 0.1.4

### xb_query_get_limit ()

    guint
    xb_query_get_limit (XbQuery *self);

`xb_query_get_limit` has been deprecated since version 0.3.0 and should not be used in newly-written code.

This is not thread-safe. Use `xb_query_context_get_limit()` instead.

Gets the results limit on this query, where 0 is 'all'.

#### Parameters

self | a XbQuery |

#### Returns

integer, default 0

Since: 0.1.4

### xb_query_set_limit ()

    void
    xb_query_set_limit (XbQuery *self,
                        guint limit);

`xb_query_set_limit` has been deprecated since version 0.3.0 and should not be used in newly-written code.

This is not thread-safe. Use `xb_query_context_set_limit()` instead.

Sets the results limit on this query, where 0 is 'all'.

#### Parameters

self | a XbQuery |
limit | integer |

Since: 0.1.4

### xb_query_get_flags ()

    XbQueryFlags
    xb_query_get_flags (XbQuery *self);

`xb_query_get_flags` has been deprecated since version 0.3.0 and should not be used in newly-written code.

This is not thread-safe. Use `xb_query_context_get_flags()` instead.

Gets the flags used for this query.

#### Parameters

self | a XbQuery |

#### Returns

XbQueryFlags, default `XB_QUERY_FLAG_NONE`

Since: 0.1.15

### xb_query_set_flags ()

    void
    xb_query_set_flags (XbQuery *self,
                        XbQueryFlags flags);

`xb_query_set_flags` has been deprecated since version 0.3.0 and should not be used in newly-written code.

This is not thread-safe. Use `xb_query_context_set_flags()` instead.

Sets the flags to use for this query.

#### Parameters

self | a XbQuery |
flags | a XbQueryFlags, e.g. `XB_QUERY_FLAG_USE_INDEXES` |

Since: 0.1.15

### xb_query_bind_str ()

    gboolean
    xb_query_bind_str (XbQuery *self,
                       guint idx,
                       const gchar *str,
                       GError **error);

`xb_query_bind_str` has been deprecated since version 0.3.0 and should not be used in newly-written code.

Use XbValueBindings and `xb_value_bindings_bind_str()` instead. That keeps the value bindings separate from the XbQuery, allowing queries to be re-used over time and between threads.

Assigns a string to a bound value specified using `?`.

#### Parameters

self | a XbQuery |
idx | an integer index |
str | string to assign to the bound variable |
error | a GError, or `NULL` |

#### Returns

`TRUE` if the `idx` existed

Since: 0.1.4

### xb_query_bind_val ()

    gboolean
    xb_query_bind_val (XbQuery *self,
                       guint idx,
                       guint32 val,
                       GError **error);

`xb_query_bind_val` has been deprecated since version 0.3.0 and should not be used in newly-written code.

Use XbValueBindings and `xb_value_bindings_bind_val()` instead. That keeps the value bindings separate from the XbQuery, allowing queries to be re-used over time and between threads.

Assigns a string to a bound value specified using `?`.

#### Parameters

self | a XbQuery |
idx | an integer index |
val | value to assign to the bound variable |
error | a GError, or `NULL` |

#### Returns

`TRUE` if the `idx` existed

Since: 0.1.4

## Types and Values

### XB_TYPE_QUERY

    #define             XB_TYPE_QUERY

### struct XbQueryClass

    struct XbQueryClass {
    	GObjectClass parent_class;
    };

### enum XbQueryFlags

The flags used for queries.

#### Members

XB_QUERY_FLAG_NONE |  |
XB_QUERY_FLAG_OPTIMIZE |  |
XB_QUERY_FLAG_USE_INDEXES |  |
XB_QUERY_FLAG_REVERSE |  |
XB_QUERY_FLAG_FORCE_NODE_CACHE |  |

### XbQuery

    typedef struct _XbQuery XbQuery;