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 km...@apache.org on 2007/10/30 18:26:00 UTC

svn commit: r590164 - in /db/derby/code/branches/10.1/java/engine/org/apache/derby: iapi/sql/ iapi/sql/execute/ impl/sql/compile/ impl/sql/execute/

Author: kmarsden
Date: Tue Oct 30 10:25:59 2007
New Revision: 590164

URL: http://svn.apache.org/viewvc?rev=590164&view=rev
Log:
DERBY-766 (partial) Improve code generation to support 5000 unions
Remove passing the activation inot some ResultSetFactory methods.
Incremental progress on removing activations from ResultSetFactory methods

merge from trunk rev 358954


Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/ResultSet.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromList.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/ResultSet.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/ResultSet.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/ResultSet.java Tue Oct 30 10:25:59 2007
@@ -95,6 +95,8 @@
 	 *		statement.
 	 */
 	ResultDescription	getResultDescription();
+	
+	Activation getActivation();
 
 	/**
 	 * Needs to be called before the result set will do anything.

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java Tue Oct 30 10:25:59 2007
@@ -109,13 +109,11 @@
 		@param source the result set from which to take rows to
 			be inserted into the target table.
 		@param checkGM	The code to enforce the check constraints, if any
-		@param activation the activation for this result set,
 		@return the insert operation as a result set.
 		@exception StandardException thrown when unable to perform the insert
 	 */
 	ResultSet getInsertResultSet(NoPutResultSet source, 
-								 GeneratedMethod checkGM,
-							     Activation activation)
+								 GeneratedMethod checkGM)
         throws StandardException;
 
 	/**
@@ -127,13 +125,11 @@
 		@param source the result set from which to take rows to
 			be inserted into the target table.
 		@param vtiRS	The code to instantiate the VTI, if necessary
-		@param activation the activation for this result set,
 		@return the insert VTI operation as a result set.
 		@exception StandardException thrown when unable to perform the insert
 	 */
 	ResultSet getInsertVTIResultSet(NoPutResultSet source, 
-								 NoPutResultSet vtiRS,
-							     Activation activation)
+								 NoPutResultSet vtiRS)
         throws StandardException;
 
 	/**
@@ -144,12 +140,10 @@
 
 		@param source the result set from which to take rows to
 			be inserted into the target table.
-		@param activation the activation for this result set,
 		@return the delete VTI operation as a result set.
 		@exception StandardException thrown when unable to perform the insert
 	 */
-	ResultSet getDeleteVTIResultSet(NoPutResultSet source, 
-							     Activation activation)
+	ResultSet getDeleteVTIResultSet(NoPutResultSet source)
         throws StandardException;
 
 	/**
@@ -162,12 +156,10 @@
 			be deleted from the target table. This result set must
 			contain one column which provides RowLocations that are
 			valid in the target table.
-		@param activation 		the activation for this result set
 		@return the delete operation as a result set.
 		@exception StandardException thrown when unable to perform the delete
 	 */
-	ResultSet getDeleteResultSet(NoPutResultSet source,
-								 Activation activation)
+	ResultSet getDeleteResultSet(NoPutResultSet source)
 							throws StandardException;
 
 	/**
@@ -178,7 +170,6 @@
 
 		@param source the result set from which to take rows to
 			be deleted from the target table.
-		@param activation 		the activation for this result set
 		@param constantActionItem a constant action saved object reference
 		@param dependentResultSets an array of DeleteCascade Resultsets
                                    for the current table referential action
@@ -191,7 +182,7 @@
 		@exception StandardException thrown when unable to perform the delete
 	 */
 	ResultSet getDeleteCascadeResultSet(NoPutResultSet source,
-										Activation activation, int constantActionItem,
+										int constantActionItem,
 										ResultSet[] dependentResultSets, 
 										String resultSetId)
 							throws StandardException;
@@ -207,13 +198,11 @@
 			a column which provides RowLocations that are valid in the 
 			target table, and new values to be placed in those rows.
 		@param checkGM	The code to enforce the check constraints, if any
