From 9ea53633542c034f33e4a4aaaef8c534572b1812 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 29 Mar 2019 00:14:34 +0200 Subject: [PATCH] reuse the SQL parameter list that is the same for the 5 calls --- .../ktnx/mobileledger/model/MobileLedgerProfile.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 { -- 2.39.5