groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schalk Cronjé <>
Subject About Groovy.Sql
Date Tue, 12 Jan 2016 13:48:47 GMT
Sql instance can either be created with the constructors taking 
Connection or DataSource as parameters or via static methods newInstance 
or withInstance, the latetr which can a variety of String parameters.

What I am wondering is why newInstance & withInstance cannot also take a 
Connection or a DataSource. It would be nice to simply do something like.

    Sql.withInstance( myPool.getConnection() ) { sql ->

         // do stuff with sql here

    } // and sql.close() gets call upon closure exit, handing connection
    back to pool.

Just asking ...

Schalk W. Cronjé
Twitter / Ello / Toeter : @ysb33r

View raw message