db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r619772 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Date Fri, 08 Feb 2008 05:42:17 GMT
Author: mamta
Date: Thu Feb  7 21:42:05 2008
New Revision: 619772

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

Some code cleanup in GenericLanguageConnectionContext.endTransactionActivationHandling so
the code is more readable.
No functionality change, just consolidated various if statements and used some local variables
to replace repeated
method calls like a.getResultSet() and a.getResultSet().returnsRows()


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=619772&r1=619771&r2=619772&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
Thu Feb  7 21:42:05 2008
@@ -2744,42 +2744,44 @@
 				continue;
 			}
 
-			if (forRollback) 
+			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.
 				a.reset();
-			else {
+				// Only invalidate statements if we performed DDL.
+				if (dataDictionaryInWriteMode()) {
+					ExecPreparedStatement ps = a.getPreparedStatement();
+					if (ps != null) {
+						ps.makeInvalid(DependencyManager.ROLLBACK, this);
+					}
+				}
+			} else {
 				//We are dealing with commit here. 
 				if (a.getResultSet() != null) {
+					ResultSet activationResultSet = a.getResultSet();
+					boolean resultsetReturnsRows = activationResultSet.returnsRows();
 					//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();
+					if (resultsetReturnsRows){
+						if (a.getResultSetHoldability() == false)
+							//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. 
+							activationResultSet.close();
+						else 
+							//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.
+							activationResultSet.clearCurrentRow();							
 					}
 				}
 				a.clearHeapConglomerateController();
-			}
-
-			// Only invalidate statements if we performed DDL.
-			if (forRollback && dataDictionaryInWriteMode()) {
-				ExecPreparedStatement ps = a.getPreparedStatement();
-				if (ps != null) {
-					ps.makeInvalid(DependencyManager.ROLLBACK, this);
-				}
 			}
 		}
 	}



Mime
View raw message