Debug: query logging

pull/209/head
M66B 2 years ago
parent f2fb73b926
commit 3420c8aa58

@ -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) {

Loading…
Cancel
Save