[hg] main-silver: #223729: com.ibm.db2.jcc.c.SqlException: Inval...

  • From: Jaroslav Havlin < >
  • To:
  • Subject: [hg] main-silver: #223729: com.ibm.db2.jcc.c.SqlException: Inval...
  • Date: Thu, 13 Dec 2012 06:35:54 -0800

changeset f66a8a00e35c in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/f66a8a00e35c
description:
        #223729: com.ibm.db2.jcc.c.SqlException: Invalid operation: result 
set is closed

        If method ResultSet.next() returns null, it should not be called 
again.
        Simplifying code.

diffstat:

 
db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java
 |  15 ++-------
 1 files changed, 4 insertions(+), 11 deletions(-)

diffs (41 lines):

diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java
@@ -594,23 +594,19 @@
         int colCnt = tblMeta.getColumnCount();
         try {
             // Skip till current position
-            boolean lastRowPicked = rs.next();
+            boolean hasNext = rs.next();
             int curRowPos = 1;
-            while (lastRowPicked && curRowPos < (startFrom + 1)) {
+            while (hasNext && curRowPos < (startFrom + 1)) {
                 if (Thread.currentThread().isInterrupted()) {
                     return;
                 }
-                lastRowPicked = rs.next();
+                hasNext = rs.next();
                 curRowPos++;
             }
 
             // Get next page
             int rowCnt = 0;
-            boolean hasNext = false;
-            if (! lastRowPicked) {
-                hasNext = rs.next();
-            }
-            while (((pageSize == -1) || (pageSize > rowCnt)) && 
(lastRowPicked || hasNext)) {
+            while (((pageSize == -1) || (pageSize > rowCnt)) && (hasNext)) {
                 if (Thread.currentThread().isInterrupted()) {
                     return;
                 }
@@ -621,9 +617,6 @@
                 }
                 rows.add(row);
                 rowCnt++;
-                if (lastRowPicked) {
-                    lastRowPicked = false;
-                }
                 try {
                     hasNext = rs.next();
                 } catch (SQLException x) {

[hg] main-silver: #223729: com.ibm.db2.jcc.c.SqlException: Inval...

Jaroslav Havlin 12/13/2012

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close