aboutsummaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/juick/server/MessagesQueries.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index ede236db..613b09f1 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -319,21 +319,23 @@ public class MessagesQueries {
return mids;
}
- public static ArrayList<Integer> getTag(Connection sql, int tid, int visitor_uid, int before) {
+ public static ArrayList<Integer> getTag(Connection sql, int tid, int visitor_uid, int before,int cnt) {
ArrayList<Integer> mids = new ArrayList<Integer>(20);
PreparedStatement stmt = null;
ResultSet rs = null;
try {
if (before > 0) {
- stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id=? AND messages.message_id<? AND (messages.privacy>0 OR messages.user_id=?) ORDER BY messages.message_id DESC LIMIT 20");
+ stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id=? AND messages.message_id<? AND (messages.privacy>0 OR messages.user_id=?) ORDER BY messages.message_id DESC LIMIT ?");
stmt.setInt(1, tid);
stmt.setInt(2, before);
stmt.setInt(3, visitor_uid);
+ stmt.setInt(4, cnt);
} else {
- stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id=? AND (messages.privacy>0 OR messages.user_id=?) ORDER BY messages.message_id DESC LIMIT 20");
+ stmt = sql.prepareStatement("SELECT messages.message_id FROM messages_tags INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id=? AND (messages.privacy>0 OR messages.user_id=?) ORDER BY messages.message_id DESC LIMIT ?");
stmt.setInt(1, tid);
stmt.setInt(2, visitor_uid);
+ stmt.setInt(3, cnt);
}
rs = stmt.executeQuery();
rs.beforeFirst();