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 35 |
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 | create_Media_stm [] = "create table Media (id integer, key, value, source integer)" |
const char | create_Sources_stm [] = "create table Sources (id integer primary key AUTOINCREMENT, source)" |
const char | create_Playlist_stm [] = "create table Playlist (id primary key, name, pos integer)" |
const char | create_PlaylistEntries_stm [] = "create table PlaylistEntries (playlist_id int, entry, pos integer primary key AUTOINCREMENT)" |
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_idx_stm [] = "create index playlist_idx on Playlist (name);" |
const char | create_collidx_stm [] = "create index collectionlabels_idx on CollectionLabels (collid);" |
Sqlite Backend.
Definition in file sqlite.c.
#define DB_VERSION 35 |
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)" |
Definition at line 44 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_CollectionConnections_stm[] = "create table CollectionConnections (from_id integer, to_id integer)" |
Definition at line 45 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_CollectionIdlists_stm[] = "create table CollectionIdlists (collid integer, position integer, mid integer)" |
Definition at line 46 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_CollectionLabels_stm[] = "create table CollectionLabels (collid integer, namespace integer, name text)" |
Definition at line 47 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_CollectionOperators_stm[] = "create table CollectionOperators (id integer primary key AUTOINCREMENT, type integer)" |
Definition at line 48 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_collidx_stm[] = "create index collectionlabels_idx on CollectionLabels (collid);" |
Definition at line 76 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_idx_stm[] = "create index playlist_idx on Playlist (name);" |
Definition at line 68 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_Media_stm[] = "create table Media (id integer, key, value, source integer)" |
Definition at line 40 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_Playlist_stm[] = "create table Playlist (id primary key, name, pos integer)" |
Definition at line 42 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_PlaylistEntries_stm[] = "create table PlaylistEntries (playlist_id int, entry, pos integer primary key AUTOINCREMENT)" |
Definition at line 43 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char create_Sources_stm[] = "create table Sources (id integer primary key AUTOINCREMENT, source)" |
Definition at line 41 of file sqlite.c.
Referenced by xmms_sqlite_create().
const char fill_init_playlist_stm[] = "INSERT INTO CollectionIdlists VALUES(1, 1, 1);" |
Definition at line 63 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 54 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().