Regarding Result.Column.forEach()
Douglas Surber
douglas.surber at oracle.com
Tue Jul 3 18:38:24 UTC 2018
Yes. In a previous thread Mark mentioned that you had noticed this error. I provided a fix in my reply to Mark. That fix will show up in the next push which should be in a day or two. Thanks for pointing this out.
Douglas
> On Jul 3, 2018, at 11:34 AM, Alexander Kjäll <alexander.kjall at gmail.com> wrote:
>
> 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