Removed Table#removeAllData

This commit is contained in:
Rsl1122 2019-01-24 15:37:33 +02:00
parent bdcba82735
commit 5e8cbf1a88
3 changed files with 1 additions and 14 deletions

View File

@ -101,13 +101,6 @@ public abstract class Table {
return tableName; return tableName;
} }
/**
* Removes all data from the table.
*/
public void removeAllData() {
db.execute("DELETE FROM " + tableName);
}
@Override @Override
public String toString() { public String toString() {
return tableName; return tableName;

View File

@ -55,16 +55,11 @@ public class BatchOperationTable extends Table {
} }
} }
@Override
public void removeAllData() {
db.executeTransaction(new RemoveEverythingTransaction());
}
public void copyEverything(BatchOperationTable toDB) { public void copyEverything(BatchOperationTable toDB) {
if (toDB.equals(this)) { if (toDB.equals(this)) {
return; return;
} }
toDB.removeAllData(); toDB.db.executeTransaction(new RemoveEverythingTransaction());
copyServers(toDB); copyServers(toDB);
copyUsers(toDB); copyUsers(toDB);

View File

@ -33,7 +33,6 @@ public class SQLBackupOps extends SQLOps implements BackupOperations {
BatchOperationTable toDB = new BatchOperationTable((SQLDB) toDatabase); BatchOperationTable toDB = new BatchOperationTable((SQLDB) toDatabase);
BatchOperationTable fromDB = new BatchOperationTable(db); BatchOperationTable fromDB = new BatchOperationTable(db);
toDB.removeAllData();
fromDB.copyEverything(toDB); fromDB.copyEverything(toDB);
} else { } else {
throw new IllegalArgumentException("Database was not a SQL database - backup not implemented."); throw new IllegalArgumentException("Database was not a SQL database - backup not implemented.");