|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.AbstractBatcher
net.sf.basedb.core.PositionBatcher
public class PositionBatcher
Batcher class for per-position data in the dynamic database. This batcher is used to insert data that is valid for all positions in a data cube.
Normally this means linking a position to a reporter.
Code example: Dynamic API - Creating a root bioassayset
BioAssaySet.getPositionBatcher()| Field Summary | |
|---|---|
private long |
bytes
The number of bytes this batcher has added to the data cube and experiment. |
private long |
bytesPerRow
The number of bytes used by a single row. |
private DataCube |
dataCube
The datacube this batcher inserts data for. |
private int |
maxPosition
The maximum position number inserted by the batcher. |
private PreparedStatement |
positionSql
The statement that inserts the position/reporter link. |
private String |
positionSqlStatement
The SQL string for the positionSql statement. |
private int |
queuedInsertCount
The number of queued inserts. |
private int |
totalInsertCount
The total number of inserts done by this batcher. |
| Fields inherited from class net.sf.basedb.core.AbstractBatcher |
|---|
debugSqlEnabled, logSql |
| Constructor Summary | |
|---|---|
PositionBatcher(DbControl dc,
DataCube dataCube)
Create a new position batcher for a data cube. |
|
| Method Summary | |
|---|---|
private String |
buildInsertSelectSql(String selectSql)
Build the INSERT INTO ... |
private void |
buildPositionSql()
Builds the insert SQL statement. |
void |
flush()
Flush the batcher and send all remaining items in memory to the database. |
int |
insert(AbstractSqlQuery query)
Insert position/reporter links using a query. |
void |
insert(int position,
ReporterData reporter)
Link a position to a reporter. |
(package private) void |
onBeforeClose()
Update bytes and max position on the datacube and close open SQL statements. |
| Methods inherited from class net.sf.basedb.core.AbstractBatcher |
|---|
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final DataCube dataCube
private int queuedInsertCount
private int totalInsertCount
private int maxPosition
private long bytes
private final long bytesPerRow
private PreparedStatement positionSql
INSERT INTO Dynamic#PerPosition (cube, position, reporter_id) VALUES (cube, ?, ?)
private String positionSqlStatement
positionSql statement.
| Constructor Detail |
|---|
PositionBatcher(DbControl dc,
DataCube dataCube)
| Method Detail |
|---|
public void flush()
throws BaseException
Batcher
BaseException - If there is an errorBatcher.close()
void onBeforeClose()
throws BaseException
onBeforeClose in class AbstractBatcherBaseException
public void insert(int position,
ReporterData reporter)
throws BaseException
position - The position coordinatereporter - The reporter or null if no reporter is known
BaseException - If there is an error
public 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 inserted
BaseException - If there is an error
private void buildPositionSql()
throws SQLException,
BaseException
SQLException
BaseExceptionBatchUtil.buildInsertSql(VirtualDb, VirtualTable, VirtualColumn[], Object[])
private String buildInsertSelectSql(String selectSql)
throws BaseException
selectSql - The SELECT part of the query
BaseExceptionBatchUtil.buildInsertSelectSql(VirtualDb, VirtualTable, VirtualColumn[], String)
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||