MCPcopy Index your code
hub / github.com/apache/groovy / withInstance

Method withInstance

subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java:336–340  ·  view source on GitHub ↗

Invokes a closure passing it a new Sql instance created from the given JDBC connection URL. The created connection will be closed if required. @param url a database url of the form jdbc: subprotocol : subname @param c the Closure to call @see #newInstance(Stri

(String url, @ClosureParams(value=SimpleType.class, options="groovy.sql.Sql") Closure c)

Source from the content-addressed store, hash-verified

334 * @throws SQLException if a database access error occurs
335 */
336 public static void withInstance(String url, @ClosureParams(value=SimpleType.class, options="groovy.sql.Sql") Closure c) throws SQLException {
337 try (Sql sql = newInstance(url)) {
338 c.call(sql);
339 }
340 }
341
342 /**
343 * Creates a new Sql instance given a JDBC connection URL

Callers

nothing calls this directly

Calls 2

newInstanceMethod · 0.95
callMethod · 0.65

Tested by

no test coverage detected