db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r553837 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/iapi/types/DataTypeDescriptor.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Date Fri, 06 Jul 2007 11:18:12 GMT
Author: mamta
Date: Fri Jul  6 04:18:11 2007
New Revision: 553837

URL: http://svn.apache.org/viewvc?view=rev&rev=553837
Log:
Merging revision 553834 from main into Derby 10.3.1.1 codeline. commit comments are as follows

DERBY-2725 

If both the character string operands involved in DataTypeDescriptor.comparable() have collation
derivation of NONE, then 
such 2 DTDs can't be compared. I am adding code to implement that behavior and added a test
case for this. 



Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java?view=diff&rev=553837&r1=553836&r2=553837
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
Fri Jul  6 04:18:11 2007
@@ -1046,6 +1046,12 @@
     		//If both the types are string types, then we need to make sure
     		//they have the same collation set on them
     		if (compareWithTypeID.isStringTypeId() && typeId.isStringTypeId()) {
+    			//both the operands can not have the collation derivation of 
+    			//NONE. This is because in that case, we do not know what kind 
+    			//of collation to use for comparison.
+    			if (getCollationDerivation() == compareWithDTD.getCollationDerivation() &&
+    					getCollationDerivation() == StringDataValue.COLLATION_DERIVATION_NONE)
+    				return false;
     			if (getCollationDerivation() == compareWithDTD.getCollationDerivation() &&
     					getCollationType() == compareWithDTD.getCollationType())
     				return true;//collation matches

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?view=diff&rev=553837&r1=553836&r2=553837
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Fri Jul  6 04:18:11 2007
@@ -547,7 +547,11 @@
     checkLangBasedQuery(s, "SELECT TABLENAME FROM SYS.SYSTABLES WHERE " +
     		" CAST (TABLENAME || ' ' AS CHAR(12)) = " +
 			" 'SYSCOLUMNS '",
-    		new String[][] {{"SYSCOLUMNS"} });   
+    		new String[][] {{"SYSCOLUMNS"} });
+    //Following will fail because both sides of the = operator have collation
+    //derivation of NONE. DERBY-2725
+    assertStatementError("42818", s, "SELECT TABLENAME FROM SYS.SYSTABLES WHERE " +
+    		" TABLENAME || ' ' = TABLENAME || 'SYSCOLUMNS '");   
 
     //Do some testing using COALESCE
     //following will fail because result string of COALESCE has 



Mime
View raw message