You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/02/02 00:14:20 UTC
svn commit: r905445 -
/pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java
Author: gbrown
Date: Mon Feb 1 23:14:20 2010
New Revision: 905445
URL: http://svn.apache.org/viewvc?rev=905445&view=rev
Log:
Correctly handle hasNext() and hasPrevious() for empty result sets.
Modified:
pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java
Modified: pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java?rev=905445&r1=905444&r2=905445&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/sql/ResultList.java Mon Feb 1 23:14:20 2010
@@ -77,7 +77,8 @@
boolean hasNext;
try {
- hasNext = !resultSet.isLast();
+ hasNext = resultSet.isBeforeFirst()
+ || (resultSet.getRow() > 0 && !resultSet.isLast());
} catch (SQLException exception) {
throw new RuntimeException(exception);
}
@@ -105,7 +106,8 @@
boolean hasPrevious;
try {
- hasPrevious = !resultSet.isFirst();
+ hasPrevious = resultSet.isAfterLast()
+ || (resultSet.getRow() > 0 && !resultSet.isFirst());
} catch (SQLException exception) {
throw new RuntimeException(exception);
}