db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r906595 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/store/access/ engine/org/apache/derby/iapi/types/ engine/org/apache/derby/impl/sql/ engine/org/apache/derby/impl/sql/execute/ engine/org/apache/derby/impl/store/access/ en...
Date Thu, 04 Feb 2010 18:21:09 GMT
Author: kristwaa
Date: Thu Feb  4 18:21:07 2010
New Revision: 906595

URL: http://svn.apache.org/viewvc?rev=906595&view=rev
Log:
DERBY-4520 (partial): Refactor and extend data type cloning facilities

Renamed getClone to cloneValue and added the boolean argument 'forceMaterialization', whose default has been set to false.
Removed special handling of RowLocation in ValueRow.getNewNullRow.
Made constructors used for cloning private in SQLSmallInt and SQLTinyInt.
Added argument in constructor used for cloning in XML (whether to force materialization or not).
Removed some unused imports.
Note that the actual cloning-methods haven't been changed yet (expect changes in SQLBlob and SQLClob in a follow-up patch).

Patch file: derby-4520-5a-getClone_renamed_cloneValue.diff
--Denne linjen og de som er under vil bli ignorert--

M    java/engine/org/apache/derby/impl/sql/GenericParameter.java
M    java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java
M    java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java
M    java/engine/org/apache/derby/impl/sql/execute/ValueRow.java
M    java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java
M    java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
M    java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
M    java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
M    java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
M    java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerate.java
M    java/engine/org/apache/derby/impl/store/access/StorableFormatId.java
M    java/engine/org/apache/derby/impl/store/access/btree/BTreeScan.java
M    java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java
M    java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java
M    java/engine/org/apache/derby/iapi/types/SQLReal.java
M    java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java
M    java/engine/org/apache/derby/iapi/types/SQLLongint.java
M    java/engine/org/apache/derby/iapi/types/SQLSmallint.java
M    java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
M    java/engine/org/apache/derby/iapi/types/DataType.java
M    java/engine/org/apache/derby/iapi/types/SQLInteger.java
M    java/engine/org/apache/derby/iapi/types/SQLTinyint.java
M    java/engine/org/apache/derby/iapi/types/SQLTime.java
M    java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
M    java/engine/org/apache/derby/iapi/types/SQLRef.java
M    java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java
M    java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
M    java/engine/org/apache/derby/iapi/types/XML.java
M    java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
M    java/engine/org/apache/derby/iapi/types/SQLDecimal.java
M    java/engine/org/apache/derby/iapi/types/SQLDate.java
M    java/engine/org/apache/derby/iapi/types/SQLChar.java
M    java/engine/org/apache/derby/iapi/types/SQLClob.java
M    java/engine/org/apache/derby/iapi/types/SQLBoolean.java
M    java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
M    java/engine/org/apache/derby/iapi/types/SQLBinary.java
M    java/engine/org/apache/derby/iapi/types/SQLVarchar.java
M    java/engine/org/apache/derby/iapi/types/UserType.java
M    java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java
M    java/engine/org/apache/derby/iapi/types/SQLDouble.java
M    java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java
M    java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java
M    java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDate.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLRef.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTime.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLVarchar.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.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/BasicSortObserver.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.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/MaxMinAggregator.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.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/ValueRow.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/StorableFormatId.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.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/conglomerate/GenericConglomerate.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/HeapRowLocation.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/BackingStoreHashtable.java Thu Feb  4 18:21:07 2010
@@ -355,7 +355,7 @@
         for (int i = 0; i < old_row.length; i++)
         {
             if( old_row[i] != null)
-                new_row[i] = old_row[i].getClone();
+                new_row[i] = old_row[i].cloneValue(false);
         }
 
         return(new_row);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java Thu Feb  4 18:21:07 2010
@@ -666,10 +666,10 @@
 		return getDecimalValuePrecision();
 	}
 
