You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2007/04/10 07:12:53 UTC

svn commit: r527033 - /db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java

Author: mamta
Date: Mon Apr  9 22:12:52 2007
New Revision: 527033

URL: http://svn.apache.org/viewvc?view=rev&rev=527033
Log:
My earlier commit 525568 caused grantRevokeDDL.sql to fail because in TypeDescriptorImpl's equals method, I was comparing the collaiton 
type and derivation for non-character datatypes to derive equality. Collation type and derivation should only be checked for character 
datatypes. This commit addresses that problem. I ran the derbyall suite and noticed no new test failures because of this patch.
The patch is being tracked as part of DERBY-2524

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java?view=diff&rev=527033&r1=527032&r2=527033
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java Mon Apr  9 22:12:52 2007
@@ -404,13 +404,29 @@
 		if(!this.getTypeName().equals(typeDescriptor.getTypeName()) ||
 		   this.precision != typeDescriptor.getPrecision() ||
 		   this.scale != typeDescriptor.getScale() ||
-		   this.collationDerivation == typeDescriptor.getCollationDerivation() ||
-		   this.collationType == typeDescriptor.getCollationType() || 
 		   this.isNullable != typeDescriptor.isNullable() ||
 		   this.maximumWidth != typeDescriptor.getMaximumWidth())
 		   return false;
 	    else
-			return true;
+	    {
+			switch (typeId.getJDBCTypeId()) {
+			case Types.CHAR:
+			case Types.VARCHAR:
+			case Types.LONGVARCHAR:
+			case Types.CLOB:
+				//if we are dealing with character types, then we should 
+				//also compare the collation information on them.
+				if(this.collationDerivation != typeDescriptor.getCollationDerivation() ||
+						this.collationType != typeDescriptor.getCollationType())
+					return false;
+				else
+					return true;
+			default:
+				//no collation checking required if we are dealing with 
+				//non-char datatypes.
+				return true;
+			}
+	    }
 	}						   
 
 	// Formatable methods