* Some SQL optimizations. Noticeable mostly on very slow systems with very large media libraries.

* Add basic DLNA/UPnP-AV SortCriteria support.
This commit is contained in:
Justin Maggard
2009-04-30 10:03:45 +00:00
parent 11b208a6e6
commit 226cf8bb66
4 changed files with 162 additions and 27 deletions

View File

@ -554,11 +554,10 @@ SendContainer(struct upnphttp * h, const char * objectID, int itemStart, int ite
args.start = itemStart+anchorOffset;
sqlite3Prng.isInit = 0;
asprintf(&sql, "SELECT count(*) from "
"( select 1 from OBJECTS o left join DETAILS d on (o.DETAIL_ID = d.ID)"
" where %s and (%s)"
" %s )",
which, myfilter, groupBy);
asprintf(&sql, "SELECT count(distinct DETAIL_ID) "
"from OBJECTS o left join DETAILS d on (o.DETAIL_ID = d.ID)"
" where %s and (%s)",
which, myfilter);
DPRINTF(E_DEBUG, L_TIVO, "Count SQL: %s\n", sql);
ret = sql_get_table(db, sql, &result, NULL, NULL);
if( ret == SQLITE_OK )