From d1d46d54d4b10a6cb6a2c513acefdac3e0d21b0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 16:55:46 +0200 Subject: [PATCH] Add method to get all artists for a track. --- .../java/net/pterodactylus/demoscenemusic/data/DataManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index 0c6f422..9ec6d73 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -75,6 +75,15 @@ public class DataManager { return database.getMultiple(query, artistCreator); } + public List getArtistsByTrack(String trackId) throws DatabaseException { + Query query = new Query(Type.SELECT, "ARTISTS"); + query.addField(new Field("ARTISTS.*")); + query.addJoin(new Join(JoinType.INNER, "TRACK_ARTISTS", new Field("TRACK_ARTISTS.ARTIST"), new Field("ARTISTS.ID"))); + query.addWhereClause(new ValueFieldWhereClause(new ValueField("TRACK_ARTISTS.TRACK", new StringParameter(trackId)))); + query.addOrderField(new OrderField(new Field("TRACK_ARTISTS.DISPLAY_ORDER"))); + return database.getMultiple(query, artistCreator); + } + public Track trackById(String id) throws DatabaseException { Query query = new Query(Type.SELECT, "TRACKS"); query.addField(new Field("TRACKS.*")); -- 2.7.4