Fixed purge include parameter not functioning correctly for SQLite databases

This commit is contained in:
Intelli 2024-08-13 20:11:16 -06:00
parent 888df067f9
commit 3194c35bb9

View File

@ -285,18 +285,22 @@ public class PurgeCommand extends Consumer {
boolean error = false;
if (!excludeTables.contains(table)) {
try {
boolean purge = true;
String timeLimit = "";
if (purgeTables.contains(table)) {
String blockRestriction = "";
String blockRestriction = "(";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
blockRestriction = "type NOT IN(" + includeBlockFinal + ") OR (type IN(" + includeBlockFinal + ") AND ";
}
else if (hasBlockRestriction) {
purge = false;
}
if (argWid > 0 && worldTables.contains(table)) {
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "')) OR (" + blockRestriction + "wid != '" + argWid + "')";
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "'))) OR (wid != '" + argWid + "')";
}
else if (argWid == 0) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd + "' OR time < '" + timeStart + "')";
else if (argWid == 0 && purge) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd + "' OR time < '" + timeStart + "'))";
}
}
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit;