From 10f1681919c312597a71be2597626daa4d3739be Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Wed, 26 Dec 2012 17:48:00 +0700 Subject: MessagesQueries.getPlace --- src/com/juick/server/MessagesQueries.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/com/juick/server') diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index c17b9d3d..b2251048 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 getPlace(Connection sql, int place_id, int before) { + ArrayList mids = new ArrayList(20); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + if (before > 0) { + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE place_id=? AND message_id0 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 getMyFeed(Connection sql, int uid, int before) { ArrayList mids = new ArrayList(20); PreparedStatement stmt = null; -- cgit v1.2.3