From 691738fa2c9f4b8ac3789b21767e52f35ae72b5a Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Mon, 29 Oct 2012 00:22:13 +0700 Subject: isInBL, isSubscribed --- src/com/juick/server/UserQueries.java | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src') diff --git a/src/com/juick/server/UserQueries.java b/src/com/juick/server/UserQueries.java index 2de8eed7..a49da34f 100644 --- a/src/com/juick/server/UserQueries.java +++ b/src/com/juick/server/UserQueries.java @@ -257,6 +257,48 @@ public class UserQueries { return ret; } + public static boolean isInBL(Connection sql, int uid, int check) { + boolean ret = false; + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT 1 FROM bl_users WHERE user_id=? AND bl_user_id=?"); + stmt.setInt(1, uid); + stmt.setInt(2, check); + rs = stmt.executeQuery(); + if (rs.first()) { + ret = rs.getInt(1) == 1; + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + return ret; + } + + public static boolean isSubscribed(Connection sql, int uid, int check) { + boolean ret = false; + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = sql.prepareStatement("SELECT 1 FROM subscr_users WHERE suser_id=? AND user_id=?"); + stmt.setInt(1, uid); + stmt.setInt(2, check); + rs = stmt.executeQuery(); + if (rs.first()) { + ret = rs.getInt(1) == 1; + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + return ret; + } + public static int getStatsIRead(Connection sql, int uid) { int ret = 0; PreparedStatement stmt = null; -- cgit v1.2.3