diff options
author | 2016-01-17 01:06:42 +0300 | |
---|---|---|
committer | 2016-01-17 01:06:42 +0300 | |
commit | 27e4beeb2ed195985942262f3f94a8c5b069ba66 (patch) | |
tree | ed171a3762ad675097f2cdb9105b5711aefdceed /src/main/java/com | |
parent | 9232bdcb144bc3b94f4b825b3a4cb588078bd72d (diff) |
fix bl query
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/server/UserQueries.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java index 21373b7d..948b42d4 100644 --- a/src/main/java/com/juick/server/UserQueries.java +++ b/src/main/java/com/juick/server/UserQueries.java @@ -293,10 +293,13 @@ public class UserQueries { } public static boolean isInBLAny(JdbcTemplate sql, int uid, int uid2) { - List<Integer> res = sql.queryForList("SELECT 1 FROM bl_users " - + "WHERE (user_id=? AND bl_user_id=?) " - + "OR (user_id=? AND bl_user_id=?)", Integer.class, new Object[] {uid, uid2, uid2, uid}); - return res.get(0) == 1; + try { + return sql.queryForObject("SELECT 1 FROM bl_users " + + "WHERE (user_id=? AND bl_user_id=?) " + + "OR (user_id=? AND bl_user_id=?)", new Object[]{uid, uid2, uid2, uid}, Integer.class) == 1; + } catch (EmptyResultDataAccessException e) { + return false; + } } public static List<Integer> checkBL(Connection sql, int visitor, List<Integer> uids) { |