From 26a5fcecd4d71b58fa5d099a58007252e7b85c3c Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Sat, 16 Nov 2013 03:24:57 +0700 Subject: SubscriptionQueries.getJIDSubscribedToComments --- src/com/juick/server/SubscriptionsQueries.java | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/com/juick/server/SubscriptionsQueries.java (limited to 'src') 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 getJIDSubscribedToComments(Connection sql, int mid, int ignore_uid) { + ArrayList jids = new ArrayList(); + + 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; + } +} -- cgit v1.2.3