## TrackerSparqlCursor

TrackerSparqlCursor — Iteration of the query results

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <tracker-sparql.h>

                        TrackerSparqlCursor;
    TrackerSparqlConnection* tracker_sparql_cursor_get_connection
                                                            (TrackerSparqlCursor *self);
    gint                tracker_sparql_cursor_get_n_columns (TrackerSparqlCursor *self);
    const char*         tracker_sparql_cursor_get_string    (TrackerSparqlCursor *self,
                                                             gint column,
                                                             glong *length);
    gboolean            tracker_sparql_cursor_next          (TrackerSparqlCursor *self,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                tracker_sparql_cursor_next_async    (TrackerSparqlCursor *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
    gboolean            tracker_sparql_cursor_next_finish   (TrackerSparqlCursor *self,
                                                             GAsyncResult *_res_,
                                                             GError **error);
    void                tracker_sparql_cursor_rewind        (TrackerSparqlCursor *self);
    void                tracker_sparql_cursor_set_connection
                                                            (TrackerSparqlCursor *self,
                                                             TrackerSparqlConnection *value);

## Object Hierarchy

      GObject
       +----TrackerSparqlCursor

## Properties

      "connection"               TrackerSparqlConnection*  : Read / Write
      "n-columns"                gint                  : Read

## Description

TrackerSparqlCursor is an object which provides methods to iterate the results of a query to the Tracker Store.

## Details

### TrackerSparqlCursor

    typedef struct _TrackerSparqlCursor TrackerSparqlCursor;

The TrackerSparqlCursor object represents an iterator of results.

### tracker_sparql_cursor_get_connection ()

    TrackerSparqlConnection* tracker_sparql_cursor_get_connection
                                                            (TrackerSparqlCursor *self);

Returns the connection used to retrieve the results.

`self` : | a TrackerSparqlCursor
Returns : | a TrackerSparqlConnection. The returned object must not be freed by the caller.

### tracker_sparql_cursor_get_n_columns ()

    gint                tracker_sparql_cursor_get_n_columns (TrackerSparqlCursor *self);

Returns the number of columns available in the results to iterate.

`self` : | a TrackerSparqlCursor
Returns : | a gint with the number of columns.

### tracker_sparql_cursor_get_string ()

    const char*         tracker_sparql_cursor_get_string    (TrackerSparqlCursor *self,
                                                             gint column,
                                                             glong *length);

Returns the string at `column` in the current row being iterated.

`self` : | a TrackerSparqlCursor
`column` : | column number to retrieve (first one is 0)
`length` : | length of the returned string
Returns : | a string, which should not be freed by the caller. NULL is returned if the column number is in the [0,n_columns] range.

### tracker_sparql_cursor_next ()

    gboolean            tracker_sparql_cursor_next          (TrackerSparqlCursor *self,
                                                             GCancellable *cancellable,
                                                             GError **error);

Iterates to the next result. The API call is completely synchronous, so it may block.

`self` : | a TrackerSparqlCursor
`cancellable` : | a GCancellable used to cancel the operation
`error` : | GError for error reporting.
Returns : | FALSE if no more results found, TRUE otherwise.

### tracker_sparql_cursor_next_async ()

    void                tracker_sparql_cursor_next_async    (TrackerSparqlCursor *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);

Iterates, asynchronously, to the next result.

`self` : | a TrackerSparqlCursor
`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_sparql_cursor_next_finish ()

    gboolean            tracker_sparql_cursor_next_finish   (TrackerSparqlCursor *self,
                                                             GAsyncResult *_res_,
                                                             GError **error);

`self` : |
`_res_` : |
`error` : |
Returns : |

### tracker_sparql_cursor_rewind ()

    void                tracker_sparql_cursor_rewind        (TrackerSparqlCursor *self);

Resets the iterator to point back to the first result.

`self` : | a TrackerSparqlCursor

### tracker_sparql_cursor_set_connection ()

    void                tracker_sparql_cursor_set_connection
                                                            (TrackerSparqlCursor *self,
                                                             TrackerSparqlConnection *value);

`self` : |
`value` : |

## Property Details

### The `"connection"` property

      "connection"               TrackerSparqlConnection*  : Read / Write

The TrackerSparqlConnection used to retrieve the results.

### The `"n-columns"` property

      "n-columns"                gint                  : Read

n-columns.

Default value: 0