Regarding Result.Column.forEach()
Alexander Kjäll
alexander.kjall at gmail.com
Tue Jul 3 18:34:17 UTC 2018
Hi
I have been reading through the latest update of the specification,
and I think the forEach method is missing a call to next().
I presume that it should be possible to do something like this:
try (Connection conn = ds.getConnection()) {
Integer result = conn.<Integer>rowOperation("select 1, 2, 3")
.collect(Collector.of(
() -> new Integer[] {0},
(a, r) -> {
r.forEach(rc -> {
a[0] += rc.get(Integer.class);
});
},
(l, r) -> null,
a -> a[0]))
.submit()
.getCompletionStage()
.toCompletableFuture()
.get(10, TimeUnit.SECONDS);
assertEquals(Integer.valueOf(6), result);
}
best regards
Alexander Kjäll
More information about the jdbc-spec-discuss
mailing list