Class StatementBatcher

java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.db.StatementBatcher
All Implemented Interfaces:
AutoCloseable, Consumer<String>, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.event.INotifier.INotifier2

public class StatementBatcher extends org.eclipse.net4j.util.event.Notifier implements AutoCloseable, Consumer<String>
A helper for batching SQL statements.
Since:
4.13
Author:
Eike Stepper
  • Constructor Details

    • StatementBatcher

      public StatementBatcher(Connection connection)
    • StatementBatcher

      public StatementBatcher(Connection connection, int batchSize)
  • Method Details

    • getConnection

      public final Connection getConnection()
    • getStatement

      public final Statement getStatement()
    • getBatchSize

      public final int getBatchSize()
    • getBatchCount

      public final int getBatchCount()
    • getTotalUpdateCount

      public final int getTotalUpdateCount()
    • accept

      public final void accept(String sql)
      Specified by:
      accept in interface Consumer<String>
    • batch

      public int batch(String sql)
    • isClosed

      public final boolean isClosed()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • ensureStatement

      protected final Statement ensureStatement() throws SQLException
      Throws:
      SQLException
    • doExecuteBatch

      protected final int doExecuteBatch()