DbApi: fix bugs in getPlaylistsWhere.

This commit is contained in:
Jonathan Bernard 2016-03-29 16:46:03 -05:00
parent 26f49d438d
commit 3d6d51b5ce

View File

@ -167,7 +167,7 @@ public class DbApi {
def query = new StringBuilder()
.append('DELETE FROM ')
.append(pluralize(nameFromModel(model.class.simpleName)))
.append('WHERE id = ?')
.append(' WHERE id = ?')
.toString()
logger.debug('Deleting model.\n\tSQL: {}\n\tPARAMS: {}',
@ -556,10 +556,12 @@ public class DbApi {
if (params.albumId || params.artistId || params.mediaFileId) {
query.append(' JOIN playlists_media_files pmf ON ')
.append(' pmf.media_file_id = mf.id ') }
.append(' pmf.playlist_id = p.id ')
.append(' JOIN media_files mf ON ')
.append(' pmf.media_file_id = mf.id ') }
if (params.mediaFileId) {
query.append(' AND mf.media_file_id = ? ')
query.append(' AND mf.id = ? ')
sqlParams << params.mediaFileId }
if (params.albumId) {