From 97652ba6fa0f134cbf14b172ade74e7a0fe70ff6 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Wed, 26 Oct 2005 06:23:27 +0000 Subject: [PATCH] simpler queries for nslu2... speed up playlist enumeration --- src/dbs-sqlite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dbs-sqlite.c b/src/dbs-sqlite.c index 195c6689..85aa4e1f 100644 --- a/src/dbs-sqlite.c +++ b/src/dbs-sqlite.c @@ -817,10 +817,16 @@ int db_sqlite_enum_start(DBQUERYINFO *pinfo) { sprintf(query_rest,"WHERE (%s)",where_clause); free(where_clause); } else { - sprintf(query_select,"SELECT * FROM songs,playlistitems "); sprintf(query_count,"SELECT COUNT(id) FROM songs "); + +#ifdef NSLU2 + sprintf(query_select,"select * from songs "); + sprintf(query_rest,"where songs.id in (select songid from playlistitems where playlistid=%d)",pinfo->playlist_id); +#else + sprintf(query_select,"SELECT * FROM songs,playlistitems "); sprintf(query_rest,"WHERE (songs.id=playlistitems.songid and playlistitems.playlistid=%d) ORDER BY playlistitems.id", pinfo->playlist_id); +#endif } sqlite_free_table(resarray); db_sqlite_unlock();