You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by be...@apache.org on 2006/04/05 10:05:28 UTC

svn commit: r391559 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java

Author: bernt
Date: Wed Apr  5 01:05:24 2006
New Revision: 391559

URL: http://svn.apache.org/viewcvs?rev=391559&view=rev
Log:
DERBY-787 cursor closed as a sideeffect of closing another cursor with the same name on another connection. Submitted by Andreas Korneliussen

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java?rev=391559&r1=391558&r2=391559&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java Wed Apr  5 01:05:24 2006
@@ -311,27 +311,17 @@
 
 			if (cursorActivation != null)
 			{
-				// check we are compiled against the correct cursor
-				PreparedStatement cps = cursorActivation.getPreparedStatement();
-
-				if (psName.equals(cps.getObjectName())) {
-					cursor = cursorActivation.getCursorResultSet();
-					target = cursorActivation.getTargetResultSet();
-					/* beetle 3865: updateable cursor using index. 2 way communication between
-					 * update activation and cursor activation. Cursor passes index scan to
-					 * update and update passes heap conglom controller to cursor.
-					 */
-					activation.setForUpdateIndexScan(cursorActivation.getForUpdateIndexScan());
-					if (cursorActivation.getHeapConglomerateController() != null)
-						cursorActivation.getHeapConglomerateController().close();
-					cursorActivation.setHeapConglomerateController(activation.getHeapConglomerateController());
-				} else {
-
-					// our prepared statement is now invalid since there
-					// exists another cursor with the same name but a different
-					// statement.
-					activation.getPreparedStatement().makeInvalid(DependencyManager.CHANGED_CURSOR, lcc);
-				}
+				
+				cursor = cursorActivation.getCursorResultSet();
+				target = cursorActivation.getTargetResultSet();
+				/* beetle 3865: updateable cursor using index. 2 way communication between
+				 * update activation and cursor activation. Cursor passes index scan to
+				 * update and update passes heap conglom controller to cursor.
+				 */
+				activation.setForUpdateIndexScan(cursorActivation.getForUpdateIndexScan());
+				if (cursorActivation.getHeapConglomerateController() != null)
+					cursorActivation.getHeapConglomerateController().close();
+				cursorActivation.setHeapConglomerateController(activation.getHeapConglomerateController());				
 			}
 		}
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java?rev=391559&r1=391558&r2=391559&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java Wed Apr  5 01:05:24 2006
@@ -849,16 +849,12 @@
     }
     
     /**
-     * Get a new cursor name. WORKAROUND FOR DERBY-787, since
-     * the cursors have side-effects..!
-     * To reproduce DERBY-787, just return the same cursor name.
+     * Get a cursor name. We use the same cursor name for all cursors.
      */
     private final String getNextCursorName() {
-        return "MYCURSOR" + cursorIndex++;
+        return "MYCURSOR";
     }
     
-    private static int cursorIndex = 0;
-
     
     /**
      * The suite contains all testcases in this class running on different