db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r530646 - in /db/ddlutils/trunk: lib/ src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java src/java/org/apache/ddlutils/platform/PlatformImplBase.java
Date Fri, 20 Apr 2007 05:06:28 GMT
Author: tomdz
Date: Thu Apr 19 22:06:28 2007
New Revision: 530646

URL: http://svn.apache.org/viewvc?view=rev&rev=530646
Log:
Fix for DDLUTILS-170

Modified:
    db/ddlutils/trunk/lib/   (props changed)
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java

Propchange: db/ddlutils/trunk/lib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Apr 19 22:06:28 2007
@@ -1,3 +1,3 @@
-
 drivers
 checkstyle*.jar
+driver-alternatives

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java?view=diff&rev=530646&r1=530645&r2=530646
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
Thu Apr 19 22:06:28 2007
@@ -255,6 +255,7 @@
                     {
                         curTable = (Table)_preparedQueryHints.get(_caseSensitive ? columnName
: columnName.toLowerCase());
                     }
+
                     Object value = _platform.getObjectFromResultSet(_resultSet, columnName,
curTable);
 
                     bean.set(propName, value);
@@ -267,6 +268,23 @@
                 cleanUp();
                 throw new DatabaseOperationException("Exception while reading the row from
the resultset", ex);
             }
+        }
+    }
+
+    /**
+     * Advances the iterator without materializing the object. This is the same effect as
calling
+     * {@link #next()} except that no object is created and nothing is read from the result
set.
+     */
+    public void advance()
+    {
+        advanceIfNecessary();
+        if (_isAtEnd)
+        {
+            throw new NoSuchElementException("No more elements in the resultset");
+        }
+        else
+        {
+            _needsAdvancing = true;
         }
     }
     

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?view=diff&rev=530646&r1=530645&r2=530646
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Thu Apr
19 22:06:28 2007
@@ -1001,12 +1001,16 @@
 
             int rowIdx = 0;
 
-            for (Iterator it = createResultSetIterator(model, resultSet, queryHints); ((end
< 0) || (rowIdx <= end)) && it.hasNext(); rowIdx++)
+            for (ModelBasedResultSetIterator it = createResultSetIterator(model, resultSet,
queryHints); ((end < 0) || (rowIdx <= end)) && it.hasNext(); rowIdx++)
             {
                 if (rowIdx >= start)
                 {
                     result.add(it.next());
                 }
+                else
+                {
+                    it.advance();
+                }
             }
         }
         catch (SQLException ex)
@@ -1081,11 +1085,15 @@
 
             int rowIdx = 0;
 
-            for (Iterator it = createResultSetIterator(model, resultSet, queryHints); ((end
< 0) || (rowIdx <= end)) && it.hasNext(); rowIdx++)
+            for (ModelBasedResultSetIterator it = createResultSetIterator(model, resultSet,
queryHints); ((end < 0) || (rowIdx <= end)) && it.hasNext(); rowIdx++)
             {
                 if (rowIdx >= start)
                 {
                     result.add(it.next());
+                }
+                else
+                {
+                    it.advance();
                 }
             }
         }



Mime
View raw message