RygelDatabaseCursorIterator: librygel-db Reference Manual

## RygelDatabaseCursorIterator RygelDatabaseCursorIterator |

## Functions

void | rygel_database_cursor_bind ()
gboolean | rygel_database_cursor_has_next ()
sqlite3_stmt * | rygel_database_cursor_next ()
RygelDatabaseCursorIterator * | rygel_database_cursor_iterator ()
void | rygel_database_cursor_throw_if_code_is_error ()
void | rygel_database_cursor_throw_if_db_has_error ()
gboolean | rygel_database_cursor_iterator_next ()
sqlite3_stmt * | rygel_database_cursor_iterator_get ()
RygelDatabaseCursorIterator * | rygel_database_cursor_iterator_new ()
gpointer | rygel_database_cursor_iterator_ref ()
void | rygel_database_cursor_iterator_unref ()
GParamSpec * | rygel_database_cursor_param_spec_iterator ()
void | rygel_database_cursor_value_set_iterator ()
gpointer | rygel_database_cursor_value_get_iterator ()
void | rygel_database_cursor_value_take_iterator ()
RygelDatabaseCursor * | rygel_database_cursor_new ()

## Types and Values

#define | RYGEL_DATABASE_TYPE_CURSOR
#define | RYGEL_DATABASE_CURSOR_TYPE_ITERATOR
struct | RygelDatabaseCursorIterator
struct | RygelDatabaseCursorIteratorClass
struct | RygelDatabaseCursor
struct | RygelDatabaseCursorClass

## Object Hierarchy

        GObject
        ╰── RygelDatabaseCursor
        RygelDatabaseCursorIterator

## Description

## Functions

### rygel_database_cursor_bind ()

    void
    rygel_database_cursor_bind (RygelDatabaseCursor *self,
                                GValue *arguments,
                                int arguments_length1,
                                GError **error);

Bind new values to a cursor.

The cursor will be reset.

This function uses the type of the GValue passed in values to determine which _bind function to use.

Supported types are: int, long, int64, uint64, string and pointer. Note: The only pointer supported is the null pointer as provided by Database.`null`. This is a special value to bind a column to NULL

#### Parameters

self | the RygelDatabaseCursor instance |
arguments | . array of values to bind to the SQL statement or null if none . | [in][allow-none][array length=arguments_length1]
arguments_length1 | length of the `arguments` array |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

### rygel_database_cursor_has_next ()

    gboolean
    rygel_database_cursor_has_next (RygelDatabaseCursor *self,
                                    GError **error);

Check if the cursor has more rows left

#### Parameters

self | the RygelDatabaseCursor instance |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

#### Returns

true if more rows left, false otherwise

### rygel_database_cursor_next ()

    sqlite3_stmt *
    rygel_database_cursor_next (RygelDatabaseCursor *self,
                                GError **error);

Get the next row of this cursor.

This function uses pointers instead of unowned because var doesn't work with unowned.

#### Parameters

self | the RygelDatabaseCursor instance |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

#### Returns

a pointer to the current row

### rygel_database_cursor_iterator ()

    RygelDatabaseCursorIterator *
    rygel_database_cursor_iterator (RygelDatabaseCursor *self);

Return an iterator to the cursor to use with foreach

#### Parameters

self | the RygelDatabaseCursor instance |

#### Returns

an iterator wrapping the cursor

### rygel_database_cursor_throw_if_code_is_error ()

    void
    rygel_database_cursor_throw_if_code_is_error
                                   (RygelDatabaseCursor *self,
                                    gint sqlite_error,
                                    GError **error);

Convert a SQLite return code to a DatabaseError

#### Parameters

self | the RygelDatabaseCursor instance |
sqlite_error |  |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

### rygel_database_cursor_throw_if_db_has_error ()

    void
    rygel_database_cursor_throw_if_db_has_error
                                   (RygelDatabaseCursor *self,
                                    GError **error);

Check if the last operation on the database was an error

#### Parameters

self | the RygelDatabaseCursor instance |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

### rygel_database_cursor_iterator_next ()

    gboolean
    rygel_database_cursor_iterator_next (RygelDatabaseCursorIterator *self,
                                         GError **error);

#### Parameters

self | the RygelDatabaseCursorIterator instance |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

### rygel_database_cursor_iterator_get ()

    sqlite3_stmt *
    rygel_database_cursor_iterator_get (RygelDatabaseCursorIterator *self,
                                        GError **error);

#### Parameters

self | the RygelDatabaseCursorIterator instance |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

#### Returns

.

[transfer none]

### rygel_database_cursor_iterator_new ()

    RygelDatabaseCursorIterator *
    rygel_database_cursor_iterator_new (RygelDatabaseCursor *cursor);

