Type Parameters:
T - type of the record being returned
All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
DomainDBCursor, ECLMultiDomainDBCursor, MultiDomainDBCursor

@NotThreadSafe public interface DBCursor<T> extends Closeable
Generic cursor interface into the changelog database. Once it is not used anymore, a cursor must be closed to release all the resources into the database.

The cursor provides a java.sql.ResultSet like API : it is positioned before the first requested record and needs to be moved forward by calling next().

Usage:

  try (DBCursor cursor = ...) {
    while (cursor.next()) {
      Record record = cursor.getRecord();
      // ... can call cursor.getRecord() again: it will return the same result
    }
  }
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Options to create a cursor.
    static enum 
    Represents a cursor key positioning strategy.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Release the resources and locks used by this Iterator.
    Getter for the current record.
    boolean
    Skip to the next record of the database.
  • Method Details

    • getRecord

      T getRecord()
      Getter for the current record.

      This method will always return null when

      • a call to next() returns false
      • it is called before the very first call to next().
      Returns:
      The current record. May be null.
    • next

      boolean next() throws ChangelogException
      Skip to the next record of the database.
      Returns:
      true if has next, false otherwise
      Throws:
      ChangelogException - When database exception raised.
    • close

      default void close()
      Release the resources and locks used by this Iterator. This method must be called when the iterator is no longer used. Failure to do it could cause DB deadlock.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable