diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 11:07:45 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 11:07:45 +1200 |
commit | cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424 (patch) | |
tree | 59621463bf895f3a5e55ba9fdf896f2499bdb5d6 | |
parent | 7df211d6c7365b494e758741f5bd5194c7eaaf39 (diff) | |
download | trackermap-server-cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424.tar.gz trackermap-server-cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424.tar.bz2 trackermap-server-cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424.zip |
Replace generic execute calls
-rw-r--r-- | src/org/traccar/database/DataManager.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 417fbb6b4..e0bac5cd6 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -236,7 +236,7 @@ public class DataManager { if (!exist) { - statement.execute( + statement.executeUpdate( "CREATE TABLE user (" + "id INT PRIMARY KEY AUTO_INCREMENT," + "email VARCHAR(1024) NOT NULL UNIQUE," + @@ -372,9 +372,8 @@ public class DataManager { PreparedStatement statement = connection.prepareStatement( "SELECT user_id, device_id FROM user_device;"); try { - statement.execute(); - ResultSet resultSet = statement.getResultSet(); - + ResultSet resultSet = statement.executeQuery(); + List<Map.Entry<Long, Long>> result = new LinkedList<Map.Entry<Long, Long>>(); while (resultSet.next()) { result.add(new AbstractMap.SimpleEntry<Long, Long>( @@ -428,7 +427,7 @@ public class DataManager { statement.setString(1, device.getName()); statement.setString(2, device.getUniqueId()); - statement.execute(); + statement.executeUpdate(); ResultSet result = statement.getGeneratedKeys(); if (result.next()) { @@ -453,7 +452,7 @@ public class DataManager { statement.setString(2, device.getUniqueId()); statement.setLong(3, device.getId()); - statement.execute(); + statement.executeUpdate(); } finally { statement.close(); } @@ -471,7 +470,7 @@ public class DataManager { try { statement.setLong(1, device.getId()); - statement.execute(); + statement.executeUpdate(); } finally { statement.close(); } @@ -490,7 +489,7 @@ public class DataManager { statement.setLong(1, userId); statement.setLong(2, deviceId); - statement.execute(); + statement.executeUpdate(); } finally { statement.close(); } |