Class ResultSetList

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Map<String,Object>>, Collection<Map<String,Object>>, Deque<Map<String,Object>>, List<Map<String,Object>>, Queue<Map<String,Object>>

public final class ResultSetList extends LinkedList<Map<String,Object>>
Transforms an SQL ResultSet into a list of maps.

Loads the entire result set into an in-memory data structure, and then closes the result set object.

See Also:
  • Constructor Details

    • ResultSetList

      public ResultSetList(ResultSet rs, int pos, int limit, boolean includeRowNums) throws SQLException
      Constructor.
      Parameters:
      rs - The result set to load into this DTO.
      pos - The start position (zero-indexed).
      limit - The maximum number of rows to retrieve.
      includeRowNums - Make the first column be the row number.
      Throws:
      SQLException - Database error.
  • Method Details

    • readEntry

      protected static Object readEntry(ResultSet rs, int col, int dataType)
      Reads the specified column from the current row in the result set.

      Subclasses can override this method to handle specific data types in special ways.

      Parameters:
      rs - The result set to read from.
      col - The column number (indexed by 1).
      dataType - The type of the entry.
      Returns:
      The entry as an Object.