public <AccumulatorType> AccumulatorType fold(final AccumulatorType accumulator, final Folder3<AccumulatorType, ResultType> folder) { try { return this.internalExecute(new QueryResultSetMunger<AccumulatorType>(this) { private int idx = 0; private AccumulatorType ac = accumulator; @Override protected AccumulatorType munge(ResultSet rs) throws SQLException { final FoldController ctl = new FoldController(rs); while (!ctl.isAborted() && rs.next()) { ResultType row_value = mapper.map(idx++, rs, getContext()); this.ac = folder.fold(ac, row_value, ctl, getContext()); } return ac; } }); } finally { cleanup(); } }
public <AccumulatorType> AccumulatorType fold(final AccumulatorType accumulator, final Folder3<AccumulatorType, ResultType> folder) { try { return this.internalExecute(new QueryResultSetMunger<AccumulatorType>(this) { private int idx = 0; private AccumulatorType ac = accumulator; @Override protected AccumulatorType munge(ResultSet rs) throws SQLException { final FoldController ctl = new FoldController(rs); while (!ctl.isAborted() && rs.next()) { ResultType row_value = mapper.map(idx++, rs, getContext()); this.ac = folder.fold(ac, row_value, ctl, getContext()); } return ac; } }); } finally { cleanup(); } }