Arch4J 1.1

org.arch4j.dataaccess.visitors
Class ResultSetCounter

java.lang.Object
  |
  +--org.arch4j.dataaccess.visitors.ResultSetAdapter
        |
        +--org.arch4j.dataaccess.visitors.ResultSetCounter
All Implemented Interfaces:
ResultSetVisitor

public class ResultSetCounter
extends ResultSetAdapter

This Listener may be used to count the number of rows returned from a result set. It currently spins through the result set and counts the rows. It was done this way so that it could be subclassed and used to count the number of rows processed by the sub-classed listener.

Version:
1.0
Author:
Allan Wick

Constructor Summary
ResultSetCounter()
           
 
Method Summary
 int getNumberOfRows()
          Gets the number of rows processed.
 boolean processNextRow(ResultSet aResultSet)
          Each time through the result set, add one to the count of rows.
 
Methods inherited from class org.arch4j.dataaccess.visitors.ResultSetAdapter
getNumberOfRowsAffected, setNumberOfRowsAffected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetCounter

public ResultSetCounter()
Method Detail

processNextRow

public boolean processNextRow(ResultSet aResultSet)
Each time through the result set, add one to the count of rows. By processing in this manner, sub-classses can be created to add more functionality.

Specified by:
processNextRow in interface ResultSetVisitor
Overrides:
processNextRow in class ResultSetAdapter
Parameters:
aResultSet - The result set to process. The cursor is in the proper position.
Returns:
true if the processor should keep spinning through the result set.

getNumberOfRows

public int getNumberOfRows()
Gets the number of rows processed.

Returns:
The number of rows processed.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.