db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r558049 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Date Fri, 20 Jul 2007 16:55:26 GMT
Author: mamta
Date: Fri Jul 20 09:55:25 2007
New Revision: 558049

URL: http://svn.apache.org/viewvc?view=rev&rev=558049
Log:
Merging fix for DERBY-2960 from main (revision 558036) into 10.3 codeline. The commit comments
were as follows

"select" query failed because we were generating SQLVarchar rather than CollatorSQLVarchar
create table alltypes (c char(10), v varchar(50));
insert into alltypes values ('duplicate', 'is duplicated');
select substr(c||v, 1, 4), count(*) from alltypes group by substr(c||v, 1, 4) ;

To fix the problem, I needed to override StringDataValue getNewVarchar() in CollatorSQLVarchar.
Without this new method, we were generating SQLVarchar in territory based databased when the
collation type was territory based.


Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.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/CollatorSQLVarchar.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java?view=diff&rev=558049&r1=558048&r2=558049
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/types/CollatorSQLVarchar.java
Fri Jul 20 09:55:25 2007
@@ -120,6 +120,13 @@
 		return result;
 	}
 
+	protected StringDataValue getNewVarchar() throws StandardException
+	{
+		CollatorSQLVarchar result = new CollatorSQLVarchar(
+				holderForCollationSensitiveInfo.getCollatorForCollation());
+		return result;
+	}
+
 	/**
 	 * We do not anticipate this method on collation sensitive DVD to be
 	 * ever called in Derby 10.3 In future, when Derby will start supporting

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=558049&r1=558048&r2=558049
==============================================================================
--- 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 20 09:55:25 2007
@@ -967,6 +967,15 @@
     //incorrect exception about collation mismatch for the LIKE clause
     s.execute("CREATE TABLE DERBY_2955 (EMPNAME CHAR(20), CONSTRAINT " +
     		" STAFF9_EMPNAME CHECK (EMPNAME NOT LIKE 'T%'))");
+    
+    //DERBY-2960
+    //Following group by was failing earlier because we were generating
+    //SQLVarchar rather than CollatorSQLVarchar in territory based db 
+    s.execute("CREATE TABLE DERBY_2960 (C CHAR(10), V VARCHAR(50))");
+    s.execute("INSERT INTO DERBY_2960 VALUES ('duplicate', 'is duplicated')");
+    rs = s.executeQuery("SELECT SUBSTR(c||v, 1, 4), COUNT(*) FROM DERBY_2960" +
+    		" GROUP BY SUBSTR(c||v, 1, 4)");
+    JDBC.assertFullResultSet(rs,new String[][] {{"dupl","1"}});
 }
 
 private void setUpTable(Statement s) throws SQLException {



Mime
View raw message