diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-01 12:22:18 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-01 12:22:18 +1200 |
commit | b2ccb23a541d5d927696385bdf96beb7f99348b2 (patch) | |
tree | 97025eaf8edd05281c78ddeb353f3c230f89afd4 /src/org/traccar/database/QueryBuilder.java | |
parent | 1d0e1d374bae176b829848b394155a917870e5a7 (diff) | |
download | trackermap-server-b2ccb23a541d5d927696385bdf96beb7f99348b2.tar.gz trackermap-server-b2ccb23a541d5d927696385bdf96beb7f99348b2.tar.bz2 trackermap-server-b2ccb23a541d5d927696385bdf96beb7f99348b2.zip |
Manage server settings record
Diffstat (limited to 'src/org/traccar/database/QueryBuilder.java')
-rw-r--r-- | src/org/traccar/database/QueryBuilder.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index a35b07fee..386ed86d7 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -201,6 +201,15 @@ public class QueryBuilder { public void process(T object, ResultSet resultSet) throws SQLException; } + public <T extends Factory> T executeQuerySingle(T prototype) throws SQLException { + Collection<T> result = executeQuery(prototype); + if (!result.isEmpty()) { + return result.iterator().next(); + } else { + return null; + } + } + public <T extends Factory> Collection<T> executeQuery(T prototype) throws SQLException { List<T> result = new LinkedList<T>(); |