From cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 29 Apr 2015 11:07:45 +1200 Subject: Replace generic execute calls --- src/org/traccar/database/DataManager.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') 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> result = new LinkedList>(); while (resultSet.next()) { result.add(new AbstractMap.SimpleEntry( @@ -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(); } -- cgit v1.2.3