Class BatchWriterPostgresCopyImpl

  • All Implemented Interfaces:
    BatchWriter

    public class BatchWriterPostgresCopyImpl
    extends BatchWriterPreparedStatementImpl
    An implementation of the BatchWriter interface that uses PostgreSQL-specific COPY commands.
    Author:
    Matthew Wakeling
    • Field Detail

      • TEN

        protected static final java.math.BigInteger TEN
      • HUNDRED

        protected static final java.math.BigInteger HUNDRED
      • THOUSAND

        protected static final java.math.BigInteger THOUSAND
      • TEN_THOUSAND

        protected static final java.math.BigInteger TEN_THOUSAND
    • Constructor Detail

      • BatchWriterPostgresCopyImpl

        public BatchWriterPostgresCopyImpl()
    • Method Detail

      • doInserts

        protected int doInserts​(java.lang.String name,
                                TableBatch table,
                                java.util.List<FlushJob> batches)
                         throws java.sql.SQLException
        Performs all the inserts for the given table name and table batch.
        Overrides:
        doInserts in class BatchWriterPreparedStatementImpl
        Parameters:
        name - the name of the table
        table - the table batch
        batches - the List of batches into which new flushjobs should be placed
        Returns:
        the number of rows inserted
        Throws:
        java.sql.SQLException - if an error occurs
      • doIndirectionInserts

        protected int doIndirectionInserts​(java.lang.String name,
                                           IndirectionTableBatch table,
                                           java.util.List<FlushJob> batches)
                                    throws java.sql.SQLException
        Performs all the insert operations for the given IndirectionTableBatch and name.
        Overrides:
        doIndirectionInserts in class BatchWriterPreparedStatementImpl
        Parameters:
        name - the name of the table
        table - the IndirectionTableBatch
        batches - the List of flushjobs to add further actions to
        Returns:
        the number of rows inserted
        Throws:
        java.sql.SQLException - if an error occurs
      • getTableSize

        protected int getTableSize​(java.lang.String name,
                                   java.sql.Connection conn)
                            throws java.sql.SQLException
        Returns the approximate number of rows in a table.
        Overrides:
        getTableSize in class BatchWriterSimpleImpl
        Parameters:
        name - the name of the table
        conn - a Connection to use
        Returns:
        an int
        Throws:
        java.sql.SQLException - if there is a problem