#### Parameters

cursor |  |

### rygel_database_cursor_iterator_ref ()

    gpointer
    rygel_database_cursor_iterator_ref (gpointer instance);

Increases the reference count of `object` .

#### Parameters

instance | a RygelDatabaseCursorIterator. |

#### Returns

the same `object`

### rygel_database_cursor_iterator_unref ()

    void
    rygel_database_cursor_iterator_unref (gpointer instance);

Decreases the reference count of `object` . When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

#### Parameters

instance | a RygelDatabaseCursorIterator. |

### rygel_database_cursor_param_spec_iterator ()

    GParamSpec *
    rygel_database_cursor_param_spec_iterator
                                   (const gchar *name,
                                    const gchar *nick,
                                    const gchar *blurb,
                                    GType object_type,
                                    GParamFlags flags);

Creates a new GParamSpecBoxed instance specifying a `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived property.

See ``g_param_spec_internal()`` for details on property names.

#### Parameters

name | canonical name of the property specified |
nick | nick name for the property specified |
blurb | description of the property specified |
object_type | `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived type of this property |
flags | flags for the property specified |

### rygel_database_cursor_value_set_iterator ()

    void
    rygel_database_cursor_value_set_iterator
                                   (GValue *value,
                                    gpointer v_object);

Set the contents of a `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived GValue to `v_object` .

`rygel_database_cursor_value_set_iterator()` increases the reference count of `v_object` (the GValue holds a reference to `v_object`). If you do not wish to increase the reference count of the object (i.e. you wish to pass your current reference to the GValue because you no longer need it), use `rygel_database_cursor_value_take_iterator()` instead.

It is important that your GValue holds a reference to `v_object` (either its own, or one it has taken) to ensure that the object won't be destroyed while the GValue still exists).

#### Parameters

value | a valid GValue of `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived type |
v_object | object value to be set |

### rygel_database_cursor_value_get_iterator ()

    gpointer
    rygel_database_cursor_value_get_iterator
                                   (const GValue *value);

Get the contents of a `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived GValue.

#### Parameters

value | a valid GValue of `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived type |

#### Returns

object contents of `value`

### rygel_database_cursor_value_take_iterator ()

    void
    rygel_database_cursor_value_take_iterator
                                   (GValue *value,
                                    gpointer v_object);

Sets the contents of a `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived GValue to `v_object` and takes over the ownership of the callers reference to `v_object` ; the caller doesn't have to unref it any more (i.e. the reference count of the object is not increased).

If you want the GValue to hold its own reference to `v_object` , use `rygel_database_cursor_value_set_iterator()` instead.

#### Parameters

value | a valid GValue of `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR` derived type |
v_object | object value to be set |

### rygel_database_cursor_new ()

    RygelDatabaseCursor *
    rygel_database_cursor_new (sqlite3 *db,
                               const gchar *sql,
                               GValue *arguments,
                               int arguments_length1,
                               GError **error);

Prepare a SQLite statement from a SQL string

If `arguments` is non-null, it will call `bind()`

#### Parameters

db | . SQLite database this cursor belongs to . | [in]
sql | . statement to execute . | [in]
arguments | . array of values to bind to the SQL statement or null if none . | [in][allow-none][array length=arguments_length1]
arguments_length1 | length of the `arguments` array |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

## Types and Values

### RYGEL_DATABASE_TYPE_CURSOR

    #define RYGEL_DATABASE_TYPE_CURSOR (rygel_database_cursor_get_type ())

The type for RygelDatabaseCursor.

### RYGEL_DATABASE_CURSOR_TYPE_ITERATOR

    #define RYGEL_DATABASE_CURSOR_TYPE_ITERATOR (rygel_database_cursor_iterator_get_type ())

The type for RygelDatabaseCursorIterator.

### struct RygelDatabaseCursorIterator

    struct RygelDatabaseCursorIterator;

### struct RygelDatabaseCursorIteratorClass

    struct RygelDatabaseCursorIteratorClass {
    	GTypeClass parent_class;
    	void (*finalize) (RygelDatabaseCursorIterator *self);
    };

The class structure for `RYGEL_DATABASE_CURSOR_TYPE_ITERATOR`. All the fields in this structure are private and should never be accessed directly.

#### Members

`finalize` () |  |

### struct RygelDatabaseCursor

    struct RygelDatabaseCursor;

### struct RygelDatabaseCursorClass

    struct RygelDatabaseCursorClass {
    	GObjectClass parent_class;
    };

The class structure for `RYGEL_DATABASE_TYPE_CURSOR`. All the fields in this structure are private and should never be accessed directly.

#### Members