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/07/19 19:10:45 UTC

svn commit: r557693 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/CreateTableNode.java engine/org/apache/derby/impl/store/access/btree/index/B2I.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Author: mamta
Date: Thu Jul 19 10:10:44 2007
New Revision: 557693

URL: http://svn.apache.org/viewvc?view=rev&rev=557693
Log:
This commit has 2 simple fixes (DERBY-2951 which gives assert failure and DERBY-2656 The table will have collation type UCS_BASIC which is different than the collation of the schema TERRITORY_BASED hence this operation is not supported.)

The failure in DERBY-2951 is because in store, we were not using correct format id and hence collation information was not getting written out and read from disk. Added a test case for this in CollationTest.

The failure in DERBY-2656 was because of the bug that we were comparing collation type for non-character types. Collation is only applicable to character types and hence we should check for character types before comparing the collation info. Added a test case for this one too.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/index/B2I.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/CreateTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java?view=diff&rev=557693&r1=557692&r2=557693
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java Thu Jul 19 10:10:44 2007
@@ -330,7 +330,8 @@
 				//has collation of territory based. This is not supported and
 				//hence we will throw an exception below for the query above in
 				//a territory based database. 
-				if (dtd.getCollationType() != schemaCollationType)
+				if (dtd.getTypeId().isStringTypeId() && 
+						dtd.getCollationType() != schemaCollationType)
 				{
 					String schemaCollationName =
 			        	(schemaCollationType == 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/index/B2I.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/index/B2I.java?view=diff&rev=557693&r1=557692&r2=557693
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/index/B2I.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/btree/index/B2I.java Thu Jul 19 10:10:44 2007
@@ -996,7 +996,7 @@
 	*/
 	public int getTypeFormatId() 
     {
-		return StoredFormatIds.ACCESS_B2I_V3_ID;
+		return StoredFormatIds.ACCESS_B2I_V4_ID;
 	}
 
 

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=557693&r1=557692&r2=557693
==============================================================================
--- 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 Jul 19 10:10:44 2007
@@ -946,6 +946,21 @@
     //territory based
     assertStatementError("42ZA3", s, "CREATE TABLE T AS SELECT TABLENAME " +
     		" FROM SYS.SYSTABLES WITH NO DATA");
+    //But following will work because there is no character string type
+    //involved.
+    s.executeUpdate("CREATE TABLE T AS SELECT COLUMNNUMBER FROM " +
+    		" SYS.SYSCOLUMNS WITH NO DATA");
+    
+    //DERBY-2951
+    //Following was giving Assert failure in store code because we were not
+    //writing and reading the collation information from the disk.
+    s.execute("create table assoc (x char(10) not null primary key, "+
+    		" y char(100))");
+    s.execute("create table assocout(x char(10))");
+    ps = conn.prepareStatement("insert into assoc values (?, 'hello')");
+    ps.setString(1, new Integer(10).toString());
+    ps.executeUpdate();     
+
 }
 
 private void setUpTable(Statement s) throws SQLException {