Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
It would be useful to have variations of some of the groovy.sql.Sql#newInstance methods which took care of resource management, e.g. instead of this:
def sql try { sql = Sql.newInstance(db.url, db.user, db.password, db.driver) // sql operations here } finally { sql?.close() }
You could do something like:
Sql.withInstance(db.url, db.user, db.password, db.driver) { sql ->
// sql operations here
}