-		@param activation 		the activation for this result set
 		@return the update operation as a result set.
 		@exception StandardException thrown when unable to perform the update
 	 */
 	ResultSet getUpdateResultSet(NoPutResultSet source, 
-								 GeneratedMethod checkGM,
-							     Activation activation)
+								 GeneratedMethod checkGM)
         throws StandardException;
 
 	/**
@@ -239,7 +228,6 @@
 			a column which provides RowLocations that are valid in the 
 			target table, and new values to be placed in those rows.
 		@param checkGM	The code to enforce the check constraints, if any
-		@param activation 		the activation for this result set
 		@param constantActionItem a constant action saved object reference
 		@param rsdItem   result Description, saved object id. 				
 		@return the update operation as a result set.
@@ -247,7 +235,6 @@
 	 */
 	ResultSet getDeleteCascadeUpdateResultSet(NoPutResultSet source, 
 								 GeneratedMethod checkGM,
-							     Activation activation,
 								 int constantActionItem,
 								 int rsdItem)
         throws StandardException;
@@ -281,10 +268,6 @@
 
 		@param source the result set from which to take rows to be 
 			filtered by this operation.
-		@param activation the activation for this result set,
-			against whcih the restriction and projection are performed
-			and to which current rows must be assigned for the
-			projection and restriction to be performed.
 		@param restriction a reference to a method in the activation
 			that is applied to the activation's "current row" field
 			to determine whether the restriction is satisfied or not.
@@ -318,7 +301,7 @@
 			result set
 	 */
 	NoPutResultSet getProjectRestrictResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod restriction, 
+		GeneratedMethod restriction, 
 		GeneratedMethod projection, int resultSetNumber,
 		GeneratedMethod constantRestriction,
 		int mapArrayItem,
@@ -589,10 +572,6 @@
 
 		@param source the result set from which to take rows to be 
 			filtered by this operation.
-		@param activation the activation for this result set,
-			against whcih the restriction and projection are performed
-			and to which current rows must be assigned for the
-			projection and restriction to be performed.
 		@param emptyRowFun a reference to a method in the activation
 			that is called if the source returns no rows
 		@param resultSetNumber		The resultSetNumber for the ResultSet
@@ -606,7 +585,7 @@
 			result set
 	 */
 	NoPutResultSet getAnyResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod emptyRowFun, int resultSetNumber,
+		GeneratedMethod emptyRowFun, int resultSetNumber,
 		int subqueryNumber, int pointOfAttachment,
 		double optimizerEstimatedRowCount,
 		double optimizerEstimatedCost) 
@@ -620,10 +599,6 @@
 
 		@param source the result set from which to take rows to be 
 			filtered by this operation.
-		@param activation the activation for this result set,
-			against whcih the restriction and projection are performed
-			and to which current rows must be assigned for the
-			projection and restriction to be performed.
 		@param emptyRowFun a reference to a method in the activation
 			that is called if the source returns no rows
 		@param cardinalityCheck The type of cardinality check, if any that
@@ -639,7 +614,7 @@
 			result set
 	 */
 	NoPutResultSet getOnceResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod emptyRowFun,
+		GeneratedMethod emptyRowFun,
 		int cardinalityCheck, int resultSetNumber, 
 		int subqueryNumber, int pointOfAttachment,
 		double optimizerEstimatedRowCount,
@@ -1309,8 +1284,6 @@
 		will return results from the temp table.
 
 		@param source the result set input to this result set.
-		@param activation the activation for this result set,
-			which provides the context for normalization.
 		@param resultSetNumber	The resultSetNumber for the ResultSet
 		@param optimizerEstimatedRowCount	Estimated total # of rows by
 											optimizer
@@ -1320,7 +1293,7 @@
 
 	 	@exception StandardException		Thrown on failure
 	 */
