Minor change in quotation of SQL strigns.
This commit is contained in:
parent
710083131a
commit
32ad70c405
@ -369,45 +369,45 @@ public class ORM {
|
|||||||
def orderClauses = [] as LinkedList
|
def orderClauses = [] as LinkedList
|
||||||
def whereClauses = []
|
def whereClauses = []
|
||||||
|
|
||||||
query.append("SELECT mf.* FROM media_files mf ")
|
query.append('SELECT mf.* FROM media_files mf ')
|
||||||
|
|
||||||
if (params.artistId) {
|
if (params.artistId) {
|
||||||
query.append(" JOIN artists_media_files armf ON ")
|
query.append(' JOIN artists_media_files armf ON ')
|
||||||
.append(" mf.id = armf.media_file_id AND ")
|
.append(' mf.id = armf.media_file_id AND ')
|
||||||
query.append(" armf.artist_id = ? ")
|
query.append(' armf.artist_id = ? ')
|
||||||
sqlParams << params.artistId
|
sqlParams << params.artistId
|
||||||
orderClauses << "armf.artist_id" }
|
orderClauses << 'armf.artist_id' }
|
||||||
|
|
||||||
if (params.albumId) {
|
if (params.albumId) {
|
||||||
query.append(" JOIN albums_media_files almf ON ")
|
query.append(' JOIN albums_media_files almf ON ')
|
||||||
.append(" mf.id = almf.media_file_id AND ")
|
.append(' mf.id = almf.media_file_id AND ')
|
||||||
.append(" almf.album_id = ? ")
|
.append(' almf.album_id = ? ')
|
||||||
|
|
||||||
sqlParams << params.albumId
|
sqlParams << params.albumId
|
||||||
orderClauses << "almf.album_id ASC"
|
orderClauses << 'almf.album_id ASC'
|
||||||
orderClauses << "mf.track_number ASC" }
|
orderClauses << 'mf.track_number ASC' }
|
||||||
|
|
||||||
if (params.playlistId) {
|
if (params.playlistId) {
|
||||||
query.append(" JOIN playlists_media_files pmf ON ")
|
query.append(' JOIN playlists_media_files pmf ON ')
|
||||||
query.append(" pmf.media_file_id = mf.id AND ")
|
query.append(' pmf.media_file_id = mf.id AND ')
|
||||||
query.append(" pmf.playlist_id = ?")
|
query.append(' pmf.playlist_id = ?')
|
||||||
orderClauses.addFirst("pmf.position")
|
orderClauses.addFirst('pmf.position')
|
||||||
sqlParams << params.playlistId }
|
sqlParams << params.playlistId }
|
||||||
|
|
||||||
if (params.name) {
|
if (params.name) {
|
||||||
whereClauses << "mf.name = ?"
|
whereClauses << 'mf.name = ?'
|
||||||
sqlParams << params.name }
|
sqlParams << params.name }
|
||||||
|
|
||||||
if (params.trackNumber) {
|
if (params.trackNumber) {
|
||||||
query.append("mf.track_number = ?"
|
query.append('mf.track_number = ?'
|
||||||
sqlParams << params.trackNumber }
|
sqlParams << params.trackNumber }
|
||||||
|
|
||||||
if (params.filePath) {
|
if (params.filePath) {
|
||||||
query.append("mf.file_path = ?"
|
query.append('mf.file_path = ?'
|
||||||
sqlParams << params.filePath }
|
sqlParams << params.filePath }
|
||||||
|
|
||||||
if (params.fileHash) {
|
if (params.fileHash) {
|
||||||
query.append("mf.file_hash = ?"
|
query.append('mf.file_hash = ?'
|
||||||
sqlParams << params.fileHash }
|
sqlParams << params.fileHash }
|
||||||
|
|
||||||
if (params.tags) {
|
if (params.tags) {
|
||||||
@ -421,10 +421,10 @@ public class ORM {
|
|||||||
sqlParams << tag } }
|
sqlParams << tag } }
|
||||||
|
|
||||||
if (whereClauses)
|
if (whereClauses)
|
||||||
query.append(" WHERE ").append(whereClauses.join(" AND ")
|
query.append(' WHERE ').append(whereClauses.join(' AND ')
|
||||||
|
|
||||||
if (orderClauses)
|
if (orderClauses)
|
||||||
query.append(" ORDER BY ").append(orderClauses.join(", ")
|
query.append(' ORDER BY ').append(orderClauses.join(', ')
|
||||||
|
|
||||||
query = query.toString()
|
query = query.toString()
|
||||||
logger.debug("Selecting artists.\n\tSQL: {}\n\tPARAMS: {}",
|
logger.debug("Selecting artists.\n\tSQL: {}\n\tPARAMS: {}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user