Class RowCursorResultSet

java.lang.Object
app.babylon.table.io.RowCursorResultSet
All Implemented Interfaces:
RowCursor, AutoCloseable

public class RowCursorResultSet extends Object implements RowCursor
Supplies rows from a caller-owned ResultSet.

This supplier adapts a caller-owned ResultSet. Closing the supplier is a no-op; the caller remains responsible for the lifecycle of the underlying JDBC resources.

Create it around a live ResultSet, call columns() once if column metadata is needed, then advance with next() and read each row through current().

This implementation is a demonstration of what is possible and the likely structure given the ResultSet API. Different drivers may still have quirks that require special implementations.

  • Constructor Details

    • RowCursorResultSet

      public RowCursorResultSet(ResultSet resultSet)
  • Method Details

    • columns

      public ColumnDefinition[] columns()
      Description copied from interface: RowCursor
      Returns source-native column definitions when the physical source has them.

      Line-oriented sources normally return no definitions; their logical columns are detected later from the row stream.

      Specified by:
      columns in interface RowCursor
      Returns:
      source-native column definitions, or an empty array
    • next

      public boolean next()
      Specified by:
      next in interface RowCursor
    • current

      public RowValues current()
      Specified by:
      current in interface RowCursor
    • close

      public void close() throws SQLException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RowCursor
      Throws:
      SQLException