aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-10-24 16:39:31 +0700
committerGravatar Ugnich Anton2013-10-24 16:39:31 +0700
commitcca09ef6bc8db13ee3a3fae45d1f47da40894c5a (patch)
tree5ffaa10576042520fbc1dccae52ecc1c57744e6b /src/com/juick/server/MessagesQueries.java
parent4757bfefd416ba905a8a1df73c570e3e700aeefb (diff)
MessagesQueries.getTag cnt
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-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();