Package generalDatabase
Class BufferedSQLLogging
java.lang.Object
generalDatabase.SQLLogging
generalDatabase.BufferedSQLLogging
- Direct Known Subclasses:
QASoundLogging
Version of SQLLogging which buffers up the data units for a few seconds before writing them
so that other parts of PAMguard get a chance to modify them before they go into the
database. If a unit is updated AFTER it's been written, it will still get updated in the
normal way
This is causing a few issues with the need to subclass
- Author:
- dg50
-
Field Summary
Fields inherited from class generalDatabase.SQLLogging
UPDATE_POLICY_OVERWRITE, UPDATE_POLICY_WRITENEW
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Flush the buffer, writing everything to the database.int
boolean
logData
(PamConnection con, PamDataUnit dataUnit, PamDataUnit superDetection) Called when a new PamDataUnit is added to a PamDataBlock to write those data to the database.boolean
reLogData
(PamConnection con, PamDataUnit dataUnit) Called when an old PamDataUnit is updated.void
setBufferSeconds
(int bufferSeconds) Methods inherited from class generalDatabase.SQLLogging
addAddOn, clearAllAddOns, countTableItems, countTableItems, createInClause, deleteData, deleteData, deleteData, deleteIndexedItems, doExtraChecks, double2Float, findClosestDataPoint, findLogger, getBaseTableDefinition, getEarlyLoadClause, getIdListUpdatClause, getLastLoadIndex, getLastLoadUID, getLastTime, getLoggingAddOns, getPamDataBlock, getTableDefinition, getTimesUpdateClause, getUIDMatchClause, getUpdatePolicy, getViewerCursorFinder, getViewerEverythingClause, getViewerLessThanClause, getViewerLoadClause, getViewerOverlapClause, getViewerUpdateClause, isCanView, isLoadViewData, loadDataFrom, loadEarlyData, loadEarlyData, loadLastDataUnit, loadSubtableData, loadSubtableData, loadViewData, loadViewData, loadViewerData, logData, prepareEmulation, prepareForMixedMode, readLastData, readMixedModeData, readNextEmulation, reCheckTable, reLogData, removeAddOn, removeAddOn, reset, saveOfflineData, setCanView, setColumnData, setLoadViewData, setTableData, setTableDefinition, setUpdatePolicy, transferDataFromResult
-
Constructor Details
-
BufferedSQLLogging
-
-
Method Details
-
flushBuffer
public void flushBuffer()Flush the buffer, writing everything to the database. This will have to be called explicitly by anything using buffered logging to ensure all data are written, otherwise data may still be in the buffer when the database closes. -
logData
Description copied from class:SQLLogging
Called when a new PamDataUnit is added to a PamDataBlock to write those data to the database. Functionality moved down to PamCursor so that exact writing method can become database specific if necessary.- Overrides:
logData
in classSQLLogging
- Parameters:
con
- Database ConnectiondataUnit
- Pamguard Data unit.superDetection
- reference to a super detection so additional cross referencing can be filled- Returns:
- true if written and new index of dataUnit retrieved OK
- See Also:
-
reLogData
Description copied from class:SQLLogging
Called when an old PamDataUnit is updated. The record is either updated or a new record is written, but cross referenced to the old unit for bookkeeping purposes based on the updatePolicy flag.- Overrides:
reLogData
in classSQLLogging
- Parameters:
con
- Database ConnectiondataUnit
- Pamguard Data unit.- Returns:
- the number of rows written to the database.
- See Also:
-
getBufferSeconds
public int getBufferSeconds()- Returns:
- the bufferSeconds
-
setBufferSeconds
public void setBufferSeconds(int bufferSeconds) - Parameters:
bufferSeconds
- the bufferSeconds to set
-