-	NoPutResultSet getMaterializedResultSet(NoPutResultSet source, Activation activation, 
+	NoPutResultSet getMaterializedResultSet(NoPutResultSet source, 
 											int resultSetNumber,
 											double optimizerEstimatedRowCount,
 											double optimizerEstimatedCost,
@@ -1358,8 +1331,6 @@
 		REMIND: needs more description...
 
 		@param source the result set input to this result set.
-		@param activation the activation for this result set,
-			which provides the context for normalization.
 		@param resultSetNumber	The resultSetNumber for the ResultSet
 		@param erdNumber	int for ResultDescription 
 							(so it can be turned back into an object)
@@ -1372,7 +1343,6 @@
 	 	@exception StandardException		Thrown on failure
 	 */
 	NoPutResultSet getNormalizeResultSet(NoPutResultSet source, 
-										 Activation activation, 
 										 int resultSetNumber, int erdNumber,
 										 double optimizerEstimatedRowCount,
 										 double optimizerEstimatedCost,
@@ -1420,7 +1390,6 @@
 	 */
 	NoPutResultSet	getUnionResultSet(NoPutResultSet source1,
 					NoPutResultSet source2,
-					Activation activation, 
 					int resultSetNumber,
 					double optimizerEstimatedRowCount,
 					double optimizerEstimatedCost,

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java Tue Oct 30 10:25:59 2007
@@ -541,30 +541,27 @@
 			if(cascadeDelete || isDependentTable)
 			{
 				resultSetGetter = "getDeleteCascadeResultSet";
+				argCount = 4;
 			}		
 			else
 			{
 				resultSetGetter = "getDeleteResultSet";
+				argCount = 1;
 			}
-			argCount = 2;
+			
 		} else {
-			argCount = 2;
+			argCount = 1;
 			resultSetGetter = "getDeleteVTIResultSet";
 		}
 
-
-		acb.pushThisAsActivation(mb);
-
 		if(isDependentTable)
 		{
-			argCount = 3;
 			mb.push(acb.addItem(makeConstantAction()));
 		
 		}else
 		{
 			if(cascadeDelete)
 			{
-				argCount = 3;
 				mb.push(-1); //root table.
 			}
 		}		
@@ -579,8 +576,6 @@
 				acb.newFieldDeclaration(Modifier.PRIVATE, resultSetArrayType);
 			mb.pushNewArray(ClassName.ResultSet, dependentNodes.length);  // new ResultSet[size]
 			mb.setField(arrayField);
-
-			argCount = 4;
 			for(int index=0 ; index <  dependentNodes.length ; index++)
 			{
 
@@ -620,7 +615,6 @@
 		{
 			if(isDependentTable)
 			{
-				argCount =4;
 				mb.pushNull(resultSetArrayType); //No dependent tables for this table
 			}
 		}
@@ -630,7 +624,6 @@
 		{
 			parentResultSetId = targetTableDescriptor.getSchemaName() +
 			                       "." + targetTableDescriptor.getName();
-			argCount = 5;
 			mb.push(parentResultSetId);
 
 		}

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromList.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromList.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromList.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/FromList.java Tue Oct 30 10:25:59 2007
@@ -843,16 +843,6 @@
 	}
 
 	/**
-		Move the mark for result set being the statement's outermost
-		result set down into the first table of the from list.
-		Generally expect there is only one table at this point.
-	 */
-	void markStatementResultSet()
-	{
-		((FromTable) elementAt(0)).markStatementResultSet();
-	}
-
-	/**
 	 * Get the FromTable from this list which has the specified ResultColumn in
 	 * its RCL.
 	 *

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java Tue Oct 30 10:25:59 2007
@@ -760,10 +760,7 @@
 			// arg 2 generate code to evaluate CHECK CONSTRAINTS
 			generateCheckConstraints( checkConstraints, acb, mb );
 
-			acb.pushThisAsActivation(mb); // arg 3
-
-
-			mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getInsertResultSet", ClassName.ResultSet, 3);
+			mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getInsertResultSet", ClassName.ResultSet, 2);
 		}
 		else
 		{
@@ -778,7 +775,6 @@
 			/*
 			** Generate the insert VTI result set, giving it either the original
 			** source or the normalize result set, the constant action,
-			** and "this".
 			*/
 			acb.pushGetResultSetFactoryExpression(mb);
 
@@ -788,9 +784,7 @@
 			// arg 2
 			targetVTI.generate(acb, mb);
 
-			acb.pushThisAsActivation(mb); // arg 3
-
-			mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getInsertVTIResultSet", ClassName.ResultSet, 3);
+			mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getInsertVTIResultSet", ClassName.ResultSet, 2);
 		}
 	}
 

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/IntersectOrExceptNode.java Tue Oct 30 10:25:59 2007
@@ -349,7 +349,7 @@
          *  11) intermediateOrderByDirection saved object index
          */
 
-		acb.pushGetResultSetFactoryExpression(mb); // instance for getUnionResultSet
+		acb.pushGetResultSetFactoryExpression(mb); // instance for getSetOpResultSet
 
 		getLeftResultSet().generate( acb, mb);
 		getRightResultSet().generate( acb, mb);

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/MaterializeResultSetNode.java Tue Oct 30 10:25:59 2007
@@ -117,13 +117,12 @@
 		acb.pushGetResultSetFactoryExpression(mb);
 
 		childResult.generate(acb, mb);
