## RygelDatabaseDatabase

RygelDatabaseDatabase — This class is a thin wrapper around SQLite's database object.

## Functions

RygelDatabaseCursor * | rygel_database_database_exec_cursor ()
void | rygel_database_database_exec ()
gint | rygel_database_database_query_value ()
void | rygel_database_database_analyze ()
void | rygel_database_database_begin ()
void | rygel_database_database_commit ()
void | rygel_database_database_rollback ()
gboolean | rygel_database_database_is_empty ()
RygelDatabaseDatabase * | rygel_database_database_new ()
void | rygel_database_database_set_name ()
void | rygel_database_database_set_flavor ()
void | rygel_database_database_set_flags ()
void | rygel_database_database_utf8_contains ()
gint | rygel_database_database_utf8_collate ()
void | rygel_database_null ()

## Properties

RygelDatabaseFlags | flags | Write / Construct
RygelDatabaseFlavor | flavor | Write / Construct
gchar * | name | Write / Construct

## Types and Values

#define | RYGEL_DATABASE_TYPE_DATABASE
struct | RygelDatabaseDatabase
struct | RygelDatabaseDatabaseClass
enum | RygelDatabaseFlavor
enum | RygelDatabaseFlags
enum | RygelDatabaseDatabaseError

## Object Hierarchy

        GEnum
        ├── RygelDatabaseFlags
        ╰── RygelDatabaseFlavor
        GObject
        ╰── RygelDatabaseDatabase

## Implemented Interfaces

RygelDatabaseDatabase implements GInitable.

## Description

It adds statement preparation based on GValue and a cancellable exec function.

## Functions

### rygel_database_database_exec_cursor ()

    RygelDatabaseCursor *
    rygel_database_database_exec_cursor (RygelDatabaseDatabase *self,
                                         const gchar *sql,
                                         GValue *arguments,
                                         int arguments_length1,
                                         GError **error);

SQL query function.

Use for all queries that return a result set.

RygelDatabaseDatabaseError will be returned in `error`

if the underlying SQLite operation fails.

#### Parameters

