aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-10-29 00:22:13 +0700
committerGravatar Ugnich Anton2012-10-29 00:22:13 +0700
commit691738fa2c9f4b8ac3789b21767e52f35ae72b5a (patch)
tree0ecb5406287c606768b2ae2e69b9e2a117932f3e /src
parent864552bd5e4913a674845b2a9d7fe2fbb604439b (diff)
isInBL, isSubscribed
Diffstat (limited to 'src')
-rw-r--r--src/com/juick/server/UserQueries.java42
1 files changed, 42 insertions, 0 deletions
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;