Package org.intermine.sql.writebatch
Class BatchWriterPostgresCopyImpl
- java.lang.Object
-
- org.intermine.sql.writebatch.BatchWriterSimpleImpl
-
- org.intermine.sql.writebatch.BatchWriterPreparedStatementImpl
-
- org.intermine.sql.writebatch.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 Summary
Fields Modifier and Type Field Description protected static java.math.BigInteger
HUNDRED
protected static java.math.BigInteger
TEN
protected static java.math.BigInteger
TEN_THOUSAND
protected static java.math.BigInteger
THOUSAND
-
Fields inherited from class org.intermine.sql.writebatch.BatchWriterSimpleImpl
addBatches, con, deleteBatches, deleteTempTableSize, lastBatch, postDeleteBatch, preDeleteBatch, stats
-
-
Constructor Summary
Constructors Constructor Description BatchWriterPostgresCopyImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected int
getTableSize(java.lang.String name, java.sql.Connection conn)
Returns the approximate number of rows in a table.-
Methods inherited from class org.intermine.sql.writebatch.BatchWriterPreparedStatementImpl
addToLastBatch, addToPostDeleteBatch
-
Methods inherited from class org.intermine.sql.writebatch.BatchWriterSimpleImpl
addToPreDeleteBatch, doAnalyse, doDeletes, doIndirectionDeletes, setThreshold, updateStatistics, write
-
-
-
-
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 classBatchWriterPreparedStatementImpl
- Parameters:
name
- the name of the tabletable
- the table batchbatches
- 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 classBatchWriterPreparedStatementImpl
- Parameters:
name
- the name of the tabletable
- the IndirectionTableBatchbatches
- 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 classBatchWriterSimpleImpl
- Parameters:
name
- the name of the tableconn
- a Connection to use- Returns:
- an int
- Throws:
java.sql.SQLException
- if there is a problem
-
-