XMMS2
|
Sqlite Backend. More...
#include <stdio.h>
#include <stdlib.h>
#include "xmms/xmms_config.h"
#include "xmms/xmms_log.h"
#include "xmmspriv/xmms_sqlite.h"
#include "xmmspriv/xmms_statfs.h"
#include "xmmspriv/xmms_utils.h"
#include "xmmspriv/xmms_collection.h"
#include "xmmsc/xmmsc_idnumbers.h"
#include <sqlite3.h>
#include <string.h>
#include <glib.h>
Go to the source code of this file.
Defines | |
#define | DB_VERSION 36 |
Functions | |
gboolean | xmms_sqlite_create (gboolean *create) |
sqlite3 * | xmms_sqlite_open () |
Open a database or create a new one. | |
gboolean | xmms_sqlite_exec (sqlite3 *sql, const char *query,...) |
A query that can't retrieve results. | |
gboolean | xmms_sqlite_query_table (sqlite3 *sql, xmms_medialib_row_table_method_t method, gpointer udata, xmms_error_t *error, const gchar *query,...) |
Execute a query to the database. | |
gboolean | xmms_sqlite_query_array (sqlite3 *sql, xmms_medialib_row_array_method_t method, gpointer udata, const gchar *query,...) |
gboolean | xmms_sqlite_query_int (sqlite3 *sql, gint32 *out, const gchar *query,...) |
void | xmms_sqlite_close (sqlite3 *sql) |
Close database and free all resources used. | |
void | xmms_sqlite_print_version (void) |
gchar * | sqlite_prepare_string (const gchar *input) |
Variables | |
const char | set_version_stm [] = "PRAGMA user_version=" XMMS_STRINGIFY (DB_VERSION) |
const char * | tables [] |
const char * | views [] |
const char * | triggers [] |
const char * | indices [] |
const char | create_CollectionAttributes_stm [] = "create table CollectionAttributes (collid integer, key text, value text)" |
const char | create_CollectionConnections_stm [] = "create table CollectionConnections (from_id integer, to_id integer)" |
const char | create_CollectionIdlists_stm [] = "create table CollectionIdlists (collid integer, position integer, mid integer)" |
const char | create_CollectionLabels_stm [] = "create table CollectionLabels (collid integer, namespace integer, name text)" |
const char | create_CollectionOperators_stm [] = "create table CollectionOperators (id integer primary key AUTOINCREMENT, type integer)" |
const char | fill_stats [] = "INSERT INTO sqlite_stat1 VALUES('CollectionAttributes', 'collectionattributes_idx', '2 2 1');" |
This magic numbers are taken from ANALYZE on a big database, if we change the db layout drasticly we need to redo them! | |
const char | fill_init_playlist_stm [] = "INSERT INTO CollectionIdlists VALUES(1, 1, 1);" |
const char | create_collidx_stm [] = "create index collectionlabels_idx on CollectionLabels (collid);" |
Sqlite Backend.
Definition in file sqlite.c.
#define DB_VERSION 36 |
Definition at line 37 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_CollectionAttributes_stm[] = "create table CollectionAttributes (collid integer, key text, value text)" |
const char create_CollectionConnections_stm[] = "create table CollectionConnections (from_id integer, to_id integer)" |
const char create_CollectionIdlists_stm[] = "create table CollectionIdlists (collid integer, position integer, mid integer)" |
const char create_CollectionLabels_stm[] = "create table CollectionLabels (collid integer, namespace integer, name text)" |
const char create_CollectionOperators_stm[] = "create table CollectionOperators (id integer primary key AUTOINCREMENT, type integer)" |
const char create_collidx_stm[] = "create index collectionlabels_idx on CollectionLabels (collid);" |
const char fill_init_playlist_stm[] = "INSERT INTO CollectionIdlists VALUES(1, 1, 1);" |
Definition at line 121 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char fill_stats[] = "INSERT INTO sqlite_stat1 VALUES('CollectionAttributes', 'collectionattributes_idx', '2 2 1');" |
This magic numbers are taken from ANALYZE on a big database, if we change the db layout drasticly we need to redo them!
Definition at line 112 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char* indices[] |
{ "CREATE INDEX id_key_value_1x ON Media (id, key, value COLLATE BINARY)", "CREATE INDEX id_key_value_2x ON Media (id, key, value COLLATE NOCASE)", "CREATE INDEX key_value_1x ON Media (key, value COLLATE BINARY)", "CREATE INDEX key_value_2x ON Media (key, value COLLATE NOCASE)", "CREATE INDEX collectionlabels_idx ON CollectionLabels (collid)", NULL }
Definition at line 89 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char set_version_stm[] = "PRAGMA user_version=" XMMS_STRINGIFY (DB_VERSION) |
Definition at line 39 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char* tables[] |
Definition at line 42 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char* triggers[] |
const char* views[] |