static ActiveRuleResultSetIterator create(DbClient dbClient, DbSession session, long afterDate) { try { String sql = afterDate > 0L ? SQL_AFTER_DATE : SQL_ALL; PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(session, sql); if (afterDate > 0L) { stmt.setLong(1, afterDate); } return new ActiveRuleResultSetIterator(stmt); } catch (SQLException e) { throw new IllegalStateException("Fail to prepare SQL request to select all active rules", e); } }
static IssueResultSetIterator create( DbClient dbClient, DbSession session, long afterDate, @Nullable String projectUuid) { try { String sql = afterDate > 0L ? SQL_AFTER_DATE : SQL_ALL; sql += projectUuid == null ? "" : PROJECT_FILTER; PreparedStatement stmt = dbClient.getMyBatis().newScrollingSelectStatement(session, sql); int index = 1; if (afterDate > 0L) { stmt.setLong(index, afterDate); index++; } if (projectUuid != null) { stmt.setString(index, projectUuid); } return new IssueResultSetIterator(stmt); } catch (SQLException e) { throw new IllegalStateException("Fail to prepare SQL request to select all issues", e); } }