# TrackerSparqlStatement

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.

It is possible to use a given TrackerSparqlStatement in other threads than the one it was created from. It must be however used from just one thread at any given time.

## TrackerSparqlStatement

    GObject
        ╰──TrackerSparqlStatement

The TrackerSparqlStatement object represents a prepared query statement.

### Members

`parent_instance` (GObject) –
No description available

### Class structure

#### TrackerSparqlStatementClass

### Tracker.SparqlStatementClass

## Tracker.SparqlStatement

    GObject.Object
        ╰──Tracker.SparqlStatement

The TrackerSparqlStatement object represents a prepared query statement.

### Members

`parent_instance` (GObject.Object) –
No description available

## Tracker.SparqlStatement

    GObject.Object
        ╰──Tracker.SparqlStatement

The TrackerSparqlStatement object represents a prepared query statement.

### Members

`parent_instance` (GObject.Object) –
No description available

### Methods

#### tracker_sparql_statement_bind_boolean

    tracker_sparql_statement_bind_boolean (TrackerSparqlStatement * stmt,
                                           const gchar * name,
                                           gboolean value)

Binds the boolean value to variable name.

Parameters:

`stmt` –

a TrackerSparqlStatement

`name` –

variable name

`value` –

value

#### Tracker.SparqlStatement.prototype.bind_boolean

    function Tracker.SparqlStatement.prototype.bind_boolean(name: String, value: Number): {
        // javascript wrapper for 'tracker_sparql_statement_bind_boolean'
    }

Binds the boolean value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (String) –

variable name

`value` (Number) –

value

#### Tracker.SparqlStatement.bind_boolean

    def Tracker.SparqlStatement.bind_boolean (self, name, value):
        #python wrapper for 'tracker_sparql_statement_bind_boolean'

Binds the boolean value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (str) –

variable name

`value` (bool) –

value

#### tracker_sparql_statement_bind_datetime

    tracker_sparql_statement_bind_datetime (TrackerSparqlStatement * stmt,
                                            const gchar * name,
                                            GDateTime * value)

Binds the GDateTime value to variable name.

Parameters:

`stmt` –

a TrackerSparqlStatement

`name` –

variable name

`value` –

value

Since : 3.2

#### Tracker.SparqlStatement.prototype.bind_datetime

    function Tracker.SparqlStatement.prototype.bind_datetime(name: String, value: GLib.DateTime): {
        // javascript wrapper for 'tracker_sparql_statement_bind_datetime'
    }

Binds the GDateTime value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (String) –

variable name

`value` (GLib.DateTime) –

value

Since : 3.2

#### Tracker.SparqlStatement.bind_datetime

    def Tracker.SparqlStatement.bind_datetime (self, name, value):
        #python wrapper for 'tracker_sparql_statement_bind_datetime'

Binds the GDateTime value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (str) –

variable name

`value` (GLib.DateTime) –

value

Since : 3.2

#### tracker_sparql_statement_bind_double

    tracker_sparql_statement_bind_double (TrackerSparqlStatement * stmt,
                                          const gchar * name,
                                          gdouble value)

Binds the double value to variable name.

Parameters:

`stmt` –

a TrackerSparqlStatement

`name` –

variable name

`value` –

value

#### Tracker.SparqlStatement.prototype.bind_double

    function Tracker.SparqlStatement.prototype.bind_double(name: String, value: Number): {
        // javascript wrapper for 'tracker_sparql_statement_bind_double'
    }

Binds the double value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (String) –

variable name

`value` (Number) –

value

#### Tracker.SparqlStatement.bind_double

    def Tracker.SparqlStatement.bind_double (self, name, value):
        #python wrapper for 'tracker_sparql_statement_bind_double'

Binds the double value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (str) –

variable name

`value` (float) –

value

#### tracker_sparql_statement_bind_int

    tracker_sparql_statement_bind_int (TrackerSparqlStatement * stmt,
                                       const gchar * name,
                                       gint64 value)

Binds the integer value to variable name.

Parameters:

`stmt` –

a TrackerSparqlStatement

`name` –

variable name

`value` –

value

#### Tracker.SparqlStatement.prototype.bind_int

    function Tracker.SparqlStatement.prototype.bind_int(name: String, value: Number): {
        // javascript wrapper for 'tracker_sparql_statement_bind_int'
    }

Binds the integer value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (String) –

variable name

`value` (Number) –

value

#### Tracker.SparqlStatement.bind_int

    def Tracker.SparqlStatement.bind_int (self, name, value):
        #python wrapper for 'tracker_sparql_statement_bind_int'

Binds the integer value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (str) –

variable name

