diff options
author | Ugnich Anton | 2014-04-12 16:39:30 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-04-12 16:39:30 +0700 |
commit | e286dc7e1d2ba75778220a3621343c334b4cc3da (patch) | |
tree | fecf511130a2a8d35a8fdc9fdad4bd25efa76ebb | |
parent | 2ccd7c92282e4db091c953680b099111634ed09c (diff) |
SQLHelpers.execute
-rw-r--r-- | src/com/juick/server/SQLHelpers.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/juick/server/SQLHelpers.java b/src/com/juick/server/SQLHelpers.java index 479fd1cc..28ccdb8c 100644 --- a/src/com/juick/server/SQLHelpers.java +++ b/src/com/juick/server/SQLHelpers.java @@ -16,6 +16,20 @@ import java.util.ArrayList; */ public class SQLHelpers { + public static int execute(Connection sql, String query) { + int ret = -1; + PreparedStatement stmt = null; + try { + stmt = sql.prepareStatement(query); + ret = stmt.executeUpdate(); + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(null, stmt); + } + return ret; + } + public static int executeInt(Connection sql, String query, int param) { int ret = -1; PreparedStatement stmt = null; |