Prevent negative register dates from breaking db

This commit is contained in:
Aurora Lahtela 2022-03-06 17:51:50 +02:00 committed by GitHub
parent 206c4e7d96
commit cb68d38965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -60,12 +60,14 @@ public class BadNukkitRegisterValuePatch extends Patch {
private void multiplyInTable(String tableName, String registered) {
String sql = "UPDATE " + tableName + " SET " +
registered + "=" + registered + "*1000" +
WHERE + registered + "<?";
WHERE + registered + "<?" +
AND + registered + ">?";
execute(new ExecStatement(sql) {
@Override
public void prepare(PreparedStatement statement) throws SQLException {
statement.setLong(1, System.currentTimeMillis() / 1000L);
statement.setLong(2, 0L);
}
});
}
}
}