## TrackerSparqlStatement TrackerSparqlStatement — Prepared statements |

## Stability Level

Stable, unless otherwise indicated

## Functions

TrackerSparqlCursor * | tracker_sparql_statement_execute ()
void | tracker_sparql_statement_execute_async ()
TrackerSparqlCursor * | tracker_sparql_statement_execute_finish ()
void | tracker_sparql_statement_bind_int ()
void | tracker_sparql_statement_bind_double ()
void | tracker_sparql_statement_bind_string ()
void | tracker_sparql_statement_bind_boolean ()

## Properties

TrackerSparqlConnection * | connection | Read / Write / Construct
gchar * | sparql | Read / Write / Construct

## Types and Values

struct | TrackerSparqlStatement

## Object Hierarchy

        GObject
        ╰── TrackerSparqlStatement

## Includes

    #include <tracker-sparql.h>

## Description

The TrackerSparqlStatement object represents a SPARQL query. This query may contain parameterized variables (expressed as ~var in the syntax), which may be mapped to arbitrary values prior to execution. This statement may be reused for future queries with different values.

The argument bindings may be changed through `tracker_sparql_statement_bind_int()`, `tracker_sparql_statement_bind_boolean()`, `tracker_sparql_statement_bind_double()` and `tracker_sparql_statement_bind_string()`. Those functions receive a `name` argument corresponding for the variable name in the SPARQL query (eg. "var" for ~var) and a `value` to map the variable to.

Once all arguments have a value, the query may be executed through `tracker_sparql_statement_execute()` or `tracker_sparql_statement_execute_async()`.

This object was added in Tracker 2.2.

## Functions

### tracker_sparql_statement_execute ()

    TrackerSparqlCursor *
    tracker_sparql_statement_execute (TrackerSparqlStatement *self,
                                      GCancellable *cancellable,
                                      GError **error);

Executes the SPARQL query with the currently bound values.

#### Parameters

cancellable | a GCancellable used to cancel the operation |
error | GError for error reporting. |

#### Returns

A TrackerSparqlCursor.

[transfer full]

### tracker_sparql_statement_execute_async ()

    void
    tracker_sparql_statement_execute_async
                                   (TrackerSparqlStatement *self,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);

### tracker_sparql_statement_execute_finish ()

    TrackerSparqlCursor *
    tracker_sparql_statement_execute_finish
                                   (TrackerSparqlStatement *self,
                                    GAsyncResult *_res_,
                                    GError **error);

Finishes the asynchronous operation started through `tracker_sparql_statement_execute_async()`.

#### Parameters

self | a TrackerSparqlStatement |
_res_ | The GAsyncResult from the callback used to return the TrackerSparqlCursor |
error | The error which occurred or `NULL` |

#### Returns

A TrackerSparqlCursor.

[transfer full]

### tracker_sparql_statement_bind_int ()

    void
    tracker_sparql_statement_bind_int (TrackerSparqlStatement *self,
                                       const gchar *name,
                                       gint64 value);

Binds the integer `value` to variable `name` .

#### Parameters

self | a TrackerSparqlStatement |
name | variable name |
value | value |

### tracker_sparql_statement_bind_double ()

    void
    tracker_sparql_statement_bind_double (TrackerSparqlStatement *self,
                                          const gchar *name,
                                          gdouble value);

Binds the double `value` to variable `name` .

#### Parameters

self | a TrackerSparqlStatement |
name | variable name |
value | value |

### tracker_sparql_statement_bind_string ()

    void
    tracker_sparql_statement_bind_string (TrackerSparqlStatement *self,
                                          const gchar *name,
                                          const gchar *value);

Binds the string `value` to variable `name` .

#### Parameters

self | a TrackerSparqlStatement |
name | variable name |
value | value |

### tracker_sparql_statement_bind_boolean ()

    void
    tracker_sparql_statement_bind_boolean (TrackerSparqlStatement *self,
                                           const gchar *name,
                                           gboolean value);

Binds the boolean `value` to variable `name` .

#### Parameters

self | a TrackerSparqlStatement |
name | variable name |
value | value |

## Types and Values

### struct TrackerSparqlStatement

    struct TrackerSparqlStatement;

## Property Details

### The `“connection”` property

      “connection”               TrackerSparqlConnection *

connection.

Flags: Read / Write / Construct

### The `“sparql”` property

      “sparql”                   gchar *

sparql.

Flags: Read / Write / Construct

Default value: NULL