diff options
Diffstat (limited to 'src/com/juick/server')
-rw-r--r-- | src/com/juick/server/Utils.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/juick/server/Utils.java b/src/com/juick/server/Utils.java index d37931d0..f97797d7 100644 --- a/src/com/juick/server/Utils.java +++ b/src/com/juick/server/Utils.java @@ -17,6 +17,7 @@ */ package com.juick.server; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -50,6 +51,24 @@ public class Utils { return q; } + public static String buildQueryArray(String query1, int length, String query2) { + String ret = query1; + for (int i = 0; i < length; i++) { + if (i > 0) { + ret += ","; + } + ret += "?"; + } + ret += query2; + return ret; + } + + public static void stmtSetStringArray(PreparedStatement stmt, int offset, String strs[]) throws SQLException { + for (int i = 0; i < strs.length; i++) { + stmt.setString(offset + i, strs[i]); + } + } + public static void finishSQL(ResultSet rs, Statement stmt) { if (rs != null) { try { |