diff options
Diffstat (limited to 'src/com/juick/server')
-rw-r--r-- | src/com/juick/server/SubscriptionsQueries.java | 40 |
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; + } +} |