`value` (int) –

value

#### tracker_sparql_statement_bind_string

    tracker_sparql_statement_bind_string (TrackerSparqlStatement * stmt,
                                          const gchar * name,
                                          const gchar * value)

Binds the string value to variable name.

Parameters:

`stmt` –

a TrackerSparqlStatement

`name` –

variable name

`value` –

value

#### Tracker.SparqlStatement.prototype.bind_string

    function Tracker.SparqlStatement.prototype.bind_string(name: String, value: String): {
        // javascript wrapper for 'tracker_sparql_statement_bind_string'
    }

Binds the string value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (String) –

variable name

`value` (String) –

value

#### Tracker.SparqlStatement.bind_string

    def Tracker.SparqlStatement.bind_string (self, name, value):
        #python wrapper for 'tracker_sparql_statement_bind_string'

Binds the string value to variable name.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`name` (str) –

variable name

`value` (str) –

value

#### tracker_sparql_statement_clear_bindings

    tracker_sparql_statement_clear_bindings (TrackerSparqlStatement * stmt)

Clears all boolean/string/integer/double bindings.

Parameters:

`stmt` –

a TrackerSparqlStatement

Since : 3.0

#### Tracker.SparqlStatement.prototype.clear_bindings

    function Tracker.SparqlStatement.prototype.clear_bindings(): {
        // javascript wrapper for 'tracker_sparql_statement_clear_bindings'
    }

Clears all boolean/string/integer/double bindings.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Since : 3.0

#### Tracker.SparqlStatement.clear_bindings

    def Tracker.SparqlStatement.clear_bindings (self):
        #python wrapper for 'tracker_sparql_statement_clear_bindings'

Clears all boolean/string/integer/double bindings.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Since : 3.0

#### tracker_sparql_statement_execute

    TrackerSparqlCursor *
    tracker_sparql_statement_execute (TrackerSparqlStatement * stmt,
                                      GCancellable * cancellable,
                                      GError ** error)

Executes the SPARQL query with the currently bound values.

Parameters:

`stmt` –

a TrackerSparqlStatement

`cancellable` –

a GCancellable used to cancel the operation

`error` –

GError for error reporting.

Returns ( [transfer: full]) –

A TrackerSparqlCursor

#### Tracker.SparqlStatement.prototype.execute

    function Tracker.SparqlStatement.prototype.execute(cancellable: Gio.Cancellable): {
        // javascript wrapper for 'tracker_sparql_statement_execute'
    }

Executes the SPARQL query with the currently bound values.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable used to cancel the operation

Returns (Tracker.SparqlCursor) –

A Tracker.SparqlCursor

#### Tracker.SparqlStatement.execute

    @raises(GLib.GError)
    def Tracker.SparqlStatement.execute (self, cancellable):
        #python wrapper for 'tracker_sparql_statement_execute'

Executes the SPARQL query with the currently bound values.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable used to cancel the operation

Returns (Tracker.SparqlCursor) –

A Tracker.SparqlCursor

#### tracker_sparql_statement_execute_async

    tracker_sparql_statement_execute_async (TrackerSparqlStatement * stmt,
                                            GCancellable * cancellable,
                                            GAsyncReadyCallback callback,
                                            gpointer user_data)

Asynchronously executes the SPARQL query with the currently bound values.

Parameters:

`stmt` –

a TrackerSparqlStatement

`cancellable` –

a GCancellable used to cancel the operation

`callback` –

user-defined GAsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` –

user-defined data to be passed to callback

#### Tracker.SparqlStatement.prototype.execute_async

    function Tracker.SparqlStatement.prototype.execute_async(cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback, user_data: Object): {
        // javascript wrapper for 'tracker_sparql_statement_execute_async'
    }

Asynchronously executes the SPARQL query with the currently bound values.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable used to cancel the operation

`callback` (Gio.AsyncReadyCallback) –

user-defined Gio.AsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` (Object) –

user-defined data to be passed to callback

#### Tracker.SparqlStatement.execute_async

    def Tracker.SparqlStatement.execute_async (self, cancellable, callback, *user_data):
        #python wrapper for 'tracker_sparql_statement_execute_async'

Asynchronously executes the SPARQL query with the currently bound values.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable used to cancel the operation

`callback` (Gio.AsyncReadyCallback) –

