aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-11-16 03:24:57 +0700
committerGravatar Ugnich Anton2013-11-16 03:24:57 +0700
commit26a5fcecd4d71b58fa5d099a58007252e7b85c3c (patch)
tree2c620a8b423ce0d50103ea9078b87b01383c052b
parent2ddc060cee3e4b7f71819f95b833d802613a51b5 (diff)
SubscriptionQueries.getJIDSubscribedToComments
-rw-r--r--src/com/juick/server/SubscriptionsQueries.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/juick/server/SubscriptionsQueries.java b/src/com/juick/server/SubscriptionsQueries.java
new file mode 100644
index 00000000..d7b7fbc3
--- /dev/null
+++ b/src/com/juick/server/SubscriptionsQueries.java
@@ -0,0 +1,40 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.juick.server;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author ugnich
+ */
+public class SubscriptionsQueries {
+
+ public static ArrayList<String> getJIDSubscribedToComments(Connection sql, int mid, int ignore_uid) {
+ ArrayList<String> jids = new ArrayList<String>();
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT jid FROM subscr_messages WHERE message_id=? AND active=b'1' AND suser_id!=? AND jid!=''");
+ stmt.setInt(1, mid);
+ stmt.setInt(2, ignore_uid);
+ 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;
+ }
+}