Class DynamicResultIterator

All Implemented Interfaces:
AutoCloseable, Iterator<SqlResult>, QueryResult, ResultIterator<SqlResult>, SqlResultIterator

public class DynamicResultIterator extends Object implements SqlResultIterator
An iterator view of the result of an AbstractSqlQuery.
See Also:
Last modified
$Date: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
  • Field Details

    • log

      private static final org.slf4j.Logger log
    • results

      private final ResultSet results
      The results of the query.
    • totalCount

      private final long totalCount
      The total number of items.
    • limit

      private final int limit
    • returnedRows

      private int returnedRows
    • sqlResult

      private final SqlResult sqlResult
    • hasNext

      private boolean hasNext
    • checkNext

      private boolean checkNext
    • isClosed

      private boolean isClosed
  • Constructor Details

    • DynamicResultIterator

      DynamicResultIterator(ResultSet results, long totalCount, int limit)
      Create a new result iterator.
      results - The ResultSet object containing the results
      totalCount - The total number of rows
      limit - The maximum numbre of rows that was specified for the query
  • Method Details

    • getTotalCount

      public long getTotalCount()
      From the QueryResult interface ---------------------------------
      Specified by:
      getTotalCount in interface QueryResult
      The total number of items, or -1 if not known
      See Also:
    • close

      public void close()
      From the ResultIterator interface ---------------------------------
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ResultIterator<SqlResult>
    • isClosed

      public boolean isClosed()
      Description copied from interface: ResultIterator
      Check if the iterator has been closed.
      Specified by:
      isClosed in interface ResultIterator<SqlResult>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<SqlResult>
    • next

      public SqlResult next()
      Get the results in the next row. The actual SqlResult object is always the same object. It just changes the underlying pointer to the next row in the result set. If you need to store data from a previous row you must copy the values to another place.
      Specified by:
      next in interface Iterator<SqlResult>
      A SqlResult object
      NoSuchElementException - If there are no more results
    • remove

      public void remove()
      Not supported.
      Specified by:
      remove in interface Iterator<SqlResult>
      UnsupportedOperationException - Always
    • getIndex

      public int getIndex(String name) throws SQLException
      Description copied from interface: SqlResultIterator
      Get the index number of a selected column. Use this method to find the index of a column and then use the SqlResult.getXxx(index) methods to get the value of that column.
      Specified by:
      getIndex in interface SqlResultIterator
      name - The name of a selected column
      The index number
      SQLException - If there is an error