aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/SQLHelpers.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-10-31 14:05:00 +0700
committerGravatar Ugnich Anton2013-10-31 14:05:00 +0700
commit73407176f75e66bd47f08046496e0a301217a010 (patch)
tree0e68d1e7787da38a92671fc4dec298ec02fc9f82 /src/com/juick/server/SQLHelpers.java
parent76e1829a199d0deb9c582951a9c7a09170a005f7 (diff)
SQLHelpers.executeInt
Diffstat (limited to 'src/com/juick/server/SQLHelpers.java')
-rw-r--r--src/com/juick/server/SQLHelpers.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/juick/server/SQLHelpers.java b/src/com/juick/server/SQLHelpers.java
index dd3c4bc3..479fd1cc 100644
--- a/src/com/juick/server/SQLHelpers.java
+++ b/src/com/juick/server/SQLHelpers.java
@@ -16,6 +16,21 @@ import java.util.ArrayList;
*/
public class SQLHelpers {
+ public static int executeInt(Connection sql, String query, int param) {
+ int ret = -1;
+ PreparedStatement stmt = null;
+ try {
+ stmt = sql.prepareStatement(query);
+ stmt.setInt(1, param);
+ ret = stmt.executeUpdate();
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(null, stmt);
+ }
+ return ret;
+ }
+
public static int getInt(Connection sql, String query, int param, int defvalue) {
int ret = defvalue;
PreparedStatement stmt = null;