From a732644480ff8b5b2ee46124af4d8c62944e39eb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 1 Jul 2016 16:34:28 +0300 Subject: fix users queries --- src/main/java/com/juick/server/UserQueries.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java index ca562765..db380d7a 100644 --- a/src/main/java/com/juick/server/UserQueries.java +++ b/src/main/java/com/juick/server/UserQueries.java @@ -117,13 +117,19 @@ public class UserQueries { } public static List getUsersByName(JdbcTemplate sql, List unames) { - return sql.query("SELECT id,nick,banned FROM users WHERE nick IN (" + Utils.convertArrayString2String(unames) + ")", - new UserMapper()); + if (!unames.isEmpty()) { + return sql.query("SELECT id,nick,banned FROM users WHERE nick IN (" + Utils.convertArrayString2String(unames) + ")", + new UserMapper()); + } + return Collections.emptyList(); } public static List getUsersByID(JdbcTemplate sql, List uids) { - return sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + Utils.convertArrayInt2String(uids) + ")", - new UserMapper()); + if (!uids.isEmpty()) { + return sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + Utils.convertArrayInt2String(uids) + ")", + new UserMapper()); + } + return Collections.emptyList(); } public static boolean fillUsersByID(JdbcTemplate sql, List users) { -- cgit v1.2.3