TrackerSparqlCursor

TrackerSparqlCursor — Iteration of the query results

Stability Level

Stable, unless otherwise indicated

Functions

Properties

TrackerSparqlConnection * connection Read / Write / Construct Only
gint n-columns Read

Types and Values

Object Hierarchy

    GObject
    ╰── TrackerSparqlCursor

Includes

#include <tracker-sparql.h>

Description

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

Functions

tracker_sparql_cursor_get_connection ()

TrackerSparqlConnection *
tracker_sparql_cursor_get_connection (TrackerSparqlCursor *cursor);

Returns the TrackerSparqlConnection associated with this TrackerSparqlCursor.

Parameters

cursor

a TrackerSparqlCursor

 

Returns

the cursor TrackerSparqlConnection. The returned object must not be unreferenced by the caller.

[transfer none]


tracker_sparql_cursor_get_n_columns ()

gint
tracker_sparql_cursor_get_n_columns (TrackerSparqlCursor *cursor);

This method should only be called after a successful tracker_sparql_cursor_next(); otherwise its return value will be undefined.

Parameters

cursor

a TrackerSparqlCursor

 

Returns

a gint representing the number of columns available in the results to iterate.


tracker_sparql_cursor_get_string ()

const gchar *
tracker_sparql_cursor_get_string (TrackerSparqlCursor *cursor,
                                  gint column,
                                  glong *length);

Retrieves a string representation of the data in the current row in column .

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

length

length of the returned string, or NULL.

[out][nullable]

Returns

a string which must not be freed. NULL is returned if the column is not in the [0,n_columns] range.


tracker_sparql_cursor_get_boolean ()

gboolean
tracker_sparql_cursor_get_boolean (TrackerSparqlCursor *cursor,
                                   gint column);

Retrieve a boolean for the current row in column .

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

Returns

a gboolean.


tracker_sparql_cursor_get_double ()

gdouble
tracker_sparql_cursor_get_double (TrackerSparqlCursor *cursor,
                                  gint column);

Retrieve a double for the current row in column .

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

Returns

a double.


tracker_sparql_cursor_get_integer ()

gint64
tracker_sparql_cursor_get_integer (TrackerSparqlCursor *cursor,
                                   gint column);

Retrieve an integer for the current row in column .

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

Returns

a gint64.


tracker_sparql_cursor_get_value_type ()

TrackerSparqlValueType
tracker_sparql_cursor_get_value_type (TrackerSparqlCursor *cursor,
                                      gint column);

The data type bound to the current row in column is returned.

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

tracker_sparql_cursor_get_variable_name ()

const gchar *
tracker_sparql_cursor_get_variable_name
                               (TrackerSparqlCursor *cursor,
                                gint column);

Retrieves the variable name for the current row in column .

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

Returns

a string which must not be freed.


tracker_sparql_cursor_close ()

void
tracker_sparql_cursor_close (TrackerSparqlCursor *cursor);

Closes the iterator, making it invalid.

Parameters

cursor

a TrackerSparqlCursor

 

tracker_sparql_cursor_is_bound ()

gboolean
tracker_sparql_cursor_is_bound (TrackerSparqlCursor *cursor,
                                gint column);

If the current row and column are bound to a value, TRUE is returned.

Parameters

cursor

a TrackerSparqlCursor

 

column

column number to retrieve (first one is 0)

 

Returns

a TRUE or FALSE.


tracker_sparql_cursor_next ()

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

Iterates to the next result. This is completely synchronous and it may block.

Parameters

cursor

a TrackerSparqlCursor

 

cancellable

a GCancellable used to cancel the operation

 

error

GError for error reporting.

 

Returns

FALSE if no more results found, otherwise TRUE.


tracker_sparql_cursor_next_async ()

void
tracker_sparql_cursor_next_async (TrackerSparqlCursor *cursor,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

Iterates, asynchronously, to the next result.

Parameters

cursor

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 *cursor,
                                   GAsyncResult *res,
                                   GError **error);

Finishes the asynchronous iteration to the next result.

Parameters

cursor

a TrackerSparqlCursor

 

res

a GAsyncResult with the result of the operation

 

error

GError for error reporting.

 

Returns

FALSE if no more results found, otherwise TRUE.


tracker_sparql_cursor_rewind ()

void
tracker_sparql_cursor_rewind (TrackerSparqlCursor *cursor);

Resets the iterator to point back to the first result.

Parameters

cursor

a TrackerSparqlCursor

 

Types and Values

TrackerSparqlCursor

typedef struct _TrackerSparqlCursor TrackerSparqlCursor;

The TrackerSparqlCursor object represents an iterator of results.


enum TrackerSparqlValueType

Enumeration with the possible types of the cursor's cells

Members

TRACKER_SPARQL_VALUE_TYPE_UNBOUND

Unbound value type

 

TRACKER_SPARQL_VALUE_TYPE_URI

Uri value type, rdfs:Resource

 

TRACKER_SPARQL_VALUE_TYPE_STRING

String value type, xsd:string

 

TRACKER_SPARQL_VALUE_TYPE_INTEGER

Integer value type, xsd:integer

 

TRACKER_SPARQL_VALUE_TYPE_DOUBLE

Double value type, xsd:double

 

TRACKER_SPARQL_VALUE_TYPE_DATETIME

Datetime value type, xsd:dateTime

 

TRACKER_SPARQL_VALUE_TYPE_BLANK_NODE

Blank node value type

 

TRACKER_SPARQL_VALUE_TYPE_BOOLEAN

Boolean value type, xsd:boolean

 

Property Details

The “connection” property

  “connection”               TrackerSparqlConnection *

The TrackerSparqlConnection used to retrieve the results.

Owner: TrackerSparqlCursor

Flags: Read / Write / Construct Only


The “n-columns” property

  “n-columns”                gint

n-columns.

Owner: TrackerSparqlCursor

Flags: Read

Default value: 0