org.intermine.sql.writebatch
Class BatchWriterPreparedStatementImpl

java.lang.Object
  extended by org.intermine.sql.writebatch.BatchWriterSimpleImpl
      extended by org.intermine.sql.writebatch.BatchWriterPreparedStatementImpl
All Implemented Interfaces:
BatchWriter
Direct Known Subclasses:
BatchWriterPostgresCopyImpl

public class BatchWriterPreparedStatementImpl
extends BatchWriterSimpleImpl

An implementation of the BatchWriter interface that uses JDBC PreparedStatement addBatch() and executeBatch() methods.


Field Summary
 
Fields inherited from class org.intermine.sql.writebatch.BatchWriterSimpleImpl
addBatches, con, deleteBatches, deleteTempTableSize, lastBatch, postDeleteBatch, preDeleteBatch, stats
 
Constructor Summary
BatchWriterPreparedStatementImpl()
           
 
Method Summary
protected  void addToLastBatch(java.lang.String sql)
          Adds a statement to the lastBatch.
protected  void addToPostDeleteBatch(java.lang.String sql)
          Adds a statement to the postDeleteBatch.
protected  int doIndirectionInserts(java.lang.String name, IndirectionTableBatch table, java.util.List<FlushJob> batches)
          Performs all the insert operations for the given IndirectionTableBatch and name.
protected  int doInserts(java.lang.String name, TableBatch table, java.util.List<FlushJob> batches)
          Performs all the inserts for the given table name and table batch.
 
Methods inherited from class org.intermine.sql.writebatch.BatchWriterSimpleImpl
addToPreDeleteBatch, doAnalyse, doDeletes, doIndirectionDeletes, getTableSize, setThreshold, updateStatistics, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchWriterPreparedStatementImpl

public BatchWriterPreparedStatementImpl()
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 BatchWriterSimpleImpl
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 BatchWriterSimpleImpl
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

addToPostDeleteBatch

protected void addToPostDeleteBatch(java.lang.String sql)
                             throws java.sql.SQLException
Adds a statement to the postDeleteBatch.

Overrides:
addToPostDeleteBatch in class BatchWriterSimpleImpl
Parameters:
sql - the statement
Throws:
java.sql.SQLException - if an error occurs

addToLastBatch

protected void addToLastBatch(java.lang.String sql)
                       throws java.sql.SQLException
Adds a statement to the lastBatch.

Overrides:
addToLastBatch in class BatchWriterSimpleImpl
Parameters:
sql - the statement
Throws:
java.sql.SQLException - if an error occurs