From a5ef9a5f8b496787e7ca3f8510dea9d283105f25 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 13 Dec 2011 11:51:39 +0000 Subject: --- src/org/traccar/helper/NamedParameterStatement.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/org/traccar/helper') diff --git a/src/org/traccar/helper/NamedParameterStatement.java b/src/org/traccar/helper/NamedParameterStatement.java index bbb2bcdf3..5fbc57d78 100644 --- a/src/org/traccar/helper/NamedParameterStatement.java +++ b/src/org/traccar/helper/NamedParameterStatement.java @@ -114,11 +114,8 @@ public class NamedParameterStatement { return parsedQuery.toString(); } - - /** - * Execute query with result - */ - public ResultSet executeQuery() throws SQLException { + + public void prepare() throws SQLException { try { if (statement == null) { statement = connection.getInstance().prepareStatement(parsedQuery); @@ -127,6 +124,12 @@ public class NamedParameterStatement { connection.reset(); statement = connection.getInstance().prepareStatement(parsedQuery); } + } + + /** + * Execute query with result + */ + public ResultSet executeQuery() throws SQLException { return statement.executeQuery(); } @@ -135,14 +138,6 @@ public class NamedParameterStatement { * Executes query without result */ public int executeUpdate() throws SQLException { - try { - if (statement == null) { - statement = connection.getInstance().prepareStatement(parsedQuery); - } - } catch (SQLException error) { - connection.reset(); - statement = connection.getInstance().prepareStatement(parsedQuery); - } return statement.executeUpdate(); } -- cgit v1.2.3