aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/database/QueryBuilder.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java
index 04e29d7a2..88183f525 100644
--- a/src/org/traccar/database/QueryBuilder.java
+++ b/src/org/traccar/database/QueryBuilder.java
@@ -36,18 +36,17 @@ import org.traccar.model.Factory;
public class QueryBuilder {
- private final Map<String, List<Integer>> indexMap;
- private final Connection connection;
+ private final Map<String, List<Integer>> indexMap = new HashMap<String, List<Integer>>();
+ private Connection connection;
private PreparedStatement statement;
private final String query;
private final boolean returnGeneratedKeys;
private QueryBuilder(DataSource dataSource, String query, boolean returnGeneratedKeys) throws SQLException {
- indexMap = new HashMap<String, List<Integer>>();
- connection = dataSource.getConnection();
this.query = query;
this.returnGeneratedKeys = returnGeneratedKeys;
if (query != null) {
+ connection = dataSource.getConnection();
String parsedQuery = parse(query.trim(), indexMap);
try {
if (returnGeneratedKeys) {