user-defined Gio.AsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` (variadic) –

user-defined data to be passed to callback

#### tracker_sparql_statement_execute_finish

    TrackerSparqlCursor *
    tracker_sparql_statement_execute_finish (TrackerSparqlStatement * stmt,
                                             GAsyncResult * res,
                                             GError ** error)

Finishes the asynchronous operation started through tracker_sparql_statement_execute_async.

Parameters:

`stmt` –

a TrackerSparqlStatement

`res` –

The GAsyncResult from the callback used to return the TrackerSparqlCursor

`error` –

The error which occurred or NULL

Returns ( [transfer: full]) –

A TrackerSparqlCursor

#### Tracker.SparqlStatement.prototype.execute_finish

    function Tracker.SparqlStatement.prototype.execute_finish(res: Gio.AsyncResult): {
        // javascript wrapper for 'tracker_sparql_statement_execute_finish'
    }

Finishes the asynchronous operation started through Tracker.SparqlStatement.prototype.execute_async.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`res` (Gio.AsyncResult) –

The Gio.AsyncResult from the callback used to return the Tracker.SparqlCursor

Returns (Tracker.SparqlCursor) –

A Tracker.SparqlCursor

#### Tracker.SparqlStatement.execute_finish

    @raises(GLib.GError)
    def Tracker.SparqlStatement.execute_finish (self, res):
        #python wrapper for 'tracker_sparql_statement_execute_finish'

Finishes the asynchronous operation started through Tracker.SparqlStatement.execute_async.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

`res` (Gio.AsyncResult) –

The Gio.AsyncResult from the callback used to return the Tracker.SparqlCursor

Returns (Tracker.SparqlCursor) –

A Tracker.SparqlCursor

#### tracker_sparql_statement_get_connection

    TrackerSparqlConnection *
    tracker_sparql_statement_get_connection (TrackerSparqlStatement * stmt)

Returns the TrackerSparqlConnection that this statement was created from.

Parameters:

`stmt` –

a TrackerSparqlStatement

Returns ( [transfer: none]) –

The SPARQL connection of this statement.

#### Tracker.SparqlStatement.prototype.get_connection

    function Tracker.SparqlStatement.prototype.get_connection(): {
        // javascript wrapper for 'tracker_sparql_statement_get_connection'
    }

Returns the Tracker.SparqlConnection that this statement was created from.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Returns (Tracker.SparqlConnection) –

The SPARQL connection of this statement.

#### Tracker.SparqlStatement.get_connection

    def Tracker.SparqlStatement.get_connection (self):
        #python wrapper for 'tracker_sparql_statement_get_connection'

Returns the Tracker.SparqlConnection that this statement was created from.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Returns (Tracker.SparqlConnection) –

The SPARQL connection of this statement.

#### tracker_sparql_statement_get_sparql

    const gchar *
    tracker_sparql_statement_get_sparql (TrackerSparqlStatement * stmt)

Returns the SPARQL string that this prepared statement holds.

Parameters:

`stmt` –

a TrackerSparqlStatement

Returns –

The contained SPARQL query

#### Tracker.SparqlStatement.prototype.get_sparql

    function Tracker.SparqlStatement.prototype.get_sparql(): {
        // javascript wrapper for 'tracker_sparql_statement_get_sparql'
    }

Returns the SPARQL string that this prepared statement holds.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Returns (String) –

The contained SPARQL query

#### Tracker.SparqlStatement.get_sparql

    def Tracker.SparqlStatement.get_sparql (self):
        #python wrapper for 'tracker_sparql_statement_get_sparql'

Returns the SPARQL string that this prepared statement holds.

Parameters:

`stmt` (Tracker.SparqlStatement) –

a Tracker.SparqlStatement

Returns (str) –

The contained SPARQL query

### Properties

#### connection

    “connection” TrackerSparqlConnection *

The TrackerSparqlConnection used to perform the query.

Flags : Read / Write / Construct Only

#### connection

    “connection” Tracker.SparqlConnection

The Tracker.SparqlConnection used to perform the query.

Flags : Read / Write / Construct Only

#### connection

    “self.props.connection” Tracker.SparqlConnection

The Tracker.SparqlConnection used to perform the query.

Flags : Read / Write / Construct Only

#### sparql

    “sparql” gchar *

SPARQL query stored in this statement.

Flags : Read / Write / Construct Only

#### sparql

    “sparql” String

SPARQL query stored in this statement.

Flags : Read / Write / Construct Only

#### sparql

    “self.props.sparql” str

SPARQL query stored in this statement.

Flags : Read / Write / Construct Only

## Constants

### TRACKER_SPARQL_TYPE_STATEMENT

    #define TRACKER_SPARQL_TYPE_STATEMENT TRACKER_TYPE_SPARQL_STATEMENT

### TRACKER_TYPE_SPARQL_STATEMENT

    #define TRACKER_TYPE_SPARQL_STATEMENT tracker_sparql_statement_get_type ()

The results of the search are