public class BatchingStatementWrapper
extends groovy.lang.GroovyObjectSupport
implements java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected int |
batchCount |
protected int |
batchSize |
protected java.util.logging.Logger |
log |
protected java.util.List<java.lang.Integer> |
results |
| Constructor and Description |
|---|
BatchingStatementWrapper(java.sql.Statement delegate,
int batchSize,
java.util.logging.Logger log) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBatch(java.lang.String sql) |
void |
clearBatch() |
void |
close() |
int[] |
executeBatch() |
protected void |
incrementBatchCount()
Increments batch count (after addBatch(..) has been called)
and execute
delegate.executeBatch() if batchSize has been reached. |
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args) |
protected void |
processResult(int[] lastResult) |
protected void |
reset() |
protected int batchSize
protected int batchCount
protected java.util.logging.Logger log
protected java.util.List<java.lang.Integer> results
public BatchingStatementWrapper(java.sql.Statement delegate,
int batchSize,
java.util.logging.Logger log)
protected void reset()
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object args)
invokeMethod in interface groovy.lang.GroovyObjectinvokeMethod in class groovy.lang.GroovyObjectSupportpublic void addBatch(java.lang.String sql)
throws java.sql.SQLException
java.sql.SQLExceptionprotected void incrementBatchCount()
throws java.sql.SQLException
delegate.executeBatch() if batchSize has been reached.java.sql.SQLExceptionpublic void clearBatch()
throws java.sql.SQLException
java.sql.SQLExceptionpublic int[] executeBatch()
throws java.sql.SQLException
java.sql.SQLExceptionprotected void processResult(int[] lastResult)
public void close()
throws java.sql.SQLException
close in interface java.lang.AutoCloseablejava.sql.SQLException