You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Schalk Cronjé <ys...@gmail.com> on 2016/01/12 14:48:47 UTC

About Groovy.Sql

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