diff --git a/src/main/java/link/locutus/discord/db/NationDB.java b/src/main/java/link/locutus/discord/db/NationDB.java index e9763b46..a175eaa2 100644 --- a/src/main/java/link/locutus/discord/db/NationDB.java +++ b/src/main/java/link/locutus/discord/db/NationDB.java @@ -4307,14 +4307,11 @@ public Map> getRemovesByAlliances(Set all Set fastMap = new IntOpenHashSet(alliances); List alliancesSorted = new ArrayList<>(alliances); alliancesSorted.sort(Comparator.naturalOrder()); - String query = "SELECT * FROM KICKS2 WHERE (from_aa IN (?) OR to_aa IN (?))" + (cutoff > 0 ? " AND date > ? " : "") + "ORDER BY date DESC"; - String alliancesSortedStr = alliancesSorted.stream().map(String::valueOf).collect(Collectors.joining(",")); + String query = "SELECT * FROM KICKS2 WHERE (from_aa IN " + StringMan.getString(alliancesSorted) + " OR to_aa IN " + StringMan.getString(alliancesSorted) + ")" + (cutoff > 0 ? " AND date > ? " : "") + "ORDER BY date DESC"; try (PreparedStatement stmt = getConnection().prepareStatement(query)) { - stmt.setString(1, alliancesSortedStr); - stmt.setString(2, alliancesSortedStr); if (cutoff > 0) { - stmt.setLong(3, cutoff); + stmt.setLong(1, cutoff); } ResultSet rs = stmt.executeQuery(); while (rs.next()) {