public class MappingBatcher extends AbstractBatcher
Code example: Dynamic API - Creating a root bioassayset
- See Also:
- Last modified
- $Date: 2015-04-21 09:59:42 +0200 (ti, 21 apr 2015) $
Fields Modifier and Type Field Description
private longThe number of bytes this batcher has added to the experiment.
private longThe number of bytes used by a single row.
private DataCubeThe datacube this batcher inserts data for.
private booleanIf the data cube has already received it's data and no raw data can be linked.
private intThe number of queued inserts.
private PreparedStatementThe statement that inserts the spot/raw data link.
private StringThe SQL string for the
private intThe total number of inserts done by this batcher.
Modifier and Type Method Description
String selectSql)(Build the INSERT INTO ...
()Builds the insert SQL statement.
()Flush the batcher and send all remaining items in memory to the database.
()Get the total number of mappings to raw data create by this mapper.
RawData rawData)(short column, int position,Link a spot to a raw data.
AbstractSqlQuery query)(Insert mapping to raw spots using a query.
(package private) void
()Update bytes on data cube and close open SQL statements.
Methods inherited from class net.sf.basedb.core.AbstractBatcher
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess
dataCubeprivate final DataCube dataCubeThe datacube this batcher inserts data for.
noRawMappingprivate final boolean noRawMappingIf the data cube has already received it's data and no raw data can be linked.
queuedInsertCountprivate int queuedInsertCountThe number of queued inserts. Used to check when a flush is needed.
totalInsertCountprivate int totalInsertCountThe total number of inserts done by this batcher.
bytesprivate long bytesThe number of bytes this batcher has added to the experiment.
bytesPerRowprivate final long bytesPerRowThe number of bytes used by a single row.
rawMappingSqlprivate PreparedStatement rawMappingSqlThe statement that inserts the spot/raw data link.
INSERT INTO Dynamic#RawParents (cube, column, position, rawdata_id) VALUES (cube, ?, ?, ?)
rawMappingSqlStatementprivate String rawMappingSqlStatementThe SQL string for the
MappingBatcherCreate a new position batcher for a data cube. It is assumed that the calling code has checked that the cube is allowed to receive more data (ie. it hasn't been committed to the database).
flushpublic void flush() throws BaseExceptionDescription copied from interface:
BatcherFlush the batcher and send all remaining items in memory to the database.
onBeforeClosevoid onBeforeClose() throws BaseExceptionUpdate bytes on data cube and close open SQL statements.
insertLink a spot to a raw data. One spot may be linked to several raw data items.
insertInsert mapping to raw spots using a query. The query MUST select data in the following order: column, position, rawDataId
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 inserted
- int The number of rows inserted
BaseException- If there is an error
getTotalInsertCountpublic int getTotalInsertCount()Get the total number of mappings to raw data create by this mapper.
buildRawMappingSqlBuilds the insert SQL statement. Also creates the Dynamic#RawParents table if it doesn't exists.
buildInsertSelectSqlBuild the INSERT INTO ... SELECT ... statment. Also creates the Dynamic#RawParents table if it doesn't exists.
selectSql- The SELECT part of the query
- See Also:
BatchUtil.buildInsertSelectSql(VirtualDb, VirtualTable, VirtualColumn, String)