db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r610238 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/EmbedResultSet.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Date Wed, 09 Jan 2008 00:07:34 GMT
Author: djd
Date: Tue Jan  8 16:07:34 2008
New Revision: 610238

URL: http://svn.apache.org/viewvc?rev=610238&view=rev
Log:
DERBY-3305 Ensure that a processing a ResultSet into a dynamic result marks the application
statment result set as the correct one, based upon the statement the result set is transferred
to. Add asserts to jdbcapi.ProcedureTest to check that ResultSet.getStatement returns the
correct Statement object.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=610238&r1=610237&r2=610238&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Tue Jan
 8 16:07:34 2008
@@ -4398,6 +4398,7 @@
         
         if (owningStmt != null) {
 		    this.owningStmt = owningStmt;
+            this.applicationStmt = owningStmt.applicationStatement;
             this.localConn = owningStmt.getEmbedConnection();
         }
         else

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=610238&r1=610237&r2=610238&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Tue Jan  8 16:07:34 2008
@@ -75,6 +75,7 @@
         Statement stmt = createStatement();
         ResultSet rs = stmt.executeQuery("CALL RETRIEVE_DYNAMIC_RESULTS(1)");
         assertNotNull("executeQuery() returned null.", rs);
+        assertSame(stmt, rs.getStatement());
         JDBC.assertDrainResultsHasData(rs);
     }
 
@@ -159,6 +160,7 @@
         ps.setInt(1, 1);
         ResultSet rs = ps.executeQuery();
         assertNotNull("executeQuery() returned null.", rs);
+        assertSame(ps, rs.getStatement());
         JDBC.assertDrainResultsHasData(rs);
 
     }
@@ -258,6 +260,7 @@
         cs.setInt(1, 1);
         ResultSet rs = cs.executeQuery();
         assertNotNull("executeQuery() returned null.", rs);
+        assertSame(cs, rs.getStatement());
         JDBC.assertDrainResultsHasData(rs);
     }
 
@@ -946,7 +949,8 @@
             int pass = 0;
             do {
 
-                    allRS[pass++] = cs.getResultSet();                
+                    allRS[pass++] = cs.getResultSet();      
+                    assertSame(cs, allRS[pass-1].getStatement());
                     // expect everything to stay open.                        
 
             } while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT));
@@ -972,7 +976,8 @@
             int pass = 0;
             do {
 
-                    allRS[pass++] = cs.getResultSet();                
+                    allRS[pass++] = cs.getResultSet();         
+                    assertSame(cs, allRS[pass-1].getStatement());
                     // expect everything to stay open.                        
 
             } while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT));
@@ -993,10 +998,12 @@
 
             //first two with KEEP_CURRENT_RESULT"
             allRS[0] = cs.getResultSet();
+            assertSame(cs, allRS[0].getStatement());
             boolean moreRS = cs.getMoreResults(Statement.KEEP_CURRENT_RESULT);
             if (!moreRS)
                     fail("FAIL - no second result set");
-            allRS[1] = cs.getResultSet();                
+            allRS[1] = cs.getResultSet();   
+            assertSame(cs, allRS[1].getStatement());
             // two open
             allRS[0].next();
             assertEquals(2,allRS[0].getInt(1));
@@ -1009,6 +1016,7 @@
                     fail("FAIL - no third result set");
             // first and third open
             allRS[2] = cs.getResultSet();
+            assertSame(cs, allRS[2].getStatement());
             assertEquals(2,allRS[0].getInt(1));
             JDBC.assertClosed(allRS[1]);
             allRS[2].next();
@@ -1020,6 +1028,7 @@
             if (!moreRS)
                     fail("FAIL - no fourth result set");
             allRS[3] = cs.getResultSet();
+            assertSame(cs, allRS[3].getStatement());
             allRS[3].next();
             // first, third and fourth open, second closed
             assertEquals(2,allRS[0].getInt(1));
@@ -1032,6 +1041,7 @@
             if (!moreRS)
                    fail("FAIL - no fifth result set");
             allRS[4] = cs.getResultSet();
+            assertSame(cs, allRS[4].getStatement());
             allRS[4].next();
             // only fifth open
             JDBC.assertClosed(allRS[0]);
@@ -1067,6 +1077,7 @@
             for (int i = 0; i < 5; i++)
             {
                 allRS[i] = cs.getResultSet();
+                assertSame(cs, allRS[i].getStatement());
                 allRS[i].next();
                 assertEquals(2+i, allRS[i].getInt(1));
                 
@@ -1087,6 +1098,7 @@
             for (int i = 0; i < 5; i++)
             {
                 allRS[i] = cs.getResultSet();
+                assertSame(cs, allRS[i].getStatement());
                 allRS[i].next();
                 assertEquals(2+i, allRS[i].getInt(1));
                 
@@ -1116,6 +1128,7 @@
             for (int i = 0; i < 5; i++)
             {
                 allRS[i] = cs.getResultSet();
+                assertSame(cs, allRS[i].getStatement());
                 allRS[i].next();
                 assertEquals(2+i, allRS[i].getInt(1));
                 



Mime
View raw message