diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-25 20:51:38 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-25 20:51:38 +1200 |
commit | b10cebd692b610a13ea27b6150a79726de59f40e (patch) | |
tree | 31919802ddae807fa4887446addc9eb98d5fbe50 /src/org/traccar/database/DataManager.java | |
parent | 67dc1c43932bffaf9df2c9ec201cff879d0226d9 (diff) | |
download | traccar-server-b10cebd692b610a13ea27b6150a79726de59f40e.tar.gz traccar-server-b10cebd692b610a13ea27b6150a79726de59f40e.tar.bz2 traccar-server-b10cebd692b610a13ea27b6150a79726de59f40e.zip |
Implement async position update
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 25 |
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(); |