Package net.sf.basedb.core
Class AnnotationBatcher.UpdateBatcher
java.lang.Object
net.sf.basedb.core.AnnotationBatcher.UpdateBatcher
- Enclosing class:
- AnnotationBatcher
Batcher implementation for updating and deleting from tables.
It can also be used for inserting when there is no auto-generated
id value to return.
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private final int[]
private final String
private final PreparedStatement
-
Constructor Summary
ConstructorDescriptionUpdateBatcher
(Connection c, String sql, int... parameterTypes) Prepare a new batcher for the given SQL statement. -
Method Summary
Modifier and TypeMethodDescription(package private) void
addToBatch
(Object... values) Add a new entry to the batch.(package private) void
close()
Close the batcher.(package private) void
flush()
Flush and execute the statements added to the batch.(package private) String
getSql()
The SQL statement this batcher is executing.
-
Field Details
-
sql
-
statement
-
parameterTypes
private final int[] parameterTypes -
count
private int count
-
-
Constructor Details
-
UpdateBatcher
UpdateBatcher(Connection c, String sql, int... parameterTypes) throws SQLException Prepare a new batcher for the given SQL statement.- Parameters:
sql
- A SQL statementparameterTypes
- Parameter type codes as defined inTypes
.- Throws:
SQLException
-
-
Method Details
-
getSql
String getSql()The SQL statement this batcher is executing. -
addToBatch
Add a new entry to the batch. The number of values must match the number of parameter types.- Throws:
SQLException
-
flush
Flush and execute the statements added to the batch.- Throws:
SQLException
-
close
void close()Close the batcher.
-