initial support for sqlite

This commit is contained in:
Ron Pedde 2005-03-01 04:19:27 +00:00
parent e87373943c
commit c86be33245
4 changed files with 1400 additions and 3 deletions

View File

@ -14,6 +14,9 @@ AM_PROG_LEX
AC_CANONICAL_HOST
AM_CONDITIONAL(COND_REND_OSX,false)
use_gdbm=true
use_sqlite=false
rend_posix=true
STATIC_LIBS=no
@ -55,6 +58,12 @@ AC_ARG_ENABLE(flac,[ --enable-flac Enable FLAC support],
use_flac=true;
CPPFLAGS="${CPPFLAGS} -DFLAC")
AC_ARG_ENABLE(sqlite,[ --enable-sqlite Enable SQLite backend],
use_sqlite=true;
LDFLAGS="${LDFLAGS} -lsqlite";
use_gdbm=false)
AM_CONDITIONAL(COND_REND_HOWL, test x$rend_howl = xtrue)
AM_CONDITIONAL(COND_REND_POSIX, test x$rend_posix = xtrue)
AM_CONDITIONAL(COND_OGGVORBIS, test x$use_oggvorbis = xtrue)
@ -63,6 +72,9 @@ AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue)
AM_CONDITIONAL(COND_NEED_STRCASESTR,false)
AM_CONDITIONAL(COND_NEED_STRSEP,false)
AM_CONDITIONAL(COND_SQLITE,test x$use_sqlite = xtrue)
AM_CONDITIONAL(COND_GDBM,test x$use_gdbm = xtrue)
dnl Darwin's stupid cpp preprocessor....
echo Host type is $host
CPPFLAGS="$CPPFLAGS -DHOST='\"$host\"'"
@ -141,6 +153,7 @@ AC_ARG_WITH(id3tag,
])
AC_CHECK_HEADERS(getopt.h,,)
AC_CHECK_HEADERS(gdbm.h,, [
AC_MSG_ERROR([gdbm.h not found... try --with-gdbm-includes=dir])])
AC_CHECK_LIB(gdbm,gdbm_open,,echo "no libgdbm. Try --with-gdbm-lib=dir";exit)

44
contrib/sqlite.sql Normal file
View File

@ -0,0 +1,44 @@
DROP TABLE songs;
DROP TABLE config;
CREATE TABLE songs (
id INTEGER PRIMARY KEY NOT NULL,
path VARCHAR(4096) NOT NULL,
fname VARCHAR(255) NOT NULL,
title VARCHAR(1024) DEFAULT NULL,
artist VARCHAR(1024) DEFAULT NULL,
album VARCHAR(1024) DEFAULT NULL,
genre VARCHAR(255) DEFAULT NULL,
comment VARCHAR(4096) DEFAULT NULL,
type VARCHAR(255) DEFAULT NULL,
composer VARCHAR(1024) DEFAULT NULL,
orchestra VARCHAR(1024) DEFAULT NULL,
conductor VARCHAR(1024) DEFAULT NULL,
grouping VARCHAR(1024) DEFAULT NULL,
url VARCHAR(1024) DEFAULT NULL,
bitrate INTEGER DEFAULT NULL,
samplerate INTEGER DEFAULT NULL,
song_length INTEGER DEFAULT NULL,
file_size INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
track INTEGER DEFAULT NULL,
total_tracks INTEGER DEFAULT NULL,
disc INTEGER DEFAULT NULL,
total_discs INTEGER DEFAULT NULL,
time_added INTEGER DEFAULT NULL,
time_modified INTEGER DEFAULT NULL,
time_played INTEGER DEFAULT NULL,
db_timestamp INTEGER DEFAULT NULL,
bpm INTEGER DEFAULT NULL,
compilation INTEGER DEFAULT NULL
);
CREATE TABLE config (
term VARCHAR(255) NOT NULL,
value VARCHAR(1024) NOT NULL
);
CREATE INDEX idx_id ON songs(id);
CREATE INDEX idx_path on songs(path);
INSERT INTO config (term, value) VALUES ('version','8');

View File

@ -27,19 +27,28 @@ if COND_FLAC
FLACSRC=flac.c
endif
if COND_GDBM
GDBMDB=db-gdbm.c
endif
if COND_SQLITE
SQLITEDB=db-sqlite.c
endif
wavstreamer_SOURCES = wavstreamer.c
mt_daapd_SOURCES = main.c daapd.h rend.h uici.c uici.h webserver.c \
webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \
daap-proto.c daap-proto.h daap.c daap.h db-gdbm.c db-memory.h \
daap-proto.c daap-proto.h daap.c daap.h db-memory.h \
mp3-scanner.h mp3-scanner.c playlist.c playlist.h \
rend-unix.h lexer.l parser.y strcasestr.c strcasestr.h strsep.c \
redblack.c redblack.h dynamic-art.c dynamic-art.h query.c query.h \
xml-rpc.h xml-rpc.c ssc.c ssc.h \
$(PRENDSRC) $(ORENDSRC) $(HRENDSRC) $(OGGVORBISSRC) $(FLACSRC)
$(PRENDSRC) $(ORENDSRC) $(HRENDSRC) $(OGGVORBISSRC) $(FLACSRC) \
$(GDBMDB) $(SQLITEDB)
EXTRA_DIST = mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c \
mDNSUNP.c mDNSPlatformFunctions.h mDNSPosix.h mDNSUNP.h \
rend-howl.c rend-posix.c rend-osx.c db-memory.c \
db-gdbm.c strcasestr.h redblack.c redblack.h db-memory.c \
parser.h ogg.c flac.c
parser.h ogg.c flac.c db-gdbm.c db-sqlite.c

1331
src/db-sqlite.c Normal file

File diff suppressed because it is too large Load Diff