Interface IInsert
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
MultiRowPreparedStatementInsert,MultiRowStatementInsert,MySqlPreparedStatementInsert,OracleMultiRowInsertAllStatementInsert,OracleMultiRowSelectUnionAllStatementInsert,OracleMultiRowStatementInsert,PreparedStatementInsert
The strategy used to write records to a database.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()Adds the applied values to the batch; called instead ofexecuteUpdate()when the writer is batching.addExceptionProperties(DataException exception) Adds this strategy's details, such as the generated SQL, to the exception and returns it.clone()Returns a new, unprepared copy with the same settings;JdbcMultiWriteruses one for each connection.voidclose()Releases the statement(s); called when the writer is closed.voidExecutes the batch; called each time the writer's batch size is reached and on close if records remain.voidExecutes the statement with the values applied; called after each record when the writer is not batching.booleanReturns true ifaddBatch()andexecuteBatch()are supported; otherwiseJdbcWriter.setBatchSize(int)rejects batch sizes above 1.booleanisDebug()Indicates if the generated SQL should be logged (default false).voidprepare(JdbcWriter writer, Record record) Called once, with the first record written, to generate the SQL and create the statement(s).setDebug(boolean debug) Set totrueto log generated SQL (default false).voidsetValues(JdbcWriter writer, Record record) Applies the record's values to the pending statement; called for every record written.
-
Method Details
-
prepare
Called once, with the first record written, to generate the SQL and create the statement(s).- Throws:
Throwable
-
setValues
Applies the record's values to the pending statement; called for every record written.- Throws:
Throwable
-
executeUpdate
Executes the statement with the values applied; called after each record when the writer is not batching.- Throws:
Throwable
-
isBatchSupported
boolean isBatchSupported()Returns true ifaddBatch()andexecuteBatch()are supported; otherwiseJdbcWriter.setBatchSize(int)rejects batch sizes above 1. -
setDebug
Set totrueto log generated SQL (default false). -
isDebug
boolean isDebug()Indicates if the generated SQL should be logged (default false). -
addBatch
Adds the applied values to the batch; called instead ofexecuteUpdate()when the writer is batching.- Throws:
Throwable
-
executeBatch
Executes the batch; called each time the writer's batch size is reached and on close if records remain.- Throws:
Throwable
-
close
Releases the statement(s); called when the writer is closed.- Throws:
Throwable
-
clone
IInsert clone()Returns a new, unprepared copy with the same settings;JdbcMultiWriteruses one for each connection. -
addExceptionProperties
Adds this strategy's details, such as the generated SQL, to the exception and returns it.
-