Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-beta-3, 1.8.7
-
Component/s: None
-
Labels:None
-
Number of attachments :
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
}