From cca09ef6bc8db13ee3a3fae45d1f47da40894c5a Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Thu, 24 Oct 2013 16:39:31 +0700 Subject: MessagesQueries.getTag cnt --- src/com/juick/server/MessagesQueries.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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 getTag(Connection sql, int tid, int visitor_uid, int before) { + public static ArrayList getTag(Connection sql, int tid, int visitor_uid, int before,int cnt) { ArrayList mids = new ArrayList(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_id0 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_id0 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(); -- cgit v1.2.3