DbApi: fix bugs in getPlaylistsWhere.
This commit is contained in:
parent
26f49d438d
commit
3d6d51b5ce
@ -167,7 +167,7 @@ public class DbApi {
|
|||||||
def query = new StringBuilder()
|
def query = new StringBuilder()
|
||||||
.append('DELETE FROM ')
|
.append('DELETE FROM ')
|
||||||
.append(pluralize(nameFromModel(model.class.simpleName)))
|
.append(pluralize(nameFromModel(model.class.simpleName)))
|
||||||
.append('WHERE id = ?')
|
.append(' WHERE id = ?')
|
||||||
.toString()
|
.toString()
|
||||||
|
|
||||||
logger.debug('Deleting model.\n\tSQL: {}\n\tPARAMS: {}',
|
logger.debug('Deleting model.\n\tSQL: {}\n\tPARAMS: {}',
|
||||||
@ -556,10 +556,12 @@ public class DbApi {
|
|||||||
|
|
||||||
if (params.albumId || params.artistId || params.mediaFileId) {
|
if (params.albumId || params.artistId || params.mediaFileId) {
|
||||||
query.append(' JOIN playlists_media_files pmf ON ')
|
query.append(' JOIN playlists_media_files pmf ON ')
|
||||||
|
.append(' pmf.playlist_id = p.id ')
|
||||||
|
.append(' JOIN media_files mf ON ')
|
||||||
.append(' pmf.media_file_id = mf.id ') }
|
.append(' pmf.media_file_id = mf.id ') }
|
||||||
|
|
||||||
if (params.mediaFileId) {
|
if (params.mediaFileId) {
|
||||||
query.append(' AND mf.media_file_id = ? ')
|
query.append(' AND mf.id = ? ')
|
||||||
sqlParams << params.mediaFileId }
|
sqlParams << params.mediaFileId }
|
||||||
|
|
||||||
if (params.albumId) {
|
if (params.albumId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user