db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r545347 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Date Thu, 07 Jun 2007 23:24:41 GMT
Author: mamta
Date: Thu Jun  7 16:24:40 2007
New Revision: 545347

URL: http://svn.apache.org/viewvc?view=rev&rev=545347
Log:
DERBY-2777
Fixed the combination of COALESCE and parameters so that the parameters take their collation
from the context and not from the current
compilation schema

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java?view=diff&rev=545347&r1=545346&r2=545347
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
Thu Jun  7 16:24:40 2007
@@ -36,11 +36,9 @@
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
-import org.apache.derby.iapi.types.StringDataValue;
 
 import java.lang.reflect.Modifier;
 
-import java.util.Iterator;
 import java.util.Vector;
 
 /**
@@ -176,9 +174,6 @@
 			if (((ValueNode) argumentsList.elementAt(index)).requiresTypeFromContext())
 			{
 				((ValueNode)argumentsList.elementAt(index)).setType(getTypeServices());
-				//collation of ? operand should be same as the compilation schema
-				((ValueNode)argumentsList.elementAt(index)).setCollationUsingCompilationSchema(
-						StringDataValue.COLLATION_DERIVATION_IMPLICIT);
 				break;
 			}
 		}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?view=diff&rev=545347&r1=545346&r2=545347
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Thu Jun  7 16:24:40 2007
@@ -696,6 +696,18 @@
     rs = ps.executeQuery();
     JDBC.assertFullResultSet(rs,new String[][] {{"SYSCOLUMNS"}});      
 
+    //Do parameter testing with COALESCE
+    //following will pass because the ? inside the COALESCE will take the 
+    //collation type of the other operand which is TABLENAME. The result of
+    //COALESCE will have collation type of UCS_BASIC and that is the same
+    //collation that the ? on rhs of = will get.
+    ps = conn.prepareStatement("SELECT TABLENAME FROM SYS.SYSTABLES WHERE " +
+	" COALESCE(TABLENAME, ?) = ?");   
+    ps.setString(1, " ");
+    ps.setString(2, "SYSCOLUMNS ");
+    rs = ps.executeQuery();
+    JDBC.assertFullResultSet(rs,new String[][] {{"SYSCOLUMNS"}});
+
     //Do parameter testing with LTRIM
     //Won't work in territory based database because in 
     //LTRIM(?) = TABLENAME



Mime
View raw message