-		acb.pushThisAsActivation(mb);
 		mb.push(resultSetNumber);
 		mb.push(costEstimate.rowCount());
 		mb.push(costEstimate.getEstimatedCost());
 		closeMethodArgument(acb, mb);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getMaterializedResultSet",
-						ClassName.NoPutResultSet, 6);
+						ClassName.NoPutResultSet, 5);
 	}
 }

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java Tue Oct 30 10:25:59 2007
@@ -120,7 +120,6 @@
 
 		acb.pushGetResultSetFactoryExpression(mb);
 		childResult.generate(acb, mb);
-		acb.pushThisAsActivation(mb);
 		mb.push(resultSetNumber);
 		mb.push(erdNumber);
 		mb.push(costEstimate.rowCount());
@@ -128,7 +127,7 @@
 		mb.push(forUpdate);
 		closeMethodArgument(acb, mb);
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getNormalizeResultSet",
-					ClassName.NoPutResultSet, 8);
+					ClassName.NoPutResultSet, 7);
 	}
 
 	/**

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java Tue Oct 30 10:25:59 2007
@@ -1408,8 +1408,6 @@
 		// Load our final cost estimate.
 		costEstimate = getFinalCostEstimate();
 
-		acb.pushThisAsActivation(mb);
-
 		// if there is no restriction, we just want to pass null.
 		if (restriction == null)
 		{
@@ -1518,7 +1516,7 @@
 		closeMethodArgument(acb, mb);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getProjectRestrictResultSet",
-					ClassName.NoPutResultSet, 12);
+					ClassName.NoPutResultSet, 11);
 	}
 
 	/**

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java Tue Oct 30 10:25:59 2007
@@ -1543,7 +1543,6 @@
 
 		// instance and first arg are pushed by caller
 
-		acb.pushThisAsActivation(mb);
 		mb.push(resultSetNumber);
 		mb.push(erdNumber);
 		mb.push(getCostEstimate().rowCount());
@@ -1552,7 +1551,7 @@
 		closeMethodArgument(acb, mb);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getNormalizeResultSet",
-					ClassName.NoPutResultSet, 8);
+					ClassName.NoPutResultSet, 7);
 	}
 
 	/**

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java Tue Oct 30 10:25:59 2007
@@ -1883,8 +1883,6 @@
 		 */
 		resultSet.getResultColumns().setResultSetNumber(subqResultSetNumber);
 
-		acb.pushThisAsActivation(mb);
-
 		/* Generate code for empty row */
 		resultSet.getResultColumns().generateNulls(acb, mb);
 
@@ -1926,10 +1924,10 @@
 			 *											unique value
 			 */
 			mb.push(cardinalityCheck);
-			nargs = 9;
+			nargs = 8;
 
 		} else {
-			nargs = 8;
+			nargs = 7;
 		}
 
 		mb.push(subqResultSetNumber);

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UnionNode.java Tue Oct 30 10:25:59 2007
@@ -628,14 +628,12 @@
 		 *  arg7: close method
 		 */
 
-
-		acb.pushThisAsActivation(mb);
 		mb.push(resultSetNumber);
 		mb.push(costEstimate.rowCount());
 		mb.push(costEstimate.getEstimatedCost());
 		closeMethodArgument(acb, mb);
 
-		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getUnionResultSet", ClassName.NoPutResultSet, 7);
+		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getUnionResultSet", ClassName.NoPutResultSet, 6);
 	}
 
 	/**

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java Tue Oct 30 10:25:59 2007
@@ -797,18 +797,16 @@
             // generate code to evaluate CHECK CONSTRAINTS
             generateCheckConstraints( checkConstraints, acb, mb ); // arg 2
 
-            acb.pushThisAsActivation(mb);
-
             if(isDependentTable)
             {
                 mb.push(acb.addItem(makeConstantAction()));
                 mb.push(acb.addItem(makeResultDescription()));
                 mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getDeleteCascadeUpdateResultSet",
-                              ClassName.ResultSet, 5);
+                              ClassName.ResultSet, 4);
             }else
             {
                 mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getUpdateResultSet",
-                              ClassName.ResultSet, 3);
+                              ClassName.ResultSet, 2);
             }
         }
 	}

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java Tue Oct 30 10:25:59 2007
@@ -132,6 +132,11 @@
 		this.optimizerEstimatedRowCount = optimizerEstimatedRowCount;
 		this.optimizerEstimatedCost = optimizerEstimatedCost;
 	}
+	
+	public final Activation getActivation()
+	{
+		return activation;
+	}
 
 	// NoPutResultSet interface
 

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java Tue Oct 30 10:25:59 2007
@@ -86,10 +86,10 @@
 		@exception StandardException thrown on error
 	 */
 	public ResultSet getInsertResultSet(NoPutResultSet source, 
-										GeneratedMethod checkGM,
-										Activation activation)
+										GeneratedMethod checkGM)
 		throws StandardException
 	{
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new InsertResultSet(source, checkGM, activation );
 	}
