aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/NamedParameterStatement.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-10-11 18:52:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-10-11 18:52:32 +1300
commitcd29641995e256e82828dd6eef44bb83186463c3 (patch)
tree45c4dc3f6eca1f5027c5fe2fe33c1d167ee9253b /src/org/traccar/helper/NamedParameterStatement.java
parent717b60cef1e0bdeacb2f412018a8332a15c25f04 (diff)
downloadtrackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.tar.gz
trackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.tar.bz2
trackermap-server-cd29641995e256e82828dd6eef44bb83186463c3.zip
Fix database generated keys (fix #53)
Diffstat (limited to 'src/org/traccar/helper/NamedParameterStatement.java')
-rw-r--r--src/org/traccar/helper/NamedParameterStatement.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/helper/NamedParameterStatement.java b/src/org/traccar/helper/NamedParameterStatement.java
index a4b1a12c6..0dfbb9551 100644
--- a/src/org/traccar/helper/NamedParameterStatement.java
+++ b/src/org/traccar/helper/NamedParameterStatement.java
@@ -107,17 +107,21 @@ public class NamedParameterStatement {
return parsedQuery.toString();
}
- public void prepare() throws SQLException {
+ public void prepare(int autoGeneratedKeys) throws SQLException {
try {
if (statement == null) {
- statement = connection.getInstance().prepareStatement(parsedQuery);
+ statement = connection.getInstance().prepareStatement(parsedQuery, autoGeneratedKeys);
}
} catch (SQLException error) {
connection.reset();
- statement = connection.getInstance().prepareStatement(parsedQuery);
+ statement = connection.getInstance().prepareStatement(parsedQuery, autoGeneratedKeys);
}
}
+ public void prepare() throws SQLException {
+ prepare(Statement.NO_GENERATED_KEYS);
+ }
+
/**
* Execute query with result
*/