-	/* (non-Javadoc)
-	 * @see org.apache.derby.iapi.types.DataValueDescriptor#getClone()
-	 */
-	public DataValueDescriptor getClone() {
+    /**
+     * @see org.apache.derby.iapi.types.DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization) {
 		BinaryDecimal dvd = (BinaryDecimal) getNewNull();
 		
 		if (this.data2c != null)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLChar.java Thu Feb  4 18:21:07 2010
@@ -103,10 +103,10 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/**
-	 * @see DataValueDescriptor#getClone
-	 */
-	public DataValueDescriptor getClone()
+    /**
+     * @see DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java Thu Feb  4 18:21:07 2010
@@ -104,10 +104,10 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/**
-	 * @see DataValueDescriptor#getClone
-	 */
-	public DataValueDescriptor getClone()
+    /**
+     * @see DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLLongvarchar.java Thu Feb  4 18:21:07 2010
@@ -105,10 +105,10 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/**
-	 * @see DataValueDescriptor#getClone
-	 */
-	public DataValueDescriptor getClone()
+    /**
+     * @see DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java Thu Feb  4 18:21:07 2010
@@ -104,10 +104,10 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/**
-	 * @see DataValueDescriptor#getClone
-	 */
-	public DataValueDescriptor getClone()
+    /**
+     * @see DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java Thu Feb  4 18:21:07 2010
@@ -603,7 +603,7 @@
      * @return A shallow clone.
      */
     public DataValueDescriptor cloneHolder() {
-		return getClone();
+		return cloneValue(false);
 	}
 
 	// International support

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java Thu Feb  4 18:21:07 2010
@@ -285,23 +285,47 @@
 	InputStream	getStream() throws StandardException;
 
     /**
-     * Get a shallow copy of this <code>DataValueDescriptor</code>.
+     * Get a shallow copy of this {@code codeDataValueDescriptor} (DVD).
      * <p>
-     * This is used by the sorter to clone columns. It should be cloning the
-     * column holder but not its value. The only difference between this method
-     * and <code>getClone</code> is this one does not objectify a stream.
+     * The primary use of this method is to avoid materializing streams for
+     * data types like BLOB and CLOB.
+     * <p>
+     * In general the orginal DVD should be recycled or discarded when this
+     * method is invoked to ensure that changes to the original DVD don't
+     * affect the clone (or the other way around). Note that it is not safe to
+     * assume that a number of these clones can be used for read-only access to
+     * the same value.
+     * <p>
+     * <em>Implementation note:</em> The reason why the clones can't be
+     * guaranteed to work as "read clones" is that if the value is represented
+     * as a stream, the state of the stream will change on read operations.
+     * Since all the clones share the same stream, this may lead to wrong
+     * results, data corruption or crashes.
      *
      * @return A clone of this descriptor, which shares the internal state.
      */
     public DataValueDescriptor cloneHolder();
 
-	/**
-	 * Clone this DataValueDescriptor. Results in a new object
-	 * that has the same value as this but can be modified independently.
-	 *
-	 * @return A clone of the DataValueDescriptor with the same initial value as this.
-	 */
-	public DataValueDescriptor getClone();
+    /**
+     * Clone this DataValueDescriptor. Results in a new object
+     * that has the same value as this but can be modified independently.
+     * <p>
+     * Even though the objects can be modified independently regardless of the
+     * value of {@code forceMaterialization}, both the clone and the
+     * original may be dependent on the store state if
+     * {@code forceMaterialization} is set to {@code false}. An example is if
+     * you need to access the value you just read using {@code cloneValue}
+     * after the current transaction has ended, or after the source result set
+     * has been closed.
+     *
+     * @param forceMaterialization any streams representing the data value will
+     *      be materialized if {@code true}, the data value will be kept as a
+     *      stream if possible if {@code false}
+     * @return A clone of the {@code DataValueDescriptor} with the same initial
+     *      value as this.
+     */
+    public abstract DataValueDescriptor cloneValue(
+            boolean forceMaterialization);
 
     /**
      * Recycle this DataValueDescriptor if possible. Create and return a new

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java Thu Feb  4 18:21:07 2010
@@ -616,7 +616,7 @@
      */
     public final DataValueDescriptor cloneHolder() {
         if (stream == null && _blobValue == null) {
-            return getClone();
+            return cloneValue(false);
         } else {
             // Cast to SQLBinary to avoid having to catch StandardException.
             SQLBinary self = (SQLBinary)getNewNull();
@@ -637,8 +637,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public final DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public final DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java Thu Feb  4 18:21:07 2010
@@ -325,8 +325,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		return new SQLBoolean(value, isnull);
 	}
@@ -396,7 +396,7 @@
 			value = obj.booleanValue();
 	}
 
-	/* This constructor gets used for the getClone() method */
+    /* This constructor gets used for the cloneValue method */
 	private SQLBoolean(boolean val, boolean isnull)
 	{
 		value = val;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java Thu Feb  4 18:21:07 2010
@@ -1316,11 +1316,13 @@
     /**
      *  Shallow clone a StreamStorable without objectifying.  This is used to 
      *  avoid unnecessary objectifying of a stream object.  The only 
-     *  difference of this method from getClone is this method does not 
+     *  difference of this method from cloneValue is this method does not
      *  objectify a stream.
      */
     public DataValueDescriptor cloneHolder() {
-        if ((stream == null) && (_clobValue == null)) {  return getClone(); }
+        if ((stream == null) && (_clobValue == null)) {
+            return cloneValue(false);
+        }
 
         SQLChar self = (SQLChar) getNewNull();
         self.copyState(this);
@@ -1332,8 +1334,8 @@
      * DataValueDescriptor interface
      */
 
-    /** @see DataValueDescriptor#getClone */
-    public DataValueDescriptor getClone()
+    /** @see DataValueDescriptor#cloneValue */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
     {
         try
         {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java Thu Feb  4 18:21:07 2010
@@ -97,8 +97,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
         // TODO: Should this be rewritten to clone the stream instead of
         //       materializing the value if possible?

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDate.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDate.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDate.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDate.java Thu Feb  4 18:21:07 2010
@@ -244,8 +244,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		// Call constructor with all of our info
 		return new SQLDate(encodedDate);
@@ -941,7 +941,7 @@
             if( operand.isNull())
                 return new SQLDate();
             if( operand instanceof SQLDate)
-                return (SQLDate) operand.getClone();
+                return (SQLDate) operand.cloneValue(false);
 
             if( operand instanceof SQLTimestamp)
             {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java Thu Feb  4 18:21:07 2010
@@ -555,11 +555,10 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/**
-	 * <B> WARNING </B> clone is a shallow copy
- 	 * @see DataValueDescriptor#getClone 
-	 */
-	public DataValueDescriptor getClone()
+    /**
+     * @see DataValueDescriptor#cloneValue
+     */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		return new SQLDecimal(getBigDecimal());
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java Thu Feb  4 18:21:07 2010
@@ -280,8 +280,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try 
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java Thu Feb  4 18:21:07 2010
@@ -218,8 +218,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		SQLInteger nsi = new SQLInteger(value);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java Thu Feb  4 18:21:07 2010
@@ -237,8 +237,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		return new SQLLongint(value, isnull);
 	}
@@ -310,7 +310,7 @@
 		value = val;
 	}
 
-	/* This constructor gets used for the getClone() method */
+	/* This constructor gets used for the cloneValue method */
 	private SQLLongint(long val, boolean isnull)
 	{
 		value = val;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongvarchar.java Thu Feb  4 18:21:07 2010
@@ -64,8 +64,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java Thu Feb  4 18:21:07 2010
@@ -281,8 +281,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		SQLReal ret = new SQLReal();
 		ret.value = this.value;

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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -188,8 +188,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+    /** @see DataValueDescriptor#cloneValue */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		/* In order to avoid a throws clause nightmare, we only call
 		 * the constructors which do not have a throws clause.
@@ -200,7 +200,7 @@
 		if (value == null)
 			return new SQLRef();
 		else
-           return new SQLRef((RowLocation) value.getClone());
+           return new SQLRef((RowLocation) value.cloneValue(false));
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java Thu Feb  4 18:21:07 2010
@@ -252,8 +252,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		return new SQLSmallint(value, isnull);
 	}
@@ -334,9 +334,8 @@
 		value = val;
 	}
 
-	/* This constructor gets used for the getClone() method */
-	public SQLSmallint(short val, boolean isnull)
-	{
+	/* This constructor gets used for the cloneValue() method */
+	private SQLSmallint(short val, boolean isnull) {
 		value = val;
 		this.isnull = isnull;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTime.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTime.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTime.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTime.java Thu Feb  4 18:21:07 2010
@@ -246,8 +246,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		// Call constructor with all of our info
 		return new SQLTime(encodedTime, encodedTimeFraction);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java Thu Feb  4 18:21:07 2010
@@ -269,8 +269,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		// Call constructor with all of our info
 		return new SQLTimestamp(encodedDate, encodedTime, nanos);
@@ -973,7 +973,7 @@
             if( operand.isNull())
                 return new SQLTimestamp();
             if( operand instanceof SQLTimestamp)
-                return (SQLTimestamp) operand.getClone();
+                return (SQLTimestamp) operand.cloneValue(false);
 
             String str = operand.getString();
             if( str.length() == 14)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java Thu Feb  4 18:21:07 2010
@@ -109,9 +109,8 @@
 		value = val;
 	}
 
-	/* This constructor gets used for the getClone() method */
-	public SQLTinyint(byte val, boolean isnull)
-	{
+	/* This constructor gets used for the cloneValue() method */
+	private SQLTinyint(byte val, boolean isnull) {
 		value = val;
 		this.isnull = isnull;
 	}
@@ -296,8 +295,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+	/** @see DataValueDescriptor#cloneValue */
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		return new SQLTinyint(value, isnull);
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLVarchar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLVarchar.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLVarchar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLVarchar.java Thu Feb  4 18:21:07 2010
@@ -63,8 +63,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+    /** @see DataValueDescriptor#cloneValue */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		try
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java Thu Feb  4 18:21:07 2010
@@ -315,8 +315,8 @@
 	 * DataValueDescriptor interface
 	 */
 
-	/** @see DataValueDescriptor#getClone */
-	public DataValueDescriptor getClone()
+    /** @see DataValueDescriptor#cloneValue */
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
 		// Call constructor with all of our info
 		return new UserType(value);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java Thu Feb  4 18:21:07 2010
@@ -154,7 +154,7 @@
     }
 
     /**
-     * Private constructor used for the getClone() method.
+     * Private constructor used for the {@code cloneValue} method.
      * Returns a new instance of XML whose fields are clones
      * of the values received.
      *
@@ -163,10 +163,13 @@
      * @param xmlType Qualified XML type for "val"
      * @param seqWithAttr Whether or not "val" corresponds to
      *  sequence with one or more top-level attribute nodes.
+     * @param materialize whether or not to force materialization of the
+     *      underlying source data
      */
-    private XML(SQLChar val, int xmlType, boolean seqWithAttr)
-    {
-        xmlStringValue = (val == null ? null : (SQLChar)val.getClone());
+    private XML(SQLChar val, int xmlType, boolean seqWithAttr,
+            boolean materialize) {
+        xmlStringValue = (val == null ? null
+                                      : (SQLChar)val.cloneValue(materialize));
         setXType(xmlType);
         if (seqWithAttr)
             markAsHavingTopLevelAttr();
@@ -177,11 +180,11 @@
      * */
 
     /**
-     * @see DataValueDescriptor#getClone
+     * @see DataValueDescriptor#cloneValue
      */
-    public DataValueDescriptor getClone()
-    {
-        return new XML(xmlStringValue, getXType(), hasTopLevelAttr());
+    public DataValueDescriptor cloneValue(boolean forceMaterialization) {
+        return new XML(xmlStringValue, getXType(), hasTopLevelAttr(),
+                forceMaterialization);
     }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameter.java Thu Feb  4 18:21:07 2010
@@ -21,36 +21,17 @@
 
 package org.apache.derby.impl.sql;
 
-import org.apache.derby.iapi.services.loader.ClassInspector;
-
-import org.apache.derby.iapi.sql.ParameterValueSet;
-
-import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.BooleanDataValue;
-import org.apache.derby.iapi.types.BitDataValue;
-import org.apache.derby.iapi.types.DateTimeDataValue;
-import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.types.UserDataValue;
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.*;
-
 import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.reference.JDBC30Translation;
 
 import org.apache.derby.iapi.error.StandardException;
 
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.types.*;
-import org.apache.derby.iapi.types.*;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.TypeId;
 
 import java.sql.Types;
 
-import java.lang.reflect.Array;
-
 /**
  * A parameter.  Originally lifted from ParameterValueSet.
  *
@@ -145,7 +126,8 @@
 	public GenericParameter getClone(GenericParameterValueSet pvs)
 	{
 		GenericParameter gpClone = new GenericParameter(pvs, isReturnOutputParameter);
-		gpClone.initialize(this.getValue().getClone(), jdbcTypeId, declaredClassName);
+        gpClone.initialize(this.getValue().cloneValue(false),
+                           jdbcTypeId, declaredClassName);
 		gpClone.isSet = true;
 
 		return gpClone;

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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -21,7 +21,6 @@
 
 package org.apache.derby.impl.sql.execute;
 
-import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -34,7 +33,6 @@
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl;
 import org.apache.derby.catalog.types.StatisticsImpl;
-import org.apache.derby.iapi.error.PublicAPI;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
@@ -44,7 +42,6 @@
 import org.apache.derby.iapi.sql.PreparedStatement;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.StatementType;
-import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.depend.DependencyManager;
 import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;
@@ -82,7 +79,6 @@
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.RowLocation;
-import org.apache.derby.iapi.types.StringDataValue;
 import org.apache.derby.iapi.util.IdUtil;
 import org.apache.derby.impl.sql.catalog.DDColumnDependableFinder;
 import org.apache.derby.impl.sql.compile.ColumnDefinitionNode;
@@ -3071,7 +3067,7 @@
 		indexRows[index].getNewObjectArray();
 		// Associate the index row with the source row
 		compressIRGs[index].getIndexRow(currentRow, 
-                                        (RowLocation) rl.getClone(),
+                                        (RowLocation) rl.cloneValue(false),
 										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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -332,7 +332,7 @@
         /* We have to return a clone of the saved RowLocation due
          * to the shared cache of SPSs.
          */
-        Object rlClone = rl.getClone();
+        Object rlClone = rl.cloneValue(false);
         if (SanityManager.DEBUG) {
             if (! (rlClone instanceof RowLocation))
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java Thu Feb  4 18:21:07 2010
@@ -162,9 +162,11 @@
 		for (int i = 0; i < origArray.length; i++)
 		{
             // History: We used to materialize streams when getting a clone
-            //          here (i.e. used getClone, not cloneObject). We still do.
+            //          here (i.e. used cloneValue, not cloneObject). We still
+            //          do.
+            //          TODO: change to 'true' below and add comment.
             // Beetle 4896.
-			newArray[i] = origArray[i].getClone();
+			newArray[i] = origArray[i].cloneValue(false);
 		}
 
 		return newArray;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CardinalityCounter.java Thu Feb  4 18:21:07 2010
@@ -105,7 +105,7 @@
 		cloned = new DataValueDescriptor[clonee.length];
 		for (int i = 0; i < clonee.length - 1; i++)
 		{
-			cloned[i] = ((DataValueDescriptor)clonee[i]).getClone();
+			cloned[i] = clonee[i].cloneValue(false);
 		}
 		return cloned;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java Thu Feb  4 18:21:07 2010
@@ -169,7 +169,7 @@
 						DataValueDescriptor c = row.getColumn(i);
 						if (c instanceof StreamStorable)
 							if (((StreamStorable)c).returnStream() == stream)
-								row.setColumn(i, col.getClone());
+								row.setColumn(i, col.cloneValue(false));
 					}
 				}
 			}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java Thu Feb  4 18:21:07 2010
@@ -284,7 +284,7 @@
 			indexSC =  openIndexScanController(searchRow);
 			//create a template for the index row
 			indexRow = indexQualifierRow.getClone();
-			indexRow.setColumn(numFkColumns + 1, rowLocation.getClone());	
+			indexRow.setColumn(numFkColumns + 1, rowLocation.cloneValue(false));
 
 		}else
 		{

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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 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.getClone();
+           RowLocation rlClone = (RowLocation) rowLocation.cloneValue(false);
 
 			// Objectify any the streaming columns that are indexed.
 			for (int i = 0; i < execRow.getRowArray().length; i++)
@@ -1635,10 +1635,10 @@
 		for (i = 0; i < fkInfo.colArray.length; i++)
 		{
 			newRowColArray[i] = 
-                (templateColArray[fkInfo.colArray[i] - 1]).getClone();
+                templateColArray[fkInfo.colArray[i] - 1].cloneValue(false);
 		}
 
-       newRowColArray[i] = fkInfo.rowLocation.getClone();
+       newRowColArray[i] = fkInfo.rowLocation.cloneValue(false);
 
 		return newRow;
 	}
@@ -2187,7 +2187,7 @@
 				// NOTE: 1-based column numbers
 				baseRows.setColumn(
 						colNumber,
-						fullTemplate.getColumn(index + 1).getClone());
+						fullTemplate.getColumn(index + 1).cloneValue(false));
 			}
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MaxMinAggregator.java Thu Feb  4 18:21:07 2010
@@ -67,10 +67,10 @@
 				  (!isMax && (value.compare(addend) > 0))
 				  )
 		{
-			/* NOTE: We need to call getClone() since value gets
+			/* NOTE: We need to call cloneValue since value gets
 			 * reused underneath us
 			 */
-			value = addend.getClone();
+			value = addend.cloneValue(false);
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MultiProbeTableScanResultSet.java Thu Feb  4 18:21:07 2010
@@ -204,7 +204,7 @@
                 new DataValueDescriptor[origProbeValues.length];
 
             for (int i = 0; i < pVals.length; i++)
-                pVals[i] = origProbeValues[i].getClone();
+                pVals[i] = origProbeValues[i].cloneValue(false);
 
             if (sortRequired == RowOrdering.ASCENDING)
                 java.util.Arrays.sort(pVals);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java Thu Feb  4 18:21:07 2010
@@ -975,7 +975,7 @@
 		// 1st element is the key
 		hashRowArray[0] = new SQLInteger(position);
 		if (isForUpdate()) {
-			hashRowArray[POS_ROWLOCATION] = rowLoc.getClone();
+			hashRowArray[POS_ROWLOCATION] = rowLoc.cloneValue(false);
 			hashRowArray[POS_ROWDELETED] = new SQLBoolean(false);
 			hashRowArray[POS_ROWUPDATED] = new SQLBoolean(rowUpdated);
 		}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SumAggregator.java Thu Feb  4 18:21:07 2010
@@ -56,10 +56,10 @@
 		*/
 		if (value == null)
 		{ 
-			/* NOTE: We need to call getClone() since value gets 
+			/* NOTE: We need to call cloneValue since value gets
 			 * reused underneath us
 			 */
-			value = addend.getClone();
+			value = addend.cloneValue(false);
 		}
 		else
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java Thu Feb  4 18:21:07 2010
@@ -540,7 +540,7 @@
 						getSparseRowAndMap();
             	   	baseCC.fetch(
         	 	      	      rl, sparseRow.getRowArray(), sparseRowMap);
-					RowLocation rl2 = (RowLocation) rl.getClone();
+                    RowLocation rl2 = (RowLocation) rl.cloneValue(false);
 					currentRow.setColumn(currentRow.nColumns(), rl2);
 					candidate.setColumn(candidate.nColumns(), rl2);		// have to be consistent!
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java?rev=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -689,14 +689,15 @@
 			}
 
 			Hashtable past2FutureTbl = tableScan.past2FutureTbl;
-			/* If hash table is not full, we add it in.  The key of the hash entry
-			 * is the string value of the RowLocation.  If the hash table is full,
-			 * as the comments above this function say, we scan forward.
-			 *
-			 * Need to save a clone because when we get cached currentRow, "rl" shares the
-			 * same reference, so is changed at the same time.
-			 */
-			RowLocation updatedRL = (RowLocation) rl.getClone();
+            /* If hash table is not full, we add it in.
+             * The key of the hash entry is the string value of the RowLocation.
+             * If the hash table is full, as the comments above this function
+             * say, we scan forward.
+             *
+             * Need to save a clone because when we get cached currentRow, "rl"
+             * shares the same reference, so is changed at the same time.
+             */
+            RowLocation updatedRL = (RowLocation) rl.cloneValue(false);
 
 			if (past2FutureTbl.size() < maxCapacity)
 				past2FutureTbl.put(updatedRL, updatedRL);
@@ -759,7 +760,7 @@
 		{
 			DataValueDescriptor aCol = aRow.getColumn(i);
 			if (aCol != null)
-				tableScan.lastCursorKey.setColumn(i, aCol.getClone());
+                tableScan.lastCursorKey.setColumn(i, aCol.cloneValue(false));
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ValueRow.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ValueRow.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ValueRow.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ValueRow.java Thu Feb  4 18:21:07 2010
@@ -127,7 +127,7 @@
 			if (column[colCtr] != null)
 			{
 				/* Rows are 1-based, column[] is 0-based */
-				rowClone.setColumn(colCtr + 1, column[colCtr].getClone());
+                rowClone.setColumn(colCtr +1, column[colCtr].cloneValue(false));
 			}
 		}
 		return rowClone;
@@ -145,22 +145,7 @@
 			if (column[colCtr] != null)
 			{
 				/* Rows are 1-based, column[] is 0-based */
-				if (column[colCtr] instanceof RowLocation)
-				{
-					/*
-					** The getClone() method for a RowLocation has the same
-					** name as for DataValueDescriptor, but it's on a different
-					** interface, so the cast must be different.
-					**
-					*/
-					rowClone.setColumn(colCtr + 1, column[colCtr].getClone());
-				}
-				else
-				{
-					// otherwise, get a new null
-					rowClone.setColumn(colCtr + 1,
-						((DataValueDescriptor) (column[colCtr])).getNewNull());
-				}
+                rowClone.setColumn(colCtr + 1, column[colCtr].getNewNull());
 			}
 		}
 		return rowClone;
@@ -184,7 +169,7 @@
 	// position is 1-based
 	public final DataValueDescriptor cloneColumn(int columnPosition)
 	{
-		return column[columnPosition -1].getClone();
+        return column[columnPosition -1].cloneValue(false);
 	}
 
 	/*
@@ -231,7 +216,7 @@
 		{
 			if (column[colCtr] != null)
 			{
-				columnClones[colCtr] = column[colCtr].getClone();
+                columnClones[colCtr] = column[colCtr].cloneValue(false);
 			}
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/StorableFormatId.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/StorableFormatId.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/StorableFormatId.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/StorableFormatId.java Thu Feb  4 18:21:07 2010
@@ -181,20 +181,9 @@
     }
 
 	/**
-	 * <U>Shallow copy</U>. 
-	 * <p> 
-	 * Clone the DataValueDescriptor and copy its contents.
-	 * We clone the data value wrapper (e.g. SQLDecimal)
-	 * and reuse its contents (the underlying BigDecimal).
-	 * The resultant DataValueDescriptor will point to the same
-	 * value as the original DataValueDescriptor (unless the value
-	 * is a primitive type, e.g. SQLInteger/integer).
-	 *
-	 * @return A clone of the DataValueDescriptor reusing its contents.
-     *
-     * @see org.apache.derby.iapi.types.DataValueDescriptor#getClone
+     * @see org.apache.derby.iapi.types.DataValueDescriptor#cloneValue
 	 */
-	public DataValueDescriptor getClone()
+    public DataValueDescriptor cloneValue(boolean forceMaterialization)
     {
         if (SanityManager.DEBUG)
             SanityManager.THROWASSERT("Not implemented!.");

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/BTreeMaxScan.java Thu Feb  4 18:21:07 2010
@@ -109,7 +109,7 @@
         // run into a null.  Use this template to probe the "next" row so
         // that if we need to finish, fetch_row will have the right value.
         DataValueDescriptor[] check_row_template = new DataValueDescriptor[1];
-        check_row_template[0] = fetch_row[0].getClone();
+        check_row_template[0] = fetch_row[0].cloneValue(false);
         FetchDescriptor check_row_desc = RowUtil.getFetchDescriptorConstant(1);
 
         // reopen the scan for reading from the beginning of the table.

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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -265,7 +265,7 @@
 
         scan_position.current_lock_template[this.init_template.length - 1] = 
             scan_position.current_lock_row_loc = (RowLocation)
-                init_template[init_template.length - 1].getClone();
+                init_template[init_template.length - 1].cloneValue(false);
 
         // 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/conglomerate/GenericConglomerate.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerate.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerate.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerate.java Thu Feb  4 18:21:07 2010
@@ -109,20 +109,9 @@
     }
 
 	/**
-	 * <U>Shallow copy</U>. 
-	 * <p> 
-	 * Clone the DataValueDescriptor and copy its contents.
-	 * We clone the data value wrapper (e.g. SQLDecimal)
-	 * and reuse its contents (the underlying BigDecimal).
-	 * The resultant DataValueDescriptor will point to the same
-	 * value as the original DataValueDescriptor (unless the value
-	 * is a primitive type, e.g. SQLInteger/integer).
-	 *
-	 * @return A clone of the DataValueDescriptor reusing its contents.
-     *
-     * @see org.apache.derby.iapi.types.DataValueDescriptor#getClone
+     * @see org.apache.derby.iapi.types.DataValueDescriptor#cloneValue
 	 */
-	public DataValueDescriptor getClone()
+	public DataValueDescriptor cloneValue(boolean forceMaterialization)
     {
         if (SanityManager.DEBUG)
             SanityManager.THROWASSERT("Not implemented!.");

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=906595&r1=906594&r2=906595&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 Feb  4 18:21:07 2010
@@ -101,7 +101,7 @@
 		return null;
 	}
 
-	public DataValueDescriptor getClone() {
+	public DataValueDescriptor cloneValue(boolean forceMaterialization) {
 		return new HeapRowLocation(this);
 	}
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/TestDiskHashtable.java Thu Feb  4 18:21:07 2010
@@ -240,7 +240,7 @@
 
         DataValueDescriptor[] row = new DataValueDescriptor[ aRow.length];
         for( int i = 0; i < row.length; i++)
-            row[i] = aRow[i].getClone();
+            row[i] = aRow[i].cloneValue(false);
         
         for( int key0Idx = 0; key0Idx < key0Count; key0Idx++)
         {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java?rev=906595&r1=906594&r2=906595&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessRow.java Thu Feb  4 18:21:07 2010
@@ -129,7 +129,7 @@
 	public DataValueDescriptor[] getRowArrayClone() {
 		DataValueDescriptor[] retval = new DataValueDescriptor[column.length];
 		for (int index = 0; index < column.length; index++)
-			retval[index] = column[index].getClone();
+			retval[index] = column[index].cloneValue(false);
 		return retval;
 	}
 }



Mime
View raw message