@@ -99,11 +99,11 @@
 		@exception StandardException thrown on error
 	 */
 	public ResultSet getInsertVTIResultSet(NoPutResultSet source, 
-										NoPutResultSet vtiRS,
-										Activation activation)
+										NoPutResultSet vtiRS
+										)
 		throws StandardException
 	{
-
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new InsertVTIResultSet(source, vtiRS, activation );
 	}
@@ -112,10 +112,10 @@
 		@see ResultSetFactory#getDeleteVTIResultSet
 		@exception StandardException thrown on error
 	 */
-	public ResultSet getDeleteVTIResultSet(NoPutResultSet source, 
-										Activation activation)
+	public ResultSet getDeleteVTIResultSet(NoPutResultSet source)
 		throws StandardException
 	{
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new DeleteVTIResultSet(source, activation);
 	}
@@ -124,10 +124,10 @@
 		@see ResultSetFactory#getDeleteResultSet
 		@exception StandardException thrown on error
 	 */
-	public ResultSet getDeleteResultSet(NoPutResultSet source,
-										Activation activation)
+	public ResultSet getDeleteResultSet(NoPutResultSet source)
 			throws StandardException
 	{
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new DeleteResultSet(source, activation );
 	}
@@ -138,13 +138,12 @@
 		@exception StandardException thrown on error
 	 */
 	public ResultSet getDeleteCascadeResultSet(NoPutResultSet source, 
-											   Activation activation,	
 											   int constantActionItem,
 											   ResultSet[] dependentResultSets,
 											   String resultSetId)
 		throws StandardException
 	{
-			
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new DeleteCascadeResultSet(source, activation, 
 										  constantActionItem,
@@ -159,10 +158,10 @@
 		@exception StandardException thrown on error
 	 */
 	public ResultSet getUpdateResultSet(NoPutResultSet source,
-										GeneratedMethod checkGM,
-										Activation activation)
+										GeneratedMethod checkGM)
 			throws StandardException
 	{
+		Activation activation = source.getActivation();
 		//The stress test failed with null pointer exception in here once and then
 		//it didn't happen again. It can be a jit problem because after this null
 		//pointer exception, the cleanup code in UpdateResultSet got a null
@@ -198,15 +197,11 @@
 	 */
 	public ResultSet getDeleteCascadeUpdateResultSet(NoPutResultSet source,
 													 GeneratedMethod checkGM,
-													 Activation activation,
 													 int constantActionItem,
 													 int rsdItem)
 			throws StandardException
 	{
-		if (SanityManager.DEBUG)
-		{
-			SanityManager.ASSERT(getAuthorizer(activation) != null, "Authorizer is null");
-		}
+		Activation activation = source.getActivation();
 		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);
 		return new UpdateResultSet(source, checkGM, activation,
 								   constantActionItem, rsdItem);
@@ -230,7 +225,7 @@
 		@exception StandardException thrown on error
 	 */
 	public NoPutResultSet getProjectRestrictResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod restriction, 
+		GeneratedMethod restriction, 
 		GeneratedMethod projection, int resultSetNumber,
 		GeneratedMethod constantRestriction,
 		int mapRefItem,
@@ -241,7 +236,7 @@
 		GeneratedMethod closeCleanup)
 			throws StandardException
 	{
-		return new ProjectRestrictResultSet(source, activation, 
+		return new ProjectRestrictResultSet(source, source.getActivation(), 
 			restriction, projection, resultSetNumber, 
 			constantRestriction, mapRefItem, 
 			reuseResult,
@@ -419,14 +414,14 @@
 		@exception StandardException thrown on error
 	 */
 	public NoPutResultSet getAnyResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod emptyRowFun, int resultSetNumber,
+		GeneratedMethod emptyRowFun, int resultSetNumber,
 		int subqueryNumber, int pointOfAttachment,
 		double optimizerEstimatedRowCount,
 		double optimizerEstimatedCost)
 			throws StandardException
 	{
 		return new AnyResultSet(source,
-					 activation, emptyRowFun, resultSetNumber,
+					 source.getActivation(), emptyRowFun, resultSetNumber,
 					 subqueryNumber, pointOfAttachment,
 					 optimizerEstimatedRowCount,
 					 optimizerEstimatedCost);
@@ -437,7 +432,7 @@
 		@exception StandardException thrown on error
 	 */
 	public NoPutResultSet getOnceResultSet(NoPutResultSet source,
-		Activation activation, GeneratedMethod emptyRowFun,
+	 GeneratedMethod emptyRowFun,
 		int cardinalityCheck, int resultSetNumber,
 		int subqueryNumber, int pointOfAttachment,
 		double optimizerEstimatedRowCount,
@@ -445,7 +440,7 @@
 			throws StandardException
 	{
 		return new OnceResultSet(source,
-					 activation, emptyRowFun, 
+					 source.getActivation(), emptyRowFun, 
 					 cardinalityCheck, resultSetNumber,
 					 subqueryNumber, pointOfAttachment,
 				     optimizerEstimatedRowCount,
@@ -934,13 +929,13 @@
 		@exception StandardException thrown on error
 	 */
 	public NoPutResultSet getMaterializedResultSet(NoPutResultSet source,
-							Activation activation, int resultSetNumber,
+							int resultSetNumber,
 						    double optimizerEstimatedRowCount,
 							double optimizerEstimatedCost,
 								   GeneratedMethod closeCleanup)
 		throws StandardException
 	{
-		return new MaterializedResultSet(source, activation, 
+		return new MaterializedResultSet(source, source.getActivation(), 
 									  resultSetNumber, 
 									  optimizerEstimatedRowCount,
 									  optimizerEstimatedCost,
@@ -984,7 +979,7 @@
 		@exception StandardException thrown on error
 	 */
 	public NoPutResultSet getNormalizeResultSet(NoPutResultSet source,
-							Activation activation, int resultSetNumber, 
+							int resultSetNumber, 
 							int erdNumber,
 						    double optimizerEstimatedRowCount,
 							double optimizerEstimatedCost,
@@ -992,7 +987,7 @@
 							GeneratedMethod closeCleanup)
 		throws StandardException
 	{
-		return new NormalizeResultSet(source, activation, 
+		return new NormalizeResultSet(source, source.getActivation(), 
 									  resultSetNumber, erdNumber, 
 									  optimizerEstimatedRowCount,
 									  optimizerEstimatedCost, forUpdate,
@@ -1037,7 +1032,6 @@
 	 */
     public NoPutResultSet getUnionResultSet(NoPutResultSet leftResultSet,
 								   NoPutResultSet rightResultSet,
-								   Activation activation,
 								   int resultSetNumber,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
@@ -1045,7 +1039,7 @@
 			throws StandardException
 	{
 		return new UnionResultSet(leftResultSet, rightResultSet, 
-								  activation,
+				                  leftResultSet.getActivation(),
 								  resultSetNumber, 
 								  optimizerEstimatedRowCount,
 								  optimizerEstimatedCost,

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java Tue Oct 30 10:25:59 2007
@@ -146,6 +146,11 @@
 	{
 	    return (ResultDescription)null;
 	}
+	
+	public final Activation getActivation()
+	{
+		return activation;
+	}
 
 	/**
 	 * Returns the row at the absolute position from the query, 

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java?rev=590164&r1=590163&r2=590164&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java Tue Oct 30 10:25:59 2007
@@ -36,6 +36,7 @@
 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
 import org.apache.derby.iapi.sql.execute.TargetResultSet;
 
+import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.sql.ResultDescription;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.Row;
@@ -1143,6 +1144,12 @@
 		return clo;
 	}
 	public java.sql.SQLWarning getWarnings() {
+		return null;
+	}
+
+	public Activation getActivation() {
+		if (SanityManager.DEBUG)
+			SanityManager.THROWASSERT("getActivation() called for " + getClass());
 		return null;
 	}
 }