db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r910200 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
Date Mon, 15 Feb 2010 11:00:35 GMT
Author: kristwaa
Date: Mon Feb 15 11:00:35 2010
New Revision: 910200

URL: http://svn.apache.org/viewvc?rev=910200&view=rev
Log:
DERBY-4542: Avoid materialization where possible when cloning CollatorSQLClob 

Made CollatorSQLClob able to clone itself without materializing the value
(doesn't apply in all cases, sometimes we are forced to materialize because
it is requested to do so, or because we don't know how to clone the underlying
value).

Patch file: derby-4542-1a-avoid_materialization.diff


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java

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=910200&r1=910199&r2=910200&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 Mon Feb
15 11:00:35 2010
@@ -109,17 +109,26 @@
      */
     public DataValueDescriptor cloneValue(boolean forceMaterialization)
 	{
-		try
-		{
-			return new CollatorSQLClob(getString(), 
-					holderForCollationSensitiveInfo.getCollatorForCollation());
-		}
-		catch (StandardException se)
-		{
-			if (SanityManager.DEBUG)
-				SanityManager.THROWASSERT("Unexpected exception", se);
-			return null;
-		}
+        if (forceMaterialization) {
+            try {
+                return new CollatorSQLClob(getString(),
+                    holderForCollationSensitiveInfo.getCollatorForCollation());
+            }
+            catch (StandardException se)
+            {
+                if (SanityManager.DEBUG)
+                    SanityManager.THROWASSERT("Unexpected exception", se);
+                return null;
+            }
+        } else {
+            // If materialization isn't forced, let SQLClob (super) decide how
+            // to clone the value.
+           SQLClob clob = (SQLClob)super.cloneValue(forceMaterialization);
+           CollatorSQLClob clone = new CollatorSQLClob(
+                   holderForCollationSensitiveInfo.getCollatorForCollation());
+           clone.copyState(clob);
+           return clone;
+        }
 	}
 
 	/**



Mime
View raw message