diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index c17b9d3d1..b2251048a 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -306,6 +306,33 @@ public class MessagesQueries { return mids; } + public static ArrayList<Integer> getPlace(Connection sql, int place_id, int before) { + ArrayList<Integer> mids = new ArrayList<Integer>(20); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + if (before > 0) { + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE place_id=? AND message_id<? AND privacy>0 ORDER BY message_id DESC LIMIT 20"); + stmt.setInt(1, place_id); + stmt.setInt(2, before); + } else { + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE place_id=? AND privacy>0 ORDER BY message_id DESC LIMIT 20"); + stmt.setInt(1, place_id); + } + rs = stmt.executeQuery(); + rs.beforeFirst(); + while (rs.next()) { + mids.add(rs.getInt(1)); + } + } catch (SQLException e) { + System.err.println(e); + } finally { + Utils.finishSQL(rs, stmt); + } + return mids; + } + public static ArrayList<Integer> getMyFeed(Connection sql, int uid, int before) { ArrayList<Integer> mids = new ArrayList<Integer>(20); PreparedStatement stmt = null; |