aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-12-19 02:04:18 +0700
committerGravatar Ugnich Anton2013-12-19 02:04:18 +0700
commit2bc4ccc437bb036de4ac5db23af8a276f1a708d5 (patch)
tree99baf7f7326b7edf7f15c8268943e9283dd3fc42 /src
parent5ec828b377b18d6cf56643796de8fdd44e8f1091 (diff)
SubscriptionQueries.getJIDSubscribedToUserAndTags
Diffstat (limited to 'src')
-rw-r--r--src/com/juick/server/SubscriptionsQueries.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/juick/server/SubscriptionsQueries.java b/src/com/juick/server/SubscriptionsQueries.java
index 9f9468cd..ca382fc7 100644
--- a/src/com/juick/server/SubscriptionsQueries.java
+++ b/src/com/juick/server/SubscriptionsQueries.java
@@ -43,6 +43,28 @@ public class SubscriptionsQueries {
return jids;
}
+ public static ArrayList<String> getJIDSubscribedToUserAndTags(Connection sql, int uid, int mid) {
+ ArrayList<String> jids = new ArrayList<String>();
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT DISTINCT jid FROM jids WHERE active=1 AND user_id IN (SELECT suser_id FROM subscr_users WHERE user_id=? UNION SELECT suser_id FROM subscr_tags INNER JOIN messages_tags ON (messages_tags.message_id=? AND subscr_tags.tag_id=messages_tags.tag_id))");
+ stmt.setInt(1, uid);
+ stmt.setInt(2, mid);
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ jids.add(rs.getString(1));
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+ return jids;
+ }
+
public static ArrayList<String> getJIDSubscribedToComments(Connection sql, int mid, int ignore_uid) {
ArrayList<String> jids = new ArrayList<String>();