aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-01 16:34:28 +0300
committerGravatar Vitaly Takmazov2016-07-01 16:34:28 +0300
commita732644480ff8b5b2ee46124af4d8c62944e39eb (patch)
treedf1ebf9c14fac5e2b6871b8ec1b5f2b94a060787 /src/main/java
parent67d53fe24081ade138b5d9756fd835575eb4ae79 (diff)
fix users queries
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/server/UserQueries.java14
1 files 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<User> getUsersByName(JdbcTemplate sql, List<String> 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<User> getUsersByID(JdbcTemplate sql, List<Integer> 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<User> users) {