db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r615273 - in /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute: TemporaryRowHolderImpl.java TemporaryRowHolderResultSet.java
Date Fri, 25 Jan 2008 17:12:56 GMT
Author: dyre
Date: Fri Jan 25 09:12:54 2008
New Revision: 615273

URL: http://svn.apache.org/viewvc?rev=615273&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

Always set RowHolder.CID to 0, when RowHolder.conglomCreated is set to
false and the conglomerate is removed, because RowHolder's clients test for
CID==0 to find out if a temporary conglomerate exists.

Merged by svn merge -r 613115:613116 https://svn.apache.org/repos/asf/db/derby/code/trunk

Simple merge with no conflicts; no additional changes were necessary.

Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java?rev=615273&r1=615272&r2=615273&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java
Fri Jan 25 09:12:54 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;
@@ -248,8 +248,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)
@@ -500,32 +501,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;
 	}
 
@@ -603,8 +604,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/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java?rev=615273&r1=615272&r2=615273&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
Fri Jan 25 09:12:54 2008
@@ -159,7 +159,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
@@ -282,7 +287,7 @@
 			return currentRow;
 		}
 
-		if (holder.CID == 0)
+		if (holder.getTemporaryConglomId() == 0)
 		{
 			return (ExecRow)null;
 		}
@@ -294,7 +299,7 @@
 		{
 			scan = 
                 tc.openScan(
-                    holder.CID,
+                    holder.getTemporaryConglomId(),
                     false,					// hold
                     0, 		// open read only
                     TransactionController.MODE_TABLE,
@@ -347,7 +352,7 @@
 			scan.fetchLocation(baseRowLocation);
 			if(heapCC == null)
 			{
-				heapCC = tc.openConglomerate( holder.CID,
+                heapCC = tc.openConglomerate(holder.getTemporaryConglomId(),
 											  false,
 											  TransactionController.OPENMODE_FORUPDATE,
 											  TransactionController.MODE_TABLE,
@@ -367,11 +372,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