actually fixed purge

This commit is contained in:
boy0001 2014-10-18 18:45:07 +11:00
parent 441d4dde2e
commit b23d4f26e6

View File

@ -650,42 +650,43 @@ public class DBFunc {
Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '"+world+"'!"); Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '"+world+"'!");
return; return;
} }
if (ids.size() > 0) {
try {
try { String prefix = "";
StringBuilder idstr = new StringBuilder("");
String prefix = ""; for (Integer id:ids) {
StringBuilder idstr = new StringBuilder(""); idstr.append(prefix + id);
prefix = " OR `plot_plot_id` = ";
}
for (Integer id:ids) { PreparedStatement stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = "+idstr+"");
idstr.append(prefix + id); stmt.executeUpdate();
prefix = " OR `plot_plot_id` = "; stmt.close();
}
PreparedStatement stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_denied` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_denied` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_trusted` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_trusted` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `world` = ?");
stmt.executeUpdate(); stmt.setString(1, world);
stmt.close(); stmt.executeUpdate();
stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `world` = ?"); }
stmt.setString(1, world); catch (SQLException e) {
stmt.executeUpdate(); e.printStackTrace();
stmt.close(); Logger.add(LogLevel.DANGER, "FAILED TO PURGE WORLD '"+world+"'!");
} return;
catch (SQLException e) { }
e.printStackTrace();
Logger.add(LogLevel.DANGER, "FAILED TO PURGE WORLD '"+world+"'!");
return;
} }
Logger.add(LogLevel.GENERAL, "SUCCESSFULLY PURGED WORLD '"+world+"'!"); Logger.add(LogLevel.GENERAL, "SUCCESSFULLY PURGED WORLD '"+world+"'!");
} }