db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r388440 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/
Date Fri, 24 Mar 2006 07:48:29 GMT
Author: kahatlen
Date: Thu Mar 23 23:48:28 2006
New Revision: 388440

URL: http://svn.apache.org/viewcvs?rev=388440&view=rev
Log:
DERBY-1112: TemporaryRowHolderResultSet is breaking the contract of
getActivation

The patch modifies the constructors of TemporaryRowHolderImpl so that
they take an Activation instead of a TransactionController. The
transaction controller can still be obtained from the Activation
object. TemporaryRowHolderResultSet now implements getActivation() by
returning the activation of the TemporaryRowHolderImpl that created
it. TemporaryRowHolderImpl and TemporaryRowHolderResultSet are made
package protected.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowTriggerExecutor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
Thu Mar 23 23:48:28 2006
@@ -318,7 +318,7 @@
 			rlColumnNumber = noTriggersOrFks ? 1: numberOfBaseColumns;
 			if(cascadeDelete)
 			{
-				rowHolder = new TemporaryRowHolderImpl(tc, properties, 
+				rowHolder = new TemporaryRowHolderImpl(activation, properties, 
 						(resultDescription != null) ?
 							resultDescription.truncateColumns(rlColumnNumber) :
 							null, false);
@@ -327,7 +327,7 @@
 			}else
 			{
 
-				rowHolder = new TemporaryRowHolderImpl(tc, properties, 
+				rowHolder = new TemporaryRowHolderImpl(activation, properties, 
 						(resultDescription != null) ?
 							resultDescription.truncateColumns(rlColumnNumber) :
 							null);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java
Thu Mar 23 23:48:28 2006
@@ -100,7 +100,9 @@
 		{
 			activation.clearIndexScanInfo();
             if( null == rowHolder)
-                rowHolder = new TemporaryRowHolderImpl( tc, new Properties(), (ResultDescription)
null);
+                rowHolder =
+                    new TemporaryRowHolderImpl(activation, new Properties(),
+                                               (ResultDescription) null);
 		}
 
         try

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/IndexChanger.java Thu
Mar 23 23:48:28 2006
@@ -430,7 +430,8 @@
 			** row holder (the description is needed when the row
 			** holder is going to be handed to users for triggers).
 			*/
-			rowHolder = new TemporaryRowHolderImpl(tc, properties, (ResultDescription)null);
+			rowHolder = new TemporaryRowHolderImpl(activation, properties,
+												   (ResultDescription) null);
 		}
 
 		/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
Thu Mar 23 23:48:28 2006
@@ -924,7 +924,8 @@
 			/*
 			** If deferred we save a copy of the entire row.
 			*/
-			rowHolder = new TemporaryRowHolderImpl(tc, properties, resultDescription);
+			rowHolder = new TemporaryRowHolderImpl(activation, properties,
+												   resultDescription);
 			rowChanger.setRowHolder(rowHolder);
 		}
 
@@ -945,7 +946,8 @@
 			}
 
 			rd = lcc.getLanguageFactory().getResultDescription(resultDescription,columnIndexes);
-			autoGeneratedKeysRowsHolder = new TemporaryRowHolderImpl(tc, properties, rd);
+			autoGeneratedKeysRowsHolder =
+				new TemporaryRowHolderImpl(activation, properties, rd);
 		}
 
 
@@ -1231,7 +1233,9 @@
 		*/
 		if (hasBeforeRowTrigger && rowHolder != null)
 		{
-			rowHolder = new TemporaryRowHolderImpl(tc, properties, resultDescription);
+			rowHolder =
+				new TemporaryRowHolderImpl(activation, properties,
+										   resultDescription);
 		}
 
 		// Add any new properties or change the values of any existing properties

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java
Thu Mar 23 23:48:28 2006
@@ -134,7 +134,9 @@
 			/*
 			** If deferred we save a copy of the entire row.
 			*/
