Interface IUpsert
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
GenericUpsert,MergeUpsert,MySqlUpsert,OracleUpsert,PostgreSqlUpsert,SybaseUpsert,VariableFieldsUpsert
The strategy used to upsert records to a database.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()Adds the applied values to the batch; called instead ofexecuteUpdate()when the writer is batching.voidaddExceptionProperties(DataException exception) Adds this strategy's details, such as the generated SQL, to the exception.clone()Returns a new, unprepared copy with the same settings;JdbcMultiUpsertWriteruses 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 upsert with the values applied; called after each record when the writer is not batching.booleanReturns true ifaddBatch()andexecuteBatch()are supported; otherwiseJdbcUpsertWriter.setBatchSize(int)rejects batch sizes above 1.booleanisDebug()Indicates if the generated SQL should be logged (default false).voidprepare(JdbcUpsertWriter 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(JdbcUpsertWriter writer, Record record) Applies the record's values to the pending statement(s); 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(s); called for every record written.- Throws:
Throwable
-
executeUpdate
Executes the upsert 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; otherwiseJdbcUpsertWriter.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
-
clone
IUpsert clone()Returns a new, unprepared copy with the same settings;JdbcMultiUpsertWriteruses one for each connection. -
close
Releases the statement(s); called when the writer is closed.- Throws:
Throwable
-
addExceptionProperties
Adds this strategy's details, such as the generated SQL, to the exception.
-