Archiviert
1
0

Try with resources

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-12-28 16:16:16 +01:00
Ursprung c928c480f2
Commit 35c16b1fae
2 geänderte Dateien mit 14 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -30,13 +30,13 @@ public class FightPlayer {
if(fightIds.isEmpty()) if(fightIds.isEmpty())
return fightPlayers; return fightPlayers;
Statement batch = new Statement("SELECT * FROM FightPlayer WHERE FightID IN (" + fightIds.stream().map(Object::toString).collect(Collectors.joining(", ")) + ")"); try (Statement batch = new Statement("SELECT * FROM FightPlayer WHERE FightID IN (" + fightIds.stream().map(Object::toString).collect(Collectors.joining(", ")) + ")")) {
batch.select(rs -> { batch.select(rs -> {
while(rs.next()) while(rs.next())
fightPlayers.add(new FightPlayer(rs)); fightPlayers.add(new FightPlayer(rs));
return null; return null;
}); });
batch.close(); }
return fightPlayers; return fightPlayers;
} }

Datei anzeigen

@ -193,13 +193,13 @@ public class SteamwarUser {
if(ids.isEmpty()) if(ids.isEmpty())
return; return;
Statement batch = new Statement("SELECT * FROM UserData WHERE id IN (" + ids.stream().map(Object::toString).collect(Collectors.joining(", ")) + ")"); try (Statement batch = new Statement("SELECT * FROM UserData WHERE id IN (" + ids.stream().map(Object::toString).collect(Collectors.joining(", ")) + ")")) {
batch.select(rs -> { batch.select(rs -> {
while (rs.next()) while (rs.next())
new SteamwarUser(rs); new SteamwarUser(rs);
return null; return null;
}); });
batch.close(); }
} }
public static SteamwarUser get(Long discordId) { public static SteamwarUser get(Long discordId) {