Class BufferedSQLLogging

java.lang.Object
generalDatabase.SQLLogging
generalDatabase.BufferedSQLLogging
Direct Known Subclasses:
QASoundLogging

public abstract class BufferedSQLLogging extends SQLLogging
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
  • Constructor Details

    • BufferedSQLLogging

      public BufferedSQLLogging(PamDataBlock pamDataBlock, int bufferSeconds)
  • 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

      public boolean logData(PamConnection con, PamDataUnit dataUnit, PamDataUnit superDetection)
      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 class SQLLogging
      Parameters:
      con - Database Connection
      dataUnit - 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

      public boolean reLogData(PamConnection con, PamDataUnit dataUnit)
      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 class SQLLogging
      Parameters:
      con - Database Connection
      dataUnit - 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