#886 Do not include players with lastlogin = 0 in autopurge or default purge

This commit is contained in:
ljacqu
2016-09-18 16:49:34 +02:00
parent 405bd563d8
commit ff9f50f63f
12 changed files with 97 additions and 54 deletions
@@ -299,10 +299,13 @@ public class SQLite implements DataSource {
}
@Override
public Set<String> getRecordsToPurge(long until) {
public Set<String> getRecordsToPurge(long until, boolean includeEntriesWithLastLoginZero) {
Set<String> list = new HashSet<>();
String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE " + col.LAST_LOGIN + "<?;";
String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE " + col.LAST_LOGIN + " < ?";
if (!includeEntriesWithLastLoginZero) {
select += " AND " + col.LAST_LOGIN + " <> 0";
}
try (PreparedStatement selectPst = con.prepareStatement(select)) {
selectPst.setLong(1, until);
try (ResultSet rs = selectPst.executeQuery()) {