如同
select count(*) from tablename;
在 ORMLITE 中应该查询什么
我尝试过类似的东西
int total = dao.queryBuilder().("select count(*)");
如何使用 ORMLite 查询构建器获取表中的总记录
ORMLite http://ormlite.com/ has a Dao.countOf() http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/Dao.html#countOf%28%29返回表中总行数的方法:
long numRows = dao.countOf();
您还可以计算自定义查询中的行数 http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/stmt/Where.html#countOf()通过致电countOf()
方法上的Where
or QueryBuilder
object.
// count the number of lines in this custom query
long numRows = dao.queryBuilder().where().eq("name", "Joe Smith").countOf();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)