db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r901642 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/types/ impl/sql/execute/ impl/store/access/btree/ impl/store/access/heap/
Date Thu, 21 Jan 2010 10:36:59 GMT
Author: kristwaa
Date: Thu Jan 21 10:36:58 2010
New Revision: 901642

URL: http://svn.apache.org/viewvc?rev=901642&view=rev
Log:
DERBY-4520 (partial): Refactor and extend data type cloning facilities
RowLocation doesn't need to be cloned using CloneableObject.cloneObject,
clone using DataValueDescriptor.getClone instead.
This is the first step in the process to remove CloneableObject completely.

Patch file: derby-4520-1a-RowLocation_cloning.diff


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/RowLocation.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.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/store/access/btree/BTreeScan.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/RowLocation.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/RowLocation.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/RowLocation.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/RowLocation.java Thu Jan 21
10:36:58 2010
@@ -21,7 +21,6 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.types.DataValueDescriptor;
 /**
 
   Holds the location of a row within a given conglomerate.
@@ -36,6 +35,6 @@
 
 **/
 
-public interface RowLocation extends DataValueDescriptor, CloneableObject
+public interface RowLocation extends DataValueDescriptor
 {
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java Thu Jan 21 10:36:58
2010
@@ -200,7 +200,7 @@
 		if (value == null)
 			return new SQLRef();
 		else
-			return new SQLRef((RowLocation) value.cloneObject());
+           return new SQLRef((RowLocation) value.getClone());
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Thu Jan 21 10:36:58 2010
@@ -3071,7 +3071,7 @@
 		indexRows[index].getNewObjectArray();
 		// Associate the index row with the source row
 		compressIRGs[index].getIndexRow(currentRow, 
-									    (RowLocation) rl.cloneObject(), 
+                                        (RowLocation) rl.getClone(),
 										indexRows[index],
 										(FormatableBitSet) null);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
Thu Jan 21 10:36:58 2010
@@ -326,21 +326,24 @@
 					getPreparedStatement().getSavedObject(itemNumber).getClass().getName() +
 					", query is " + getPreparedStatement().getSource());
 			}
-			RowLocation rl = (RowLocation) getPreparedStatement().getSavedObject(itemNumber);
-			if (! (rl.cloneObject() instanceof RowLocation))
+        }
+        RowLocation rl = (RowLocation)
+                getPreparedStatement().getSavedObject(itemNumber);
+        /* We have to return a clone of the saved RowLocation due
+         * to the shared cache of SPSs.
+         */
+        Object rlClone = rl.getClone();
+        if (SanityManager.DEBUG) {
+            if (! (rlClone instanceof RowLocation))
 			{
 				SanityManager.THROWASSERT(
-					"rl.cloneObject() expected to be " +
-					"instance of RowLocation, not " +
-					rl.getClass().getName() +
-					", query is " + getPreparedStatement().getSource());
+                    "rl.getClone() expected to be " +
+                    "instance of RowLocation, not " +
+                    rlClone.getClass().getName() + ", query is " +
+                    getPreparedStatement().getSource());
 			}
 		}
-		/* We have to return a clone of the saved RowLocation due
-		 * to the shared cache of SPSs.
-		 */
-		return (RowLocation)
-			((RowLocation)(getPreparedStatement().getSavedObject(itemNumber))).cloneObject();
+        return (RowLocation)rlClone;
 	}
 
 	/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=901642&r1=901641&r2=901642&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 Jan 21 10:36:58 2010
@@ -186,7 +186,7 @@
 		/* Set up sorters, etc. if 1st row and there are indexes */
 		if (constants.irgs.length > 0)
 		{
-			RowLocation rlClone = (RowLocation) rowLocation.cloneObject();
+           RowLocation rlClone = (RowLocation) rowLocation.getClone();
 
 			// Objectify any the streaming columns that are indexed.
 			for (int i = 0; i < execRow.getRowArray().length; i++)
@@ -1645,8 +1645,7 @@
                 (templateColArray[fkInfo.colArray[i] - 1]).getClone();
 		}
 
-		newRowColArray[i] = 
-            (DataValueDescriptor) fkInfo.rowLocation.cloneObject();
+       newRowColArray[i] = fkInfo.rowLocation.getClone();
 
 		return newRow;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
Thu Jan 21 10:36:58 2010
@@ -264,9 +264,8 @@
             new DataValueDescriptor[this.init_template.length];
 
         scan_position.current_lock_template[this.init_template.length - 1] = 
-            scan_position.current_lock_row_loc = 
-                (RowLocation) ((RowLocation) 
-                     init_template[init_template.length - 1]).cloneObject(); 
+            scan_position.current_lock_row_loc = (RowLocation)
+                init_template[init_template.length - 1].getClone();
 
         // Verify that all columns in start key value, stop key value, and
         // qualifiers are present in the list of columns described by the

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java?rev=901642&r1=901641&r2=901642&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java
Thu Jan 21 10:36:58 2010
@@ -101,15 +101,6 @@
 		return null;
 	}
 
-	/*
-	** Methods of CloneableObject.
-	*/
-	public Object cloneObject()
-	{
-		return getClone();
-		
-	}
-
 	public DataValueDescriptor getClone() {
 		return new HeapRowLocation(this);
 	}



Mime
View raw message