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

Method cacheStatements

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

Caches every created preparedStatement in Closure closure Every cached preparedStatement is closed after closure has been called. If the closure takes a single argument, it will be called with the connection, otherwise it will be called with no arguments. @param closure the given closure @th

(@ClosureParams(value=SimpleType.class, options="java.sql.Connection") Closure closure)

Source from the content-addressed store, hash-verified

4394 * @see #setCacheStatements(boolean)
4395 */
4396 public void cacheStatements(@ClosureParams(value=SimpleType.class, options="java.sql.Connection") Closure closure) throws SQLException {
4397 boolean savedCacheStatements = cacheStatements;
4398 cacheStatements = true;
4399 Connection connection = null;
4400 try {
4401 connection = createConnection();
4402 callClosurePossiblyWithConnection(closure, connection);
4403 } finally {
4404 cacheStatements = false;
4405 closeResources(connection, null);
4406 cacheStatements = savedCacheStatements;
4407 }
4408 }
4409
4410 // protected implementation methods - extension points for subclasses
4411 //-------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

createConnectionMethod · 0.95
closeResourcesMethod · 0.95

Tested by

no test coverage detected