]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java
developer menu item for wiping all local profile data
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / MobileLedgerProfile.java
index 3db7850f986be606fb60bdd33cd269355df6ebf7..93a954f0a674bc95354eeb70d6c00831293f487b 100644 (file)
@@ -426,4 +426,20 @@ public final class MobileLedgerProfile {
 
         return result;
     }
+    public void wipeAllData() {
+        SQLiteDatabase db = MLDB.getDatabase();
+        db.beginTransaction();
+        try {
+            String[] pUuid = new String[]{uuid};
+            db.execSQL("delete from options where profile=?", pUuid);
+            db.execSQL("delete from accounts where profile=?", pUuid);
+            db.execSQL("delete from account_values where profile=?", pUuid);
+            db.execSQL("delete from transactions where profile=?", pUuid);
+            db.execSQL("delete from transaction_accounts where profile=?", pUuid);
+            db.setTransactionSuccessful();
+        }
+        finally {
+            db.endTransaction();
+        }
+    }
 }