Interface IUpsert

All Superinterfaces:
Cloneable
All Known Implementing Classes:
GenericUpsert, MergeUpsert, MySqlUpsert, OracleUpsert, PostgreSqlUpsert, SybaseUpsert, VariableFieldsUpsert

public interface IUpsert extends Cloneable
The strategy used to upsert records to a database.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds the applied values to the batch; called instead of executeUpdate() when the writer is batching.
    void
    Adds this strategy's details, such as the generated SQL, to the exception.
    Returns a new, unprepared copy with the same settings; JdbcMultiUpsertWriter uses one for each connection.
    void
    Releases the statement(s); called when the writer is closed.
    void
    Executes the batch; called each time the writer's batch size is reached and on close if records remain.
    void
    Executes the upsert with the values applied; called after each record when the writer is not batching.
    boolean
    Returns true if addBatch() and executeBatch() are supported; otherwise JdbcUpsertWriter.setBatchSize(int) rejects batch sizes above 1.
    boolean
    Indicates if the generated SQL should be logged (default false).
    void
    prepare(JdbcUpsertWriter writer, Record record)
    Called once, with the first record written, to generate the SQL and create the statement(s).
    setDebug(boolean debug)
    Set to true to log generated SQL (default false).
    void
    Applies the record's values to the pending statement(s); called for every record written.
  • Method Details

    • prepare

      void prepare(JdbcUpsertWriter writer, Record record) throws Throwable
      Called once, with the first record written, to generate the SQL and create the statement(s).
      Throws:
      Throwable
    • setValues

      void setValues(JdbcUpsertWriter writer, Record record) throws Throwable
      Applies the record's values to the pending statement(s); called for every record written.
      Throws:
      Throwable
    • executeUpdate

      void executeUpdate() throws Throwable
      Executes the upsert with the values applied; called after each record when the writer is not batching.
      Throws:
      Throwable
    • isBatchSupported

      boolean isBatchSupported()
      Returns true if addBatch() and executeBatch() are supported; otherwise JdbcUpsertWriter.setBatchSize(int) rejects batch sizes above 1.
    • setDebug

      IUpsert setDebug(boolean debug)
      Set to true to log generated SQL (default false).
    • isDebug

      boolean isDebug()
      Indicates if the generated SQL should be logged (default false).
    • addBatch

      void addBatch() throws Throwable
      Adds the applied values to the batch; called instead of executeUpdate() when the writer is batching.
      Throws:
      Throwable
    • executeBatch

      void executeBatch() throws Throwable
      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; JdbcMultiUpsertWriter uses one for each connection.
    • close

      void close() throws Throwable
      Releases the statement(s); called when the writer is closed.
      Throws:
      Throwable
    • addExceptionProperties

      void addExceptionProperties(DataException exception)
      Adds this strategy's details, such as the generated SQL, to the exception.