@Test public void testCountOf() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); QueryBuilder<Foo, Integer> qb = dao.queryBuilder(); assertEquals(0, qb.countOf()); Foo foo1 = new Foo(); int val = 123213; foo1.val = val; assertEquals(1, dao.create(foo1)); assertEquals(1, qb.countOf()); Foo foo2 = new Foo(); foo2.val = val; assertEquals(1, dao.create(foo2)); assertEquals(2, qb.countOf()); String distinct = "DISTINCT(" + Foo.VAL_COLUMN_NAME + ")"; assertEquals(1, qb.countOf(distinct)); qb.setCountOf(distinct); assertEquals(1, dao.countOf(qb.prepare())); distinct = "DISTINCT(" + Foo.ID_COLUMN_NAME + ")"; assertEquals(2, qb.countOf(distinct)); qb.setCountOf(distinct); assertEquals(2, dao.countOf(qb.prepare())); }
public long countOf() throws SQLException { String countOfQuerySave = this.countOfQuery; try { setCountOf(true); return dao.countOf(prepare()); } finally { setCountOf(countOfQuerySave); } }
QueryBuilder extends StatementBuilder<T, ID> { public long countOf() throws SQLException { String countOfQuerySave = this.countOfQuery; try { setCountOf(true); return dao.countOf(prepare()); } finally { setCountOf(countOfQuerySave); } } }
QueryBuilder extends StatementBuilder<T, ID> { public long countOf() throws SQLException { String countOfQuerySave = this.countOfQuery; try { setCountOf(true); return dao.countOf(prepare()); } finally { setCountOf(countOfQuerySave); } } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); }
QueryBuilder extends StatementBuilder<T, ID> { public long countOf() throws SQLException { String countOfQuerySave = this.countOfQuery; try { setCountOf(true); return dao.countOf(prepare()); } finally { setCountOf(countOfQuerySave); } } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset(); }
QueryBuilder extends StatementBuilder<T, ID> { public long countOf() throws SQLException { String countOfQuerySave = this.countOfQuery; try { setCountOf(true); return dao.countOf(prepare()); } finally { setCountOf(countOfQuerySave); } } QueryBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao); PreparedQuery<T> prepare(); QueryBuilder<T, ID> selectColumns(String... columns); QueryBuilder<T, ID> selectColumns(Iterable<String> columns); QueryBuilder<T, ID> selectRaw(String... columns); QueryBuilder<T, ID> groupBy(String columnName); QueryBuilder<T, ID> groupByRaw(String rawSql); QueryBuilder<T, ID> orderBy(String columnName, boolean ascending); QueryBuilder<T, ID> orderByRaw(String rawSql); QueryBuilder<T, ID> orderByRaw(String rawSql, ArgumentHolder... args); QueryBuilder<T, ID> distinct(); QueryBuilder<T, ID> limit(Long maxRows); QueryBuilder<T, ID> offset(Long startRow); QueryBuilder<T, ID> setCountOf(boolean countOf); QueryBuilder<T, ID> setCountOf(String countOfQuery); QueryBuilder<T, ID> having(String having); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); QueryBuilder<T, ID> joinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoin(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> leftJoinOr(QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder); QueryBuilder<T, ID> join(String localColumnName, String joinedColumnName,
			QueryBuilder<?, ?> joinedQueryBuilder, JoinType type, JoinWhereOperation operation); List<T> query(); GenericRawResults<String[]> queryRaw(); T queryForFirst(); String[] queryRawFirst(); CloseableIterator<T> iterator(); long countOf(); long countOf(String countOfQuery); QueryBuilder<T, ID> setAlias(String alias); @Override void reset();  }