From e486e099a9cebd298a425ff48a00ba4e6fde0a4a Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 1 Aug 2020 16:15:25 +0300 Subject: [PATCH] debug: print SQL params in DbOpRunner --- .../ktnx/mobileledger/async/DbOpRunner.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/async/DbOpRunner.java b/app/src/main/java/net/ktnx/mobileledger/async/DbOpRunner.java index 2944efed..67d8a0b1 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/DbOpRunner.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/DbOpRunner.java @@ -20,6 +20,7 @@ package net.ktnx.mobileledger.async; import android.database.sqlite.SQLiteDatabase; import net.ktnx.mobileledger.App; +import net.ktnx.mobileledger.BuildConfig; import java.util.concurrent.BlockingQueue; @@ -38,7 +39,23 @@ class DbOpRunner extends Thread { debug("opQrunner", "Got " + item.sql); { SQLiteDatabase db = App.getDatabase(); - debug("opQrunner", "Executing " + item.sql); + if (BuildConfig.DEBUG) { + StringBuilder b = new StringBuilder("Executing "); + b.append(item.sql); + if (item.params.length > 0) { + boolean first = true; + b.append(" ["); + for (Object p : item.params) { + if (first) + first = false; + else + b.append(", "); + b.append(p.toString()); + } + b.append("]"); + } + debug("opQrunner", b.toString()); + } db.execSQL(item.sql, item.params); } if (item.onReady != null) -- 2.39.5