db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r618788 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: conn/GenericLanguageConnectionContext.java execute/BaseActivation.java
Date Tue, 05 Feb 2008 21:50:19 GMT
Author: mamta
Date: Tue Feb  5 13:50:16 2008
New Revision: 618788

URL: http://svn.apache.org/viewvc?rev=618788&view=rev
Log:
DERBY-3304

This commit addresses two issues. First of all, it cleanups up reset method in BaseActivation
which was doing more than
just bringing the Activation back to pre-execution state. The method had to make itself aware
of holdability and what
kind of resultset it was dealing with before closing or clearing the row of the resultset.
The reason for this behavior
is commit code path was relying on Activation.reset to do more than just bringing the activation
to pre-execution state.
I fixed this by moving this code from BaseActivation.reset to GenericLanguageConnectionContext.resetActivations.

Additionally, in the new code in GenericLanguageConnectionContext.resetActivations, I added
the code to not close the
language result sets associated with activations that do not return rows even if activation
may have holdability set to
false. This will ensure that a commit inside a java procedure will not inadvertantly close
the resultset associated with
the java procedure call.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=618788&r1=618787&r2=618788&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Tue Feb  5 13:50:16 2008
@@ -2744,7 +2744,37 @@
 				continue;
 			}
 
-			a.reset();
+			if (andClose) 
+				//Since we are dealing with rollback, we need to reset the 
+				//activation no matter what the holdability might be or no
+				//matter whether the associated resultset returns rows or not.
+				a.reset();
+			else {
+				//We are dealing with commit here. 
+				if (a.getResultSet() != null) {
+					//if the activation has resultset associated with it, then 
+					//use following criteria to take the action
+					if ((a.getResultSetHoldability() == false && a.getResultSet().returnsRows()==true)){
+						//Close result sets that return rows and are not held 
+						//across commit. This is to implement closing JDBC 
+						//result sets that are CLOSE_CURSOR_ON_COMMIT at commit 
+						//time. 
+						a.getResultSet().close();
+					} else if (a.getResultSet().returnsRows()) {
+						//Clear the current row of the result sets that return
+						//rows and are held across commit. This is to implement
+						//keeping JDBC result sets open that are 
+						//HOLD_CURSORS_OVER_COMMIT at commit time and marking
+						//the resultset to be not on a valid row position. The 
+						//user will need to reposition within the resultset 
+						//before doing any row operations.
+						a.getResultSet().clearCurrentRow();
+					}
+				}
+				a.clearHeapConglomerateController();
+				if (!a.isSingleExecution())
+					a.clearWarnings();
+			}
 
 			// Only invalidate statements if we performed DDL.
 			if (andClose && dataDictionaryInWriteMode()) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java?rev=618788&r1=618787&r2=618788&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
Tue Feb  5 13:50:16 2008
@@ -332,16 +332,9 @@
 	 */
 	public void reset() throws StandardException
 	{
-		// if resultset holdability after commit is false, close it
-		if (resultSet != null) {
-			if (!resultSetHoldability || !resultSet.returnsRows()) {			
-				// would really like to check if it is open,
-				// this is as close as we can approximate that.
-				resultSet.close();
-			} else if (resultSet.returnsRows()) {
-				resultSet.clearCurrentRow();
-			}
-		}
+		if (resultSet != null) 
+			resultSet.close();
+		
 		updateHeapCC = null;
 		// REMIND: do we need to get them to stop input as well?
 



Mime
View raw message