db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r834725 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/execute/InsertResultSet.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
Date Wed, 11 Nov 2009 00:27:13 GMT
Author: mamta
Date: Wed Nov 11 00:27:12 2009
New Revision: 834725

URL: http://svn.apache.org/viewvc?rev=834725&view=rev
Log:
DERBY-4435

collation[] object was not getting initialized and that was the cause of NPE. Fixed the problem
by initializing the arrary correctly.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=834725&r1=834724&r2=834725&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
Wed Nov 11 00:27:12 2009
@@ -2162,6 +2162,7 @@
 		ExecRow				baseRows = null;
 		ColumnOrdering[][]	ordering = new ColumnOrdering[numIndexes][];
 		int					numColumns = td.getNumberOfColumns();
+        collation       = new int[numIndexes][];
 
 		// Create the BitSet for mapping the partial row to the full row
 		FormatableBitSet bitSet = new FormatableBitSet(numColumns + 1);
@@ -2341,6 +2342,10 @@
 			properties.put("nKeyFields", Integer.toString(indexRowLength));
 
 			indexCC.close();
+			
+            collation[index] = 
+                constants.irgs[index].getColumnCollationIds(
+                    td.getColumnDescriptorList());
 
 			// We can finally drain the sorter and rebuild the index
 			// Populate the index.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java?rev=834725&r1=834724&r2=834725&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
Wed Nov 11 00:27:12 2009
@@ -737,6 +737,10 @@
             ps.executeUpdate();
         }
 
+        s.execute(
+        		"CREATE TABLE EMPTY_TABLE (NAME VARCHAR(40))");
+        s.execute(
+        		"CREATE INDEX EMPTY_TABLE_IDX ON EMPTY_TABLE(NAME)");
         commit();
     }
 
@@ -1128,6 +1132,7 @@
     private void dropTable() throws SQLException 
     {
         dropTable("CUSTOMER");
+        dropTable("EMPTY_TABLE");
     }
 
     private void runQueries(
@@ -1473,6 +1478,21 @@
 
         setUpTable();
 
+        //DERBY-4435
+        String emptyFileName =
+            (SupportFilesSetup.getReadWrite("empty_file.dat")).getPath();
+        s.execute("DELETE FROM EMPTY_TABLE");
+        //there is no data in EMPTY_TABLE so empty_file.dat will be empty 
+        //after export
+        doExportTable("APP", "EMPTY_TABLE", emptyFileName, null, null, "UTF-16");
+        commit();
+        // bulk insert with replace to empty table/one index from an empty file 
+        // import empty_file.dat into EMPTY_TABLE 
+        doImportTable(
+                "APP", "EMPTY_TABLE", emptyFileName, "|", "``", null, 1);
+
+        commit();
+
         // export CUSTOMER date to names.dat
         String fileName =
             (SupportFilesSetup.getReadWrite("names.dat")).getPath();
@@ -1481,7 +1501,6 @@
 
         commit();
 
-
         // bulk insert to empty table, no indexes without replace 
         // (last arg 0 = no replace).
         s.execute("DELETE FROM CUSTOMER");



Mime
View raw message