[Java] Class BatchingStatementWrapper
- groovy.sql.BatchingStatementWrapper
- All Implemented Interfaces and Traits:
- AutoCloseable
public class BatchingStatementWrapper extends GroovyObjectSupport implements AutoCloseable
Class which delegates to a Statement but keeps track of a batch count size. If the batch count reaches the predefined number, this Statement does an executeBatch() automatically. If batchSize is zero, then no batching is performed.
Field Summary
Modifiers | Name | Description |
---|---|---|
protected int | batchCount | |
protected int | batchSize | |
protected Logger | log | |
protected List<Integer> | results |
Constructor Summary
Constructor and description |
---|
BatchingStatementWrapper
(Statement delegate, int batchSize, Logger log) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public void |
addBatch(String sql) | |
public void |
clearBatch() | |
public void |
close() | |
public int[] |
executeBatch() | |
protected void |
incrementBatchCount() Increments batch count (after addBatch(..) has been called) and execute delegate.executeBatch() if batchSize has been reached. | |
public Object |
invokeMethod(String name, Object args) | |
protected void |
processResult(int[] lastResult) | |
protected void |
reset() |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class GroovyObjectSupport | getMetaClass, setMetaClass |
Field Detail
protected int batchCount
protected int batchSize
protected Logger log
protected List<Integer> results
Constructor Detail
public BatchingStatementWrapper(Statement delegate, int batchSize, Logger log)
Method Detail
public void addBatch(String sql)
public void clearBatch()
@Override public void close()
public int[] executeBatch()
protected void incrementBatchCount()
Increments batch count (after addBatch(..) has been called) and execute delegate.executeBatch()
if batchSize has been reached.
@Override public Object invokeMethod(String name, Object args)
protected void processResult(int[] lastResult)
protected void reset()
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/sql/BatchingStatementWrapper.html