@Override public int fetchCount( Select<?> query) throws DataAccessException { return delegate.fetchCount(query); }
@Override public int fetchCount( Table<?> table) throws DataAccessException { return delegate.fetchCount(table); }
@Override public int fetchCount( Table<?> table, Condition condition) throws DataAccessException { return delegate.fetchCount(table, condition); }
@Override public int count(Stream<Condition> conditions) { Condition c = conditions.reduce((acc, item) -> acc.and(item)).orElse(DSL.trueCondition()); return getDSLContext().fetchCount(table, c); }
@Override public final int fetchCount() throws DataAccessException { return DSL.using(configuration()).fetchCount(this); }
@Override public final int fetchCount() throws DataAccessException { return DSL.using(configuration()).fetchCount(this); }
<T> Future<Integer> countAsync(final JsonObject filters, final Operator operator) { final Function<DSLContext, Integer> function = dslContext -> null == filters ? dslContext.fetchCount(this.vertxDAO.getTable()) : dslContext.fetchCount(this.vertxDAO.getTable(), JooqCond.transform(filters, operator, this::getColumn)); return Async.toFuture(this.vertxDAO.executeAsync(function)); }
<T> Future<Integer> countAsync(final JsonObject filters, final Operator operator) { final Function<DSLContext, Integer> function = dslContext -> null == filters ? dslContext.fetchCount(this.vertxDAO.getTable()) : dslContext.fetchCount(this.vertxDAO.getTable(), JooqCond.transform(filters, operator, this::getColumn)); return Async.toFuture(this.vertxDAO.executeAsync(function)); }
@Override public int size() { // Infinispan code analysis on 8.2 shows that this method is never called in practice, and // is not wired to the data / cache container API Loggers.SQL_LOG.trace("[IS0120] SQL store: Counting {} records", getCacheName()); final int count; try { count = sql.fetchCount(table(sqlRecordTransformer.getTableName())); } catch (Exception e) { Loggers.SQL_LOG.error("[IS0121] {}: {}", e.getMessage(), e); throw new PersistenceException(e.getMessage(), e); } Loggers.SQL_LOG.trace("[IS0122] SQL store: Counted {} {} records", count, getCacheName()); return count; }
@Override public int size() { // Infinispan code analysis on 8.2 shows that this method is never called in practice, and // is not wired to the data / cache container API Loggers.SQL_LOG.trace("[IS0120] SQL store: Counting {} records", getCacheName()); final int count; try (Connection connection = dataSource.getConnection()) { count = DSL.using(connection, config.sqlDialect) .fetchCount(table(sqlRecordTransformer.getTableName())); } catch (Exception e) { Loggers.SQL_LOG.error("[IS0121] {}: {}", e.getMessage(), e); throw new PersistenceException(e.getMessage(), e); } Loggers.SQL_LOG.trace("[IS0122] SQL store: Counted {} {} records", count, getCacheName()); return count; }
public boolean exists(String username) { try (DSLContext tx = DSL.using(cfg)) { int cnt = tx.fetchCount(tx.selectFrom(USERS) .where(USERS.USERNAME.eq(username))); return cnt > 0; } }
public int count(UUID userId) { try (DSLContext tx = DSL.using(cfg)) { return tx.fetchCount(selectFrom(API_KEYS).where(API_KEYS.USER_ID.eq(userId))); } }
public boolean existsById(UUID id) { try (DSLContext tx = DSL.using(cfg)) { int cnt = tx.fetchCount(tx.selectFrom(USERS) .where(USERS.USER_ID.eq(id))); return cnt > 0; } }
@Override public PageResult<T> fetch(PageResult<T> page, Executor<SelectLimitStep<?>> ec, RecordMapper<Record, T> mapper) { DSLContext context = getDSLContext(); SelectLimitStep<?> r = ec.execute(context); int count = context.fetchCount(r); page.setTotal(count); List<T> list = r.limit(page.getStart(), page.getPageSize()).fetch(mapper); page.setData(list); return page; }