You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I think closing the result set has to be handled outside of JdbcStream.
My intent with this is class is to purely handle the conversion from JDBC ResultSet to a Stream object so anyone can easily use the Java Stream API (or even StreamEx). Any connection management to the SQL database is left to the user.
So for example, you could use a try-with-resources to call the close() method of ResultSet automatically:
// Set up connection and prepared statementtry (ResultSetresultSet = preparedStatement.executeQuery()) {
longcount = JdbcStream.stream(resultSet).count()
System.out.println(count)
}
I think this is for the best so that the user has the most flexibility handling the connections to the SQL database.
What about closing result set when stream is processed?
I don't see it is closed in JdbcStream, so shall it be handled by invoker?
The text was updated successfully, but these errors were encountered: