Fix replay saving
Dieser Commit ist enthalten in:
Ursprung
8d6c499cd1
Commit
77766621f8
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.sql;
|
package de.steamwar.sql;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.sql.Blob;
|
import java.sql.Blob;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -60,16 +59,13 @@ public class Fight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OutputStream setReplay(int fightID) {
|
public static void setReplay(int fightID, byte[] data) {
|
||||||
ResultSet rs = SQL.select("SELECT Replay FROM Fight WHERE FightID = ?", fightID);
|
Blob blob = SQL.blob();
|
||||||
try {
|
try {
|
||||||
rs.next();
|
blob.setBytes(1, data);
|
||||||
Blob replay = rs.getBlob("Replay");
|
|
||||||
if(replay == null)
|
|
||||||
throw new SecurityException("Replay null");
|
|
||||||
return replay.setBinaryStream(1);
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
|
SQL.update("UPDATE Fight SET Replay = ? WHERE FightID = ?", blob, fightID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren