Interface IInsert

All Superinterfaces:
Cloneable
All Known Implementing Classes:
MultiRowPreparedStatementInsert, MultiRowStatementInsert, MySqlPreparedStatementInsert, OracleMultiRowInsertAllStatementInsert, OracleMultiRowSelectUnionAllStatementInsert, OracleMultiRowStatementInsert, PreparedStatementInsert

public interface IInsert extends Cloneable
The strategy used to write 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.
    Adds this strategy's details, such as the generated SQL, to the exception and returns it.
    Returns a new, unprepared copy with the same settings; JdbcMultiWriter 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 statement with the values applied; called after each record when the writer is not batching.
    boolean
    Returns true if addBatch() and executeBatch() are supported; otherwise JdbcWriter.setBatchSize(int) rejects batch sizes above 1.
    boolean
    Indicates if the generated SQL should be logged (default false).
    void
    prepare(JdbcWriter 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
    setValues(JdbcWriter writer, Record record)
    Applies the record's values to the pending statement; called for every record written.
  • Method Details

    • prepare

      void prepare(JdbcWriter 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(JdbcWriter writer, Record record) throws Throwable
      Applies the record's values to the pending statement; called for every record written.
      Throws:
      Throwable
    • executeUpdate

      void executeUpdate() throws Throwable
      Executes the statement 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 JdbcWriter.setBatchSize(int) rejects batch sizes above 1.
    • setDebug

      IInsert 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
    • close

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

      IInsert clone()
      Returns a new, unprepared copy with the same settings; JdbcMultiWriter uses one for each connection.
    • addExceptionProperties

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