-			rowHolder = new TemporaryRowHolderImpl(tc, properties, resultDescription);
+			rowHolder =
+				new TemporaryRowHolderImpl(activation, properties,
+										   resultDescription);
 		}
 
 		while ( row != null )

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowTriggerExecutor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowTriggerExecutor.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowTriggerExecutor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RowTriggerExecutor.java
Thu Mar 23 23:48:28 2006
@@ -90,11 +90,13 @@
 	
 				tec.setBeforeResultSet(brs == null ? 
 						null : 
-						TemporaryRowHolderResultSet.getNewRSOnCurrentRow(activation.getTransactionController(),
brs));
+						TemporaryRowHolderResultSet.
+									   getNewRSOnCurrentRow(activation, brs));
 					
 				tec.setAfterResultSet(ars == null ? 
 									  null : 
-									  TemporaryRowHolderResultSet.getNewRSOnCurrentRow(activation.getTransactionController(),
ars));
+									  TemporaryRowHolderResultSet.
+									  getNewRSOnCurrentRow(activation, ars));
 
 				/* 	
 					This is the key to handling autoincrement values that might

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
Thu Mar 23 23:48:28 2006
@@ -26,6 +26,7 @@
 import org.apache.derby.iapi.sql.execute.ExecRow;
 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
 import org.apache.derby.iapi.sql.execute.TemporaryRowHolder;
+import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.sql.ResultDescription;
 import org.apache.derby.iapi.store.access.ConglomerateController;
 import org.apache.derby.iapi.store.access.ScanController;
@@ -52,7 +53,7 @@
  *
  * @author jamie
  */
-public class TemporaryRowHolderImpl implements TemporaryRowHolder
+class TemporaryRowHolderImpl implements TemporaryRowHolder
 {
 	public static final int DEFAULT_OVERFLOWTHRESHOLD = 5;
 
@@ -71,8 +72,9 @@
 	private ConglomerateController	cc;
 	private Properties				properties;
 	private ScanController			scan;
-	private TransactionController	tc;
 	private	ResultDescription		resultDescription;
+	/** Activation object with local state information. */
+	Activation						activation;
 
 	private boolean     isUniqueStream;
 
@@ -98,7 +100,7 @@
 	 * Uses the default overflow to
  	 * a conglomerate threshold (5).
 	 *
-	 * @param tc the xact controller
+	 * @param activation the activation
 	 * @param properties the properties of the original table.  Used
 	 *		to help the store use optimal page size, etc.
 	 * @param resultDescription the result description.  Relevant for the getResultDescription
@@ -106,19 +108,20 @@
 	 */
 	public TemporaryRowHolderImpl
 	(
-		TransactionController	tc, 
+		Activation				activation, 
 		Properties 				properties, 
 		ResultDescription		resultDescription
 	) 
 	{
-		this(tc, properties, resultDescription, DEFAULT_OVERFLOWTHRESHOLD, false, false);
+		this(activation, properties, resultDescription,
+			 DEFAULT_OVERFLOWTHRESHOLD, false, false);
 	}
 	
 	/**
 	 * Uses the default overflow to
  	 * a conglomerate threshold (5).
 	 *
-	 * @param tc the xact controller
+	 * @param activation the activation
 	 * @param properties the properties of the original table.  Used
 	 *		to help the store use optimal page size, etc.
 	 * @param resultDescription the result description.  Relevant for the getResultDescription
@@ -127,20 +130,21 @@
 	 */
 	public TemporaryRowHolderImpl
 	(
-		TransactionController	tc, 
+		Activation				activation, 
 		Properties 				properties, 
 		ResultDescription		resultDescription,
 		boolean                 isUniqueStream
 	) 
 	{
-		this(tc, properties, resultDescription, 1, isUniqueStream, false);
+		this(activation, properties, resultDescription, 1, isUniqueStream,
+			 false);
 	}
 
 
 	/**
 	 * Create a temporary row holder with the defined overflow to conglom
 	 *
-	 * @param tc the xact controller
+	 * @param activation the activation
 	 * @param properties the properties of the original table.  Used
 	 *		to help the store use optimal page size, etc.
 	 * @param resultDescription the result description.  Relevant for the getResultDescription
@@ -151,7 +155,7 @@
 	 */
 	public TemporaryRowHolderImpl
 	(
-		TransactionController 	tc, 
+		Activation			 	activation, 
 		Properties				properties,
 		ResultDescription		resultDescription,
 		int 					overflowToConglomThreshold,
@@ -170,7 +174,7 @@
 			}
 		}
 
-		this.tc = tc;
+		this.activation = activation;
 		this.properties = properties;
 		this.resultDescription = resultDescription;
 		this.isUniqueStream = isUniqueStream;
