db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r619279 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Date Thu, 07 Feb 2008 05:48:54 GMT
Author: mamta
Date: Wed Feb  6 21:48:54 2008
New Revision: 619279

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

This is a followup commit for DERBY-3304 based on various comments. It does following
1)The existing method resetActivations in GenericLanguageConnectionContext has been renamed
to better reflect it's
functionality. It will be now called endTransactionActivationHandling since it gets called
for commit/rollback.
2)The javadoc comments for resetActivations(now called endTransactionActivationHandling) were
not valid. Fixed that in 
this commit.
3)Took out the redundant code about setting the holdability to false if we were in rollback.
It was needed earlier
because the method that took care of activations at rollback time needed to check the holdability.
That method
(BaseActivation.reset) does not check holdability anymore and hence we do not need to set
the activations to false
holdability when we are dealing with rollback.
4)Lastly, JDBC api for Connection.commit does not ask for clearing of warnings and hence we
should not have code to
clear the warnings at the time of commit. I removed the warning clearing code from resetActivations(now
called 
endTransactionActivationHandling) in GenericLanguageConnectionContext.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.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=619279&r1=619278&r2=619279&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
Wed Feb  6 21:48:54 2008
@@ -1122,7 +1122,7 @@
 									  "), Committing");
 		}
 
-		resetActivations(false);
+		endTransactionActivationHandling(false);
 
 		//do the clean up work required for temporary tables at the commit time. This cleanup work
 		//can possibly remove entries from allDeclaredGlobalTempTables and that's why we need to
check
@@ -1366,7 +1366,7 @@
 									  "), Rolling back");
 		}
 
-		resetActivations(true);
+		endTransactionActivationHandling(true);
 
 		currentSavepointLevel = 0; //reset the current savepoint level for the connection to 0
at the beginning of rollback work for temp tables
 		if (allDeclaredGlobalTempTables != null)
@@ -1447,7 +1447,7 @@
 				closeConglomerates = true;
 				// bug 5145 - don't forget to close the activations while rolling
 				// back to a savepoint
-				resetActivations(true);
+				endTransactionActivationHandling(true);
 			}
 			else { closeConglomerates = false; }
 
@@ -2703,15 +2703,24 @@
 	// class implementation
 	//
 
-
 	/**
-		resets all open activations, to close their result sets.
-		Also cleans up (close()) activations that have been
+		If we are called as part of rollback code path, then we will reset all 
+		the activations. 
+		
+		If we are called as part of commit code path, then we will do one of 
+		the following if the activation has resultset assoicated with it. Also,
+		we will clear the conglomerate used while scanning for update/delete
+		1)Close result sets that return rows and are not held across commit.
+		2)Clear the current row of the resultsets that return rows and are
+		held across commit.
+		3)Leave the result sets untouched if they do not return rows
+		
+		Additionally, clean up (close()) activations that have been
 		marked as unused during statement finalization.
 
 		@exception StandardException thrown on failure
 	 */
-	private void resetActivations(boolean andClose) throws StandardException {
+	private void endTransactionActivationHandling(boolean forRollback) throws StandardException
{
 
 		// don't use an enumeration as the activation may remove
 		// itself from the list, thus invalidating the Enumeration
@@ -2725,15 +2734,6 @@
 
 			Activation a = (Activation) acts.get(i);
 			/*
-			** andClose true means we are here for rollback.
-			** In case of rollback, we don't care for holding
-			** cursors and that's why I am resetting holdability
-			** to false for all activations just before rollback
-			*/	
-			if (andClose)
-				a.setResultSetHoldability(false);
-
-			/*
 			** Look for stale activations.  Activations are
 			** marked as unused during statement finalization.
 			** Here, we sweep and remove this inactive ones.
@@ -2744,7 +2744,7 @@
 				continue;
 			}
 
-			if (andClose) 
+			if (forRollback) 
 				//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.
@@ -2772,12 +2772,10 @@
 					}
 				}
 				a.clearHeapConglomerateController();
-				if (!a.isSingleExecution())
-					a.clearWarnings();
 			}
 
 			// Only invalidate statements if we performed DDL.
-			if (andClose && dataDictionaryInWriteMode()) {
+			if (forRollback && dataDictionaryInWriteMode()) {
 				ExecPreparedStatement ps = a.getPreparedStatement();
 				if (ps != null) {
 					ps.makeInvalid(DependencyManager.ROLLBACK, this);



Mime
View raw message