public class BatchingStatementWrapper extends GroovyObjectSupport
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)
Invokes the given method.
|
protected void |
processResult(int[] lastResult) |
protected void |
reset() |
getMetaClass, getProperty, setMetaClass, setProperty
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)
GroovyObject
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
name
- the name of the method to callargs
- the arguments to use for the method callpublic void addBatch(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
protected void incrementBatchCount() throws java.sql.SQLException
delegate.executeBatch()
if batchSize has been reached.java.sql.SQLException
public void clearBatch() throws java.sql.SQLException
java.sql.SQLException
public int[] executeBatch() throws java.sql.SQLException
java.sql.SQLException
protected void processResult(int[] lastResult)
public void close() throws java.sql.SQLException
java.sql.SQLException