diff options
author | Ugnich Anton | 2014-07-25 00:16:47 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-07-25 00:16:47 +0700 |
commit | 13a861563ffead4cadba48e523aad2e5c6beb44c (patch) | |
tree | 0f60efcdfc498d631cf1ea782366f4d212238093 /src/com/juick/server/SQLHelpers.java | |
parent | b67b2f126af0c410cdb5b1a925d19b5d2cc5b2b2 (diff) |
AdsQueries for unauthorized
Diffstat (limited to 'src/com/juick/server/SQLHelpers.java')
-rw-r--r-- | src/com/juick/server/SQLHelpers.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/juick/server/SQLHelpers.java b/src/com/juick/server/SQLHelpers.java index 28ccdb8c..f5569993 100644 --- a/src/com/juick/server/SQLHelpers.java +++ b/src/com/juick/server/SQLHelpers.java @@ -45,6 +45,24 @@ public class SQLHelpers { return ret; } + public static int getInt(Connection sql, String query, int defvalue) { + int ret = defvalue; + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement(query); + rs = stmt.executeQuery(); + if (rs.first()) { + ret = rs.getInt(1); + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + return ret; + } + public static int getInt(Connection sql, String query, int param, int defvalue) { int ret = defvalue; PreparedStatement stmt = null; |