Minor change in quotation of SQL strigns.

This commit is contained in:
Jonathan Bernard 2016-03-08 10:40:48 -06:00
parent 710083131a
commit 32ad70c405

View File

@ -369,45 +369,45 @@ public class ORM {
def orderClauses = [] as LinkedList
def whereClauses = []
query.append("SELECT mf.* FROM media_files mf ")
query.append('SELECT mf.* FROM media_files mf ')
if (params.artistId) {
query.append(" JOIN artists_media_files armf ON ")
.append(" mf.id = armf.media_file_id AND ")
query.append(" armf.artist_id = ? ")
query.append(' JOIN artists_media_files armf ON ')
.append(' mf.id = armf.media_file_id AND ')
query.append(' armf.artist_id = ? ')
sqlParams << params.artistId
orderClauses << "armf.artist_id" }
orderClauses << 'armf.artist_id' }
if (params.albumId) {
query.append(" JOIN albums_media_files almf ON ")
.append(" mf.id = almf.media_file_id AND ")
.append(" almf.album_id = ? ")
query.append(' JOIN albums_media_files almf ON ')
.append(' mf.id = almf.media_file_id AND ')
.append(' almf.album_id = ? ')
sqlParams << params.albumId
orderClauses << "almf.album_id ASC"
orderClauses << "mf.track_number ASC" }
orderClauses << 'almf.album_id ASC'
orderClauses << 'mf.track_number ASC' }
if (params.playlistId) {
query.append(" JOIN playlists_media_files pmf ON ")
query.append(" pmf.media_file_id = mf.id AND ")
query.append(" pmf.playlist_id = ?")
orderClauses.addFirst("pmf.position")
query.append(' JOIN playlists_media_files pmf ON ')
query.append(' pmf.media_file_id = mf.id AND ')
query.append(' pmf.playlist_id = ?')
orderClauses.addFirst('pmf.position')
sqlParams << params.playlistId }
if (params.name) {
whereClauses << "mf.name = ?"
whereClauses << 'mf.name = ?'
sqlParams << params.name }
if (params.trackNumber) {
query.append("mf.track_number = ?"
query.append('mf.track_number = ?'
sqlParams << params.trackNumber }
if (params.filePath) {
query.append("mf.file_path = ?"
query.append('mf.file_path = ?'
sqlParams << params.filePath }
if (params.fileHash) {
query.append("mf.file_hash = ?"
query.append('mf.file_hash = ?'
sqlParams << params.fileHash }
if (params.tags) {
@ -421,10 +421,10 @@ public class ORM {
sqlParams << tag } }
if (whereClauses)
query.append(" WHERE ").append(whereClauses.join(" AND ")
query.append(' WHERE ').append(whereClauses.join(' AND ')
if (orderClauses)
query.append(" ORDER BY ").append(orderClauses.join(", ")
query.append(' ORDER BY ').append(orderClauses.join(', ')
query = query.toString()
logger.debug("Selecting artists.\n\tSQL: {}\n\tPARAMS: {}",