From 68d080b0e8f579b2884d4558782fd7e416154714 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 27 Jul 2012 13:30:00 +0200 Subject: [PATCH] Add method to get track derivative by ID. --- .../pterodactylus/demoscenemusic/data/DataManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index 449965b..03ec2d9 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -345,6 +345,22 @@ public class DataManager { } /** + * Returns the derivative with the given ID. + * + * @param id + * The ID of the derivatives to load + * @return The derivative with the given ID + * @throws DatabaseException + * if a database error occurs + */ + public TrackDerivative getTrackDerivativeById(String id) throws DatabaseException { + Query query = new Query(Type.SELECT, "TRACK_DERIVATIVES"); + query.addField(new Field("TRACK_DERIVATIVES.*")); + query.addWhereClause(new ValueFieldWhereClause(new ValueField("TRACK_DERIVATIVES.ID", new StringParameter(id)))); + return loadTrackDerivativeProperties(database.getSingle(query, trackDerivativeCreator)); + } + + /** * Returns the derivatives for the given track. * * @param track -- 2.7.4