Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let ResultQuery<R> extend Iterable<R> #3638

Closed
lukaseder opened this issue Sep 17, 2014 · 0 comments
Closed

Let ResultQuery<R> extend Iterable<R> #3638

lukaseder opened this issue Sep 17, 2014 · 0 comments

Comments

@lukaseder
Copy link
Member

This will allow to omit calls to fetch() when used in foreach loops:

"normal call"

for (Record record : DSL.using(connection)
                        .select()
                        .from(AUTHOR)
                        .fetch()) {
    System.out.println(record);
}

alternative call

for (Record record : DSL.using(connection)
                        .select()
                        .from(AUTHOR)) {
    System.out.println(record);
}

We must call fetch(), not fetchLazy(), as there is no way of closing the Cursor and freeing resources in the case of an exception

@lukaseder lukaseder added this to the Version 3.5.0 milestone Sep 17, 2014
lukaseder added a commit that referenced this issue Nov 18, 2014
… that might not be closed in the exception case...
arnaudroger pushed a commit to arnaudroger/jOOQ that referenced this issue Dec 16, 2014
…urce that might not be closed in the exception case...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant