db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r613116 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute: TemporaryRowHolderImpl.java TemporaryRowHolderResultSet.java
Date Fri, 18 Jan 2008 09:52:33 GMT
Author: dyre
Date: Fri Jan 18 01:52:32 2008
New Revision: 613116

URL: http://svn.apache.org/viewvc?rev=613116&view=rev
Log:
DERBY-3221: "java.sql.SQLException: The conglomerate (-5) requested does not exist."
from Derby 10.3.1.4 embedded within Eclipse 3.3 and RAD 7.0
Patch file: derby-3221.v3.diff


Modified:
    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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java?rev=613116&r1=613115&r2=613116&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
Fri Jan 18 01:52:32 2008
@@ -67,7 +67,7 @@
 	private int			numRowsIn;
 	protected int		state = STATE_UNINIT;
 
-	protected	long				CID;
+	private	long				    CID;
 	private boolean					conglomCreated;
 	private ConglomerateController	cc;
 	private Properties				properties;
@@ -238,8 +238,9 @@
 			//In case of unique stream we push every thing into the
 			// conglomerates for time being, we keep one row in the array for
 			// the template.
-			if(!isUniqueStream)
+            if (!isUniqueStream) {
 				return;  
+            }
 		}
 			
 		if (!conglomCreated)
@@ -490,32 +491,32 @@
 	public void truncate() throws StandardException
 	{
 		close();
-
+        if (SanityManager.DEBUG) {
+            SanityManager.ASSERT(lastArraySlot == -1);
+            SanityManager.ASSERT(state == STATE_UNINIT);
+            SanityManager.ASSERT(!conglomCreated);
+            SanityManager.ASSERT(CID == 0);
+        }
 		for (int i = 0; i < rowArray.length; i++)
 		{
 			rowArray[i] = null;
 		}
-		lastArraySlot = -1;
-		numRowsIn = 0;
-		state = STATE_UNINIT;
 
-		/*
-		** We are not expecting this to be called
-		** when we have a temporary conglomerate
-		** but just to be on the safe side, drop
-		** it.  We'd like do something cheaper,
-		** but there is no truncate on congloms.
-		*/
-		if (conglomCreated)
-		{
-			TransactionController tc = activation.getTransactionController();
-			tc.dropConglomerate(CID);
-			conglomCreated = false;
-		}
+		numRowsIn = 0;
 	}
 
+    /**
+     * Accessor to get the id of the temporary conglomerate. Temporary 
+     * conglomerates have negative ids. An id equal to zero means that no 
+     * temporary conglomerate has been created.
+     * @return Conglomerate ID of temporary conglomerate
+     */
 	public long getTemporaryConglomId()
 	{
+        if (SanityManager.DEBUG) {
+            SanityManager.ASSERT(CID == 0 && !conglomCreated || 
+                    CID < 0 && conglomCreated);
+        }
 		return CID;
 	}
 
@@ -593,8 +594,14 @@
 		{
 			tc.dropConglomerate(CID);
 			conglomCreated = false;
-		}
-
+            CID = 0;
+		} 
+        else 
+        {
+            if (SanityManager.DEBUG) {
+                SanityManager.ASSERT(CID == 0, "CID(" + CID + ")==0");
+            }
+        }
 		state = STATE_UNINIT;
 		lastArraySlot = -1;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java?rev=613116&r1=613115&r2=613116&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
Fri Jan 18 01:52:32 2008
@@ -151,7 +151,12 @@
 	{
 		if(isAppendable)
 		{
-			holder.CID = currentConglomId;
+            if (SanityManager.DEBUG) {
+                SanityManager.ASSERT(currentConglomId == holder.getTemporaryConglomId(),
+                        "currentConglomId(" + currentConglomId + 
+                        ") == holder.getTemporaryConglomeateId (" + 
+                        holder.getTemporaryConglomId() + ")");
+            }
 			positionIndexConglomId = pconglomId;
 			setupPositionBasedScan(numRowsOut);
 		}else
@@ -273,7 +278,7 @@
 			return currentRow;
 		}
 
-		if (holder.CID == 0)
+		if (holder.getTemporaryConglomId() == 0)
 		{
 			return (ExecRow)null;
 		}
@@ -285,7 +290,7 @@
 		{
 			scan = 
                 tc.openScan(
-                    holder.CID,
+                    holder.getTemporaryConglomId(),
                     false,					// hold
                     0, 		// open read only
                     TransactionController.MODE_TABLE,
@@ -338,7 +343,7 @@
 			scan.fetchLocation(baseRowLocation);
 			if(heapCC == null)
 			{
-				heapCC = tc.openConglomerate( holder.CID,
+                heapCC = tc.openConglomerate(holder.getTemporaryConglomId(),
 											  false,
 											  TransactionController.OPENMODE_FORUPDATE,
 											  TransactionController.MODE_TABLE,
@@ -358,11 +363,11 @@
 	{
 
 		//incase nothing is inserted yet into the temporary row holder
-		if(holder.CID ==0)
+        if (holder.getTemporaryConglomId() == 0)
 			return;
 		if(heapCC == null)
 		{
-			heapCC = tc.openConglomerate( holder.CID,
+			heapCC = tc.openConglomerate( holder.getTemporaryConglomId(),
 										  false,
 										  0,
 										  TransactionController.MODE_TABLE,



Mime
View raw message