安卓 Debug模式 :Is it possible to view raw query or in-built query build by queryBuilder for countOf?

标签 android ormlite query-builder android-debug

 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/

相关文章:

android - android 支持 PTRACE_SINGLESTEP 吗?

android - android 中的 com.thoughtworks.xstream.mapper.CannotResolveClassException

javascript - 如何 Intent 在Webview中打开Whatsapp?

android - 非法参数异常 : Field xxx is a primitive class class xxx but marked as foreign

mysql - 拉拉维尔 4 : multiple where with or in eloquent

mysql - Laravel 根据指定的类有条件地连接表

java - View 未显示在 RelativeLayout 中

android - SQLite 语句中止,数据库锁定在 Android 应用程序中

android - 适用于 Android 的 Ormlite,值得发布帮助程序吗?

php - 如何使用 QueryBuilder 计算 CURRENT_DATE() 与上个月之间的天数差异?