aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-14 17:53:54 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-14 17:53:54 +0500
commita8c7b44d06fd6112568c6ad0ed57c5af9db00ded (patch)
treed34f50aec613ecc70e8453720a0cffc1bd6918e6 /src/org
parentadd55d83f367c0001deadadac4b83cc6542eb234 (diff)
downloadtrackermap-server-a8c7b44d06fd6112568c6ad0ed57c5af9db00ded.tar.gz
trackermap-server-a8c7b44d06fd6112568c6ad0ed57c5af9db00ded.tar.bz2
trackermap-server-a8c7b44d06fd6112568c6ad0ed57c5af9db00ded.zip
Remove duplicating code
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/QueryBuilder.java17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java
index 7d8731933..1a83daab9 100644
--- a/src/org/traccar/database/QueryBuilder.java
+++ b/src/org/traccar/database/QueryBuilder.java
@@ -173,16 +173,7 @@ public final class QueryBuilder {
}
public QueryBuilder setLong(String name, long value) throws SQLException {
- for (int i : indexes(name)) {
- try {
- statement.setLong(i, value);
- } catch (SQLException error) {
- statement.close();
- connection.close();
- throw error;
- }
- }
- return this;
+ return setLong(name, value, false);
}
public QueryBuilder setLong(String name, long value, boolean nullIfZero) throws SQLException {
@@ -262,11 +253,7 @@ public final class QueryBuilder {
} else if (method.getReturnType().equals(int.class)) {
setInteger(name, (Integer) method.invoke(object));
} else if (method.getReturnType().equals(long.class)) {
- if (name.endsWith("Id")) {
- setLong(name, (Long) method.invoke(object), true);
- } else {
- setLong(name, (Long) method.invoke(object));
- }
+ setLong(name, (Long) method.invoke(object), name.endsWith("Id"));
} else if (method.getReturnType().equals(double.class)) {
setDouble(name, (Double) method.invoke(object));
} else if (method.getReturnType().equals(String.class)) {