Package net.sf.basedb.core
Class AnnotationBatcher.InsertBatcher
java.lang.Object
net.sf.basedb.core.AnnotationBatcher.InsertBatcher
- Enclosing class:
- AnnotationBatcher
Batcher implementation for inserting into tables.
Assumes that the table has an "id" column that is
auto-generated by the SQL statement. The value of
the generated id is retuned by the
insert(Object[])
method.-
Field Summary
Modifier and TypeFieldDescriptionprivate final int[]
private final String
private final PreparedStatement
-
Constructor Summary
ConstructorDescriptionInsertBatcher
(Connection c, String sql, int... parameterTypes) Prepare a new batcher for the given SQL statement. -
Method Summary
-
Field Details
-
sql
-
statement
-
parameterTypes
private final int[] parameterTypes
-
-
Constructor Details
-
InsertBatcher
InsertBatcher(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. -
insert
Execute an insert SQL statement with the given parameter values. The number of values must match the number of parameter types.- Returns:
- The ID of inserted row
- Throws:
SQLException
-
close
void close()Close the batcher.
-