1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 19:25:34 +00:00

Debug: query logging

This commit is contained in:
M66B 2022-11-01 08:21:31 +01:00
parent f2fb73b926
commit 3420c8aa58

View file

@ -405,7 +405,7 @@ public abstract class DB extends RoomDatabase {
ExecutorService executorQuery = Helper.getBackgroundExecutor(threads, "query"); ExecutorService executorQuery = Helper.getBackgroundExecutor(threads, "query");
ExecutorService executorTransaction = Helper.getBackgroundExecutor(0, "transaction"); ExecutorService executorTransaction = Helper.getBackgroundExecutor(0, "transaction");
return Room RoomDatabase.Builder<DB> builder = Room
.databaseBuilder(context, DB.class, DB_NAME) .databaseBuilder(context, DB.class, DB_NAME)
//.openHelperFactory(new RequerySQLiteOpenHelperFactory()) //.openHelperFactory(new RequerySQLiteOpenHelperFactory())
.setQueryExecutor(executorQuery) .setQueryExecutor(executorQuery)
@ -479,6 +479,16 @@ public abstract class DB extends RoomDatabase {
createTriggers(db); createTriggers(db);
} }
}); });
if (BuildConfig.DEBUG && false)
builder.setQueryCallback(new QueryCallback() {
@Override
public void onQuery(@NonNull String sqlQuery, @NonNull List<Object> bindArgs) {
Log.i("query=" + sqlQuery);
}
}, executorQuery);
return builder;
} }
static Integer getCacheSizeKb(Context context) { static Integer getCacheSizeKb(Context context) {