aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-25 20:51:38 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-25 20:51:38 +1200
commitb10cebd692b610a13ea27b6150a79726de59f40e (patch)
tree31919802ddae807fa4887446addc9eb98d5fbe50 /src/org/traccar/database/DataManager.java
parent67dc1c43932bffaf9df2c9ec201cff879d0226d9 (diff)
downloadtrackermap-server-b10cebd692b610a13ea27b6150a79726de59f40e.tar.gz
trackermap-server-b10cebd692b610a13ea27b6150a79726de59f40e.tar.bz2
trackermap-server-b10cebd692b610a13ea27b6150a79726de59f40e.zip
Implement async position update
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 2f029e74c..faded815b 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -362,6 +362,31 @@ public class DataManager {
}
}
+ public List<Long> getDeviceList(long userId) throws SQLException {
+
+ Connection connection = dataSource.getConnection();
+ try {
+ PreparedStatement statement = connection.prepareStatement(
+ "SELECT id FROM device WHERE id IN (" +
+ "SELECT device_id FROM user_device WHERE user_id = ?);");
+ try {
+ statement.setLong(1, userId);
+
+ ResultSet resultSet = statement.executeQuery();
+
+ List<Long> result = new LinkedList<Long>();
+ while (resultSet.next()) {
+ result.add(resultSet.getLong(1));
+ }
+ return result;
+ } finally {
+ statement.close();
+ }
+ } finally {
+ connection.close();
+ }
+ }
+
public JsonArray getDevices(long userId) throws SQLException {
Connection connection = dataSource.getConnection();