aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-12-26 17:48:00 +0700
committerGravatar Ugnich Anton2012-12-26 17:48:00 +0700
commit10f1681919c312597a71be2597626daa4d3739be (patch)
tree0b52b0b3bb5451bbfed5839ee4834602518f41a4 /src
parent9010502f7e50688b72300b60646eac5b89a80d9e (diff)
MessagesQueries.getPlace
Diffstat (limited to 'src')
-rw-r--r--src/com/juick/server/MessagesQueries.java27
1 files changed, 27 insertions, 0 deletions
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<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;