@@ -250,6 +254,8 @@
 			
 		if (!conglomCreated)
 		{
+			TransactionController tc = activation.getTransactionController();
+
 			/*
 			** Create the conglomerate with the template row.
 			*/
@@ -320,6 +326,8 @@
 		
 			if(!uniqueIndexCreated)
 			{
+				TransactionController tc =
+					activation.getTransactionController();
 				int numKeys = 2;
 				uniqueIndexRow = new DataValueDescriptor[numKeys];
 				uniqueIndexRow[0] = baseRowLocation;
@@ -378,6 +386,7 @@
 	{
 		if(!positionIndexCreated)
 		{
+			TransactionController tc = activation.getTransactionController();
 			int numKeys = 2;
 			position_sqllong = new SQLLongint();
 			positionIndexRow = new DataValueDescriptor[numKeys];
@@ -413,6 +422,7 @@
 	public CursorResultSet getResultSet()
 	{
 		state = STATE_DRAIN;
+		TransactionController tc = activation.getTransactionController();
 		if(isUniqueStream)
 		{
 			return new TemporaryRowHolderResultSet(tc, rowArray,
@@ -455,6 +465,7 @@
 		*/
 		if (conglomCreated)
 		{
+			TransactionController tc = activation.getTransactionController();
 			tc.dropConglomerate(CID);
 			conglomCreated = false;
 		}
@@ -520,6 +531,8 @@
 			positionIndex_cc.close();
 			positionIndex_cc = null;
 		}
+
+		TransactionController tc = activation.getTransactionController();
 
 		if (uniqueIndexCreated)
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
Thu Mar 23 23:48:28 2006
@@ -57,7 +57,7 @@
  *
  * @author jamie
  */
-public class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cloneable
+class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cloneable
 {
 	private ExecRow[] 				rowArray;
 	private int						numRowsOut;
@@ -181,7 +181,7 @@
 	 * Whip up a new Temp ResultSet that has a single
 	 * row, the current row of this result set.
 	 * 
-	 * @param tc the xact controller
+	 * @param activation the activation
 	 * @param rs the result set 
 	 * 
 	 * @return a single row result set
@@ -190,11 +190,13 @@
 	 */
 	public static TemporaryRowHolderResultSet getNewRSOnCurrentRow
 	(
-		TransactionController	tc,
+		Activation				activation,
 		CursorResultSet 		rs
 	) throws StandardException
 	{
-		TemporaryRowHolderImpl singleRow = new TemporaryRowHolderImpl(tc, null, rs.getResultDescription());
+		TemporaryRowHolderImpl singleRow =
+			new TemporaryRowHolderImpl(activation, null,
+									   rs.getResultDescription());
 		singleRow.insert(rs.getCurrentRow());
 		return (TemporaryRowHolderResultSet) singleRow.getResultSet();
 	}
@@ -1130,9 +1132,12 @@
 		return null;
 	}
 
-	public Activation getActivation() {
-		if (SanityManager.DEBUG)
-			SanityManager.THROWASSERT("getActivation() called for " + getClass());
-		return null;
+	/**
+	 * Return the <code>Activation</code> for this result set.
+	 *
+	 * @return activation
+	 */
+	public final Activation getActivation() {
+		return holder.activation;
 	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
Thu Mar 23 23:48:28 2006
@@ -400,9 +400,13 @@
 			// Get the properties on the heap
 			rowChanger.getHeapConglomerateController().getInternalTablePropertySet(properties);
 			if(beforeUpdateCopyRequired){
-				deletedRowHolder = new TemporaryRowHolderImpl(tc, properties, triggerResultDescription);
+				deletedRowHolder =
+					new TemporaryRowHolderImpl(activation, properties,
+											   triggerResultDescription);
 			}
-			insertedRowHolder = new TemporaryRowHolderImpl(tc, properties, triggerResultDescription);
+			insertedRowHolder =
+				new TemporaryRowHolderImpl(activation, properties,
+										   triggerResultDescription);
 
 			rowChanger.setRowHolder(insertedRowHolder);
 		}
@@ -748,7 +752,7 @@
 						// in-memory heap grows), hopefully we never spill temp table to disk.
 
 						tableScan.futureForUpdateRows = new TemporaryRowHolderImpl
-							(tc, null, null, 100, false, true);
+							(activation, null, null, 100, false, true);
 					}
 
 					rlRow.setColumn(1, rowLoc);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java?rev=388440&r1=388439&r2=388440&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java
Thu Mar 23 23:48:28 2006
@@ -96,7 +96,9 @@
 			/*
 			** If deferred we save a copy of the entire row.
 			*/
-			rowHolder = new TemporaryRowHolderImpl(tc, properties, resultDescription);
+			rowHolder =
+				new TemporaryRowHolderImpl(activation, properties,
+										   resultDescription);
 		}
 
         try



Mime
View raw message