Fix tag retrieval.

This commit is contained in:
Jonathan Bernard 2016-03-14 05:44:29 -05:00
parent e1f64b7b86
commit fe80bed570

View File

@ -738,7 +738,7 @@ public class ORM {
def query = new StringBuilder()
def sqlParams = []
query.append('SELECT DISTINCT t.* FROM tags ')
query.append('SELECT DISTINCT t.* FROM tags t ')
if (params.mediaFileId || params.artistId || params.albumId ||
params.playlistId)
@ -768,7 +768,12 @@ public class ORM {
if (params.name) {
query.append(' WHERE t.name = ? ')
sqlParams << params.name } }
sqlParams << params.name }
query = query.toString()
logger.debug('Selecting tags.\n\tSQL: {}\n\tPARAMS: {}',
query, sqlParams)
return sql.rows(query, sqlParams).collect { recordToModel(Tag, it) } }
public def tagMediaFiles(List<Integer> mediaFileIds, List<String> tagNames) {
String insertQuery = 'INSERT INTO media_files_tags VALUES (?, ?)'