try {
if (cashAction != null) {
Dao<CashAction, Integer> dao = TestDB.getInstance(context).getCashActionDao();
long count = dao.queryBuilder().setCountOf(true).where()
.eq(CashAction.LOCAL_DB_CASH_ACTION_ID, cashAction.getId())
.and()
.isNull(CashAction.STATUS).countOf();
return count > 0;
} else
return false;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
我在我的 android 应用程序中使用 ormlite。我正在使用返回 countOf() 的 queryBuilder 进行查询,是否可以在 Android Debug模式下查看原始查询或由 queryBuilder 为 countOf 构建的内置查询?
最佳答案
我在 Android 日志记录方面没有太多经验,但 ORMLite 有以下关于 logging query trace information 的文档以及关于 Android logging 的文档.
根据 Android 文档,以下日志条目应该可以满足您的需求:
adb shell setprop log.tag.StatementExecutor VERBOSE
adb shell setprop log.tag.BaseMappedStatement VERBOSE
adb shell setprop log.tag.MappedCreate VERBOSE
启用所有调试:
adb shell setprop log.tag.ORMLite DEBUG
希望这对您有所帮助。
关于安卓 Debug模式 :Is it possible to view raw query or in-built query build by queryBuilder for countOf?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35081123/