public class MappingBatcher extends AbstractBatcher
RawData
.
Code example: Dynamic API - Creating a root bioassayset
BioAssaySet.getMappingBatcher()
Modifier and Type | Field and Description |
---|---|
private long |
bytes
The number of bytes this batcher has added to the experiment.
|
private long |
bytesPerRow
The number of bytes used by a single row.
|
private DataCube |
dataCube
The datacube this batcher inserts data for.
|
private boolean |
noRawMapping
If the data cube has already received it's data and
no raw data can be linked.
|
private int |
queuedInsertCount
The number of queued inserts.
|
private PreparedStatement |
rawMappingSql
The statement that inserts the spot/raw data link.
|
private String |
rawMappingSqlStatement
The SQL string for the
rawMappingSql statement. |
private int |
totalInsertCount
The total number of inserts done by this batcher.
|
debugSqlEnabled, logSql
Constructor and Description |
---|
MappingBatcher(DbControl dc,
DataCube dataCube)
Create a new position batcher for a data cube.
|
Modifier and Type | Method and Description |
---|---|
private String |
buildInsertSelectSql(String selectSql)
Build the INSERT INTO ...
|
private void |
buildRawMappingSql()
Builds the insert SQL statement.
|
void |
flush()
Flush the batcher and send all remaining items in memory to the
database.
|
int |
getTotalInsertCount()
Get the total number of mappings to raw data create by this mapper.
|
int |
insert(AbstractSqlQuery query)
Insert mapping to raw spots using a query.
|
void |
insert(short column,
int position,
RawData rawData)
Link a spot to a raw data.
|
(package private) void |
onBeforeClose()
Update bytes on data cube and close open SQL statements.
|
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess
private final DataCube dataCube
private final boolean noRawMapping
private int queuedInsertCount
private int totalInsertCount
private long bytes
private final long bytesPerRow
private PreparedStatement rawMappingSql
INSERT INTO Dynamic#RawParents (cube, column, position, rawdata_id) VALUES (cube, ?, ?, ?)
private String rawMappingSqlStatement
rawMappingSql
statement.public void flush() throws BaseException
Batcher
BaseException
- If there is an errorBatcher.close()
void onBeforeClose() throws BaseException
onBeforeClose
in class AbstractBatcher
BaseException
public void insert(short column, int position, RawData rawData) throws BaseException
column
- The column coordinate of the spotposition
- The position coordinate of the spotrawData
- The raw data objectInvalidDataException
- If the raw data is nullBaseException
- If there is an errorpublic int insert(AbstractSqlQuery query) throws BaseException
Internally this method converts the query into a
INSERT INTO ... SELECT ...
query, making it very fast,
since the data for each position doesn't have to be retreived, processed and
then inserted one row at a time. It is possible to call
this method multiple times with the same or different query.
query
- The query that selects the data to be insertedBaseException
- If there is an errorpublic int getTotalInsertCount()
private void buildRawMappingSql() throws SQLException, BaseException
private String buildInsertSelectSql(String selectSql) throws BaseException
selectSql
- The SELECT part of the queryBaseException
BatchUtil.buildInsertSelectSql(VirtualDb, VirtualTable, VirtualColumn[], String)