diff options
author | Vitaly Takmazov | 2015-11-30 20:31:53 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2015-11-30 20:31:53 +0300 |
commit | 0c451fd02654ffbd56b6422affe8da38ed810644 (patch) | |
tree | 09977926eac7a919ce9029124ba1b533c795c286 /src/main/java/com/juick/server | |
parent | b9a14509d5512c59cb923396e646f3d4337ea069 (diff) |
fix previous query
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r-- | src/main/java/com/juick/server/MessagesQueries.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java index 7501e869..82fef672 100644 --- a/src/main/java/com/juick/server/MessagesQueries.java +++ b/src/main/java/com/juick/server/MessagesQueries.java @@ -719,14 +719,12 @@ public class MessagesQueries { ResultSet rs = null; try { if (before > 0) { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE message_id<? AND (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, before); stmt.setInt(2, visitor_uid); - stmt.setInt(3, visitor_uid); } else { - stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT bl_user_id FROM bl_users WHERE user_id=?) ORDER BY message_id DESC LIMIT 20"); + stmt = sql.prepareStatement("SELECT message_id FROM messages WHERE (privacy>0 OR user_id=?) AND attach IS NOT NULL AND user_id NOT IN (SELECT id from users WHERE banned=1) ORDER BY message_id DESC LIMIT 20"); stmt.setInt(1, visitor_uid); - stmt.setInt(2, visitor_uid); } rs = stmt.executeQuery(); rs.beforeFirst(); |