SteamWar/SpigotCore
Archiviert
13
0

Fix replay saving

Dieser Commit ist enthalten in:
Lixfel 2021-05-31 08:14:46 +02:00
Ursprung 8d6c499cd1
Commit 77766621f8

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.sql;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -60,16 +59,13 @@ public class Fight {
}
}
public static OutputStream setReplay(int fightID) {
ResultSet rs = SQL.select("SELECT Replay FROM Fight WHERE FightID = ?", fightID);
public static void setReplay(int fightID, byte[] data) {
Blob blob = SQL.blob();
try {
rs.next();
Blob replay = rs.getBlob("Replay");
if(replay == null)
throw new SecurityException("Replay null");
return replay.setBinaryStream(1);
blob.setBytes(1, data);
} catch (SQLException e) {
throw new SecurityException(e);
}
SQL.update("UPDATE Fight SET Replay = ? WHERE FightID = ?", blob, fightID);
}
}