From: Damyan Ivanov Date: Thu, 28 Mar 2019 22:14:34 +0000 (+0200) Subject: reuse the SQL parameter list that is the same for the 5 calls X-Git-Tag: v0.9~48 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9ea53633542c034f33e4a4aaaef8c534572b1812;p=mobile-ledger.git reuse the SQL parameter list that is the same for the 5 calls --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java index 459c3b5c..6ebba576 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java @@ -268,11 +268,12 @@ public final class MobileLedgerProfile { Log.d("db", String.format("removing profile %s from DB", uuid)); db.beginTransaction(); try { - db.execSQL("delete from profiles where uuid=?", new Object[]{uuid}); - db.execSQL("delete from accounts where profile=?", new Object[]{uuid}); - db.execSQL("delete from account_values where profile=?", new Object[]{uuid}); - db.execSQL("delete from transactions where profile=?", new Object[]{uuid}); - db.execSQL("delete from transaction_accounts where profile=?", new Object[]{uuid}); + Object[] uuid_param = new Object[]{uuid}; + db.execSQL("delete from profiles where uuid=?", uuid_param); + db.execSQL("delete from accounts where profile=?", uuid_param); + db.execSQL("delete from account_values where profile=?", uuid_param); + db.execSQL("delete from transactions where profile=?", uuid_param); + db.execSQL("delete from transaction_accounts where profile=?", uuid_param); db.setTransactionSuccessful(); } finally {