mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 02:57:52 +01:00
Fixes Clean SQLException of TPS Table
This commit is contained in:
parent
e8cc93ea21
commit
6ddaf8dec8
@ -132,12 +132,18 @@ public class TPSTable extends Table {
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void clean() throws SQLException {
|
||||
Optional<TPS> allTimePeak = getAllTimePeak();
|
||||
int p = -1;
|
||||
if (allTimePeak.isPresent()) {
|
||||
p = allTimePeak.get().getPlayers();
|
||||
}
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement("DELETE FROM " + tableName +
|
||||
" WHERE (" + columnDate + "<?)" +
|
||||
" AND (" + columnPlayers + "" +
|
||||
" != (SELECT MAX(" + columnPlayers + ") FROM " + tableName + "))");
|
||||
" != ?)");
|
||||
statement.setInt(1, p);
|
||||
// More than 2 Months ago.
|
||||
long fiveWeeks = TimeAmount.MONTH.ms() * 2L;
|
||||
statement.setLong(1, MiscUtils.getTime() - fiveWeeks);
|
||||
|
Loading…
Reference in New Issue
Block a user