self | the RygelDatabaseDatabase instance |
sql | . The SQL query to run. . | [in]
arguments | . Values to bind in the SQL query or null. . | [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_database_exec ()

    void
    rygel_database_database_exec (RygelDatabaseDatabase *self,
                                  const gchar *sql,
                                  GValue *arguments,
                                  int arguments_length1,
                                  GError **error);

Simple SQL query execution function.

Use for all queries that don't return anything.

RygelDatabaseDatabaseError will be returned in `error`

if the underlying SQLite operation fails.

#### Parameters

self | the RygelDatabaseDatabase instance |
sql | . The SQL query to run. . | [in]
arguments | . Values to bind in the SQL query or null. . | [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_database_query_value ()

    gint
    rygel_database_database_query_value (RygelDatabaseDatabase *self,
                                         const gchar *sql,
                                         GValue *args,
                                         int args_length1,
                                         GError **error);

Execute a SQL query that returns a single number.

RygelDatabaseDatabaseError will be returned in `error`

if the underlying SQLite operation fails.

#### Parameters

self | the RygelDatabaseDatabase instance |
sql | . The SQL query to run. . | [in]
args | . Values to bind in the SQL query or null. . | [in][allow-none][array length=args_length1]
args_length1 | length of the `args` array |
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

#### Returns

The contents of the first row's column as an int.

### rygel_database_database_analyze ()

    void
    rygel_database_database_analyze (RygelDatabaseDatabase *self);

Analyze triggers of database

#### Parameters

self | the RygelDatabaseDatabase instance |

### rygel_database_database_begin ()

    void
    rygel_database_database_begin (RygelDatabaseDatabase *self,
                                   GError **error);

Start a transaction

#### Parameters

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

### rygel_database_database_commit ()

    void
    rygel_database_database_commit (RygelDatabaseDatabase *self,
                                    GError **error);

Commit a transaction

#### Parameters

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

### rygel_database_database_rollback ()

    void
    rygel_database_database_rollback (RygelDatabaseDatabase *self);

Rollback a transaction

#### Parameters

self | the RygelDatabaseDatabase instance |

### rygel_database_database_is_empty ()

    gboolean
    rygel_database_database_is_empty (RygelDatabaseDatabase *self,
                                      GError **error);

Check for an empty SQLite database.

RygelDatabaseDatabaseError will be returned in `error`

if the SQLite meta table does not exist which usually indicates that the file is not a databsae

#### Parameters

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

#### Returns

true if the file is an empty SQLite database, false otherwise

### rygel_database_database_new ()

    RygelDatabaseDatabase *
    rygel_database_database_new (const gchar *name,
                                 RygelDatabaseFlavor flavor,
                                 RygelDatabaseFlags flags,
                                 GError **error);

Connect to a SQLite database file

#### Parameters

name | . Name of the database which is used to create the file-name . | [in]
flavor | . Specifies the flavor of the database . | [in]
flags | . How to open the database . | [in]
error | location to store the error occuring, or `NULL` to ignore. | [error-domains RygelDatabaseDatabaseError]

### rygel_database_database_set_name ()

    void
    rygel_database_database_set_name (RygelDatabaseDatabase *self,
                                      const gchar *value);

Set the value of the "name" property to `value` .

#### Parameters

self | the RygelDatabaseDatabase instance to modify |
value | the new value of the "name" property |

### rygel_database_database_set_flavor ()

    void
    rygel_database_database_set_flavor (RygelDatabaseDatabase *self,
                                        RygelDatabaseFlavor value);

Set the value of the "flavor" property to `value` .

#### Parameters

self | the RygelDatabaseDatabase instance to modify |
value | the new value of the "flavor" property |

### rygel_database_database_set_flags ()

    void
    rygel_database_database_set_flags (RygelDatabaseDatabase *self,
                                       RygelDatabaseFlags value);

Set the value of the "flags" property to `value` .

#### Parameters

self | the RygelDatabaseDatabase instance to modify |
value | the new value of the "flags" property |

### rygel_database_database_utf8_contains ()

    void
    rygel_database_database_utf8_contains (sqlite3_context *context,
                                           sqlite3_value **args,
                                           int args_length1);

Function to implement the custom SQL function 'contains'

#### Parameters

args_length1 | length of the `args` array |
context |  |
args |  |

### rygel_database_database_utf8_collate ()

    gint
    rygel_database_database_utf8_collate (gint alen,
                                          void *a,
                                          gint blen,
                                          void *b);

Function to implement the custom SQLite collation 'CASEFOLD'.

Uses utf8 case-fold to compare the strings.

#### Parameters

alen |  |
a |  |
blen |  |
b |  |

### rygel_database_null ()

    void
    rygel_database_null (GValue *result);

Special GValue to pass to exec or exec_cursor to bind a column to NULL

#### Parameters

self | the (null) instance |

## Types and Values

### RYGEL_DATABASE_TYPE_DATABASE

    #define RYGEL_DATABASE_TYPE_DATABASE (rygel_database_database_get_type ())

The type for RygelDatabaseDatabase.

### struct RygelDatabaseDatabase

    struct RygelDatabaseDatabase;

This class is a thin wrapper around SQLite's database object.

It adds statement preparation based on GValue and a cancellable exec function.

### struct RygelDatabaseDatabaseClass

    struct RygelDatabaseDatabaseClass {
    	GObjectClass parent_class;
    };

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

#### Members

### enum RygelDatabaseFlavor

#### Members

RYGEL_DATABASE_FLAVOR_CACHE |  |
RYGEL_DATABASE_FLAVOR_CONFIG |  |
RYGEL_DATABASE_FLAVOR_FOREIGN |  |

### enum RygelDatabaseFlags

#### Members

RYGEL_DATABASE_FLAGS_READ_ONLY |  |
RYGEL_DATABASE_FLAGS_WRITE_ONLY |  |
RYGEL_DATABASE_FLAGS_READ_WRITE |  |
RYGEL_DATABASE_FLAGS_SHARED |  |

### enum RygelDatabaseDatabaseError

#### Members

RYGEL_DATABASE_DATABASE_ERROR_SQLITE_ERROR |  |
RYGEL_DATABASE_DATABASE_ERROR_OPEN |  |
RYGEL_DATABASE_DATABASE_ERROR_PREPARE |  |
RYGEL_DATABASE_DATABASE_ERROR_BIND |  |
RYGEL_DATABASE_DATABASE_ERROR_STEP |  |

## Property Details

### The `“flags”` property

      “flags”                    RygelDatabaseFlags

flags.

Flags: Write / Construct

Default value: RYGEL_DATABASE_FLAGS_READ_WRITE

### The `“flavor”` property

      “flavor”                   RygelDatabaseFlavor

flavor.

Flags: Write / Construct

Default value: RYGEL_DATABASE_FLAVOR_CACHE

### The `“name”` property

      “name”                     gchar *

name.

Flags: Write / Construct

Default value: NULL