You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/09/26 16:18:03 UTC

groovy git commit: GROOVY-8812: Make `Sql` and `BatchingStatementWrapper` implement `AutoCloseable`

Repository: groovy
Updated Branches:
  refs/heads/master bac665c68 -> 3263b6493


GROOVY-8812: Make `Sql` and `BatchingStatementWrapper` implement `AutoCloseable`


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3263b649
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3263b649
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3263b649

Branch: refs/heads/master
Commit: 3263b6493d93b247a1ecb2f6f86eb98fa2df038a
Parents: bac665c
Author: Daniel Sun <su...@apache.org>
Authored: Thu Sep 27 00:17:25 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Thu Sep 27 00:17:25 2018 +0800

----------------------------------------------------------------------
 .../src/main/java/groovy/sql/BatchingStatementWrapper.java        | 3 ++-
 subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java          | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3263b649/subprojects/groovy-sql/src/main/java/groovy/sql/BatchingStatementWrapper.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/BatchingStatementWrapper.java b/subprojects/groovy-sql/src/main/java/groovy/sql/BatchingStatementWrapper.java
index 8e6c4e1..4139704 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/BatchingStatementWrapper.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/BatchingStatementWrapper.java
@@ -33,7 +33,7 @@ import java.util.logging.Logger;
  * If the batch count reaches the predefined number, this Statement does an executeBatch()
  * automatically. If batchSize is zero, then no batching is performed.
  */
-public class BatchingStatementWrapper extends GroovyObjectSupport {
+public class BatchingStatementWrapper extends GroovyObjectSupport implements AutoCloseable {
     private final Statement delegate;
     protected int batchSize;
     protected int batchCount;
@@ -122,6 +122,7 @@ public class BatchingStatementWrapper extends GroovyObjectSupport {
         }
     }
 
+    @Override
     public void close() throws SQLException {
         delegate.close();
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/3263b649/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
index 56c5b5b..1616f65 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
@@ -240,7 +240,7 @@ import static org.apache.groovy.sql.extensions.SqlExtensions.toRowResult;
  * @author Daniel Henrique Alves Lima
  * @author David Sutherland
  */
-public class Sql {
+public class Sql implements AutoCloseable {
 
     /**
      * Hook to allow derived classes to access the log
@@ -3415,6 +3415,7 @@ public class Sql {
      * the connection. If this SQL object was created from a DataSource then
      * this method only frees any cached objects (statements in particular).
      */
+    @Override
     public void close() {
         namedParamSqlCache.clear();
         namedParamIndexPropCache.clear();