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 rh...@apache.org on 2007/04/12 15:58:23 UTC
svn commit: r527944 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/load/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/testData/ImportExport/
testing/org/apache/derbyTesting/functionTe...
Author: rhillegas
Date: Thu Apr 12 06:58:21 2007
New Revision: 527944
URL: http://svn.apache.org/viewvc?view=rev&rev=527944
Log:
DERBY-2193: Fix array index exception in import.
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt (with props)
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ_app.properties
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java?view=diff&rev=527944&r1=527943&r2=527944
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java Thu Apr 12 06:58:21 2007
@@ -830,7 +830,7 @@
}
}
- if (totalCharsSoFar != -1) {
+ if (totalCharsSoFar > -1) {
/* This is a hack to fix a problem: When there is missing data in columns
and hasDelimiterAtEnd==true, then the last delimiter was read as the last column data.
@@ -840,7 +840,7 @@
actually same as the delimiter.
*/
if (!hasDelimiterAtEnd) {//normal path:
- returnStringArray[upperLimit] = new String(currentToken,
+ returnStringArray[upperLimit] = new String(currentToken,
positionOfNonWhiteSpaceCharInFront, totalCharsSoFar);
}
else if (totalCharsSoFar==fieldSeparatorLength && isFieldSep(currentToken) ){
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out?view=diff&rev=527944&r1=527943&r2=527944
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out Thu Apr 12 06:58:21 2007
@@ -774,5 +774,34 @@
ij> drop table users;
0 rows inserted/updated/deleted
ij> -- end derby-1854/derby-1641 test case.
+--
+-- begin test case for derby-2193:
+--
+-- Field comprised of all blank space should become a null
+--
+create table derby_2193_tab
+(
+ a varchar( 50 ),
+ b varchar( 50 )
+);
+0 rows inserted/updated/deleted
+ij> CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE
+( null, 'DERBY_2193_TAB', 'extin/derby-2193.txt', null, null, null, 0 );
+0 rows inserted/updated/deleted
+ij> select * from derby_2193_tab;
+A |B
+-----------------------------------------------------------------------------------------------------
+who put the bop |in the bopshebop
+diddywopdiddy |NULL
+boopdeedoo |boopdeedoo
+ij> select b, length(b) from derby_2193_tab;
+B |2
+--------------------------------------------------------------
+in the bopshebop |16
+NULL |NULL
+boopdeedoo |10
+ij> --
+-- end test case for derby-2193:
+--
;
ij>
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt?view=auto&rev=527944
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt Thu Apr 12 06:58:21 2007
@@ -0,0 +1,3 @@
+who put the bop, in the bopshebop
+diddywopdiddy,
+boopdeedoo, boopdeedoo
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/testData/ImportExport/derby-2193.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql?view=diff&rev=527944&r1=527943&r2=527944
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql Thu Apr 12 06:58:21 2007
@@ -303,7 +303,26 @@
drop table users;
-- end derby-1854/derby-1641 test case.
+--
+-- begin test case for derby-2193:
+--
+-- Field comprised of all blank space should become a null
+--
+create table derby_2193_tab
+(
+ a varchar( 50 ),
+ b varchar( 50 )
+);
+
+CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE
+( null, 'DERBY_2193_TAB', 'extin/derby-2193.txt', null, null, null, 0 );
+select * from derby_2193_tab;
+select b, length(b) from derby_2193_tab;
+
+--
+-- end test case for derby-2193:
+--
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ_app.properties?view=diff&rev=527944&r1=527943&r2=527944
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ_app.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ_app.properties Thu Apr 12 06:58:21 2007
@@ -1,4 +1,4 @@
-supportfiles=testData/ImportExport/sqlAnywhere1.utf,testData/ImportExport/sqlAnywhere2.utf,testData/ImportExport/Access1.txt,testData/ImportExport/Access2.txt,testData/ImportExport/Access3.txt,testData/ImportExport/Alt1.asc,testData/ImportExport/Alt2.asc,testData/ImportExport/Alt3.asc,testData/ImportExport/Alt4.asc,testData/ImportExport/Alt5.asc,testData/ImportExport/Alt6.asc,testData/ImportExport/Tutor1.asc,testData/ImportExport/Tutor2.asc,testData/ImportExport/Tutor3.asc,testData/ImportExport/EndOfFile.txt
+supportfiles=testData/ImportExport/sqlAnywhere1.utf,testData/ImportExport/sqlAnywhere2.utf,testData/ImportExport/Access1.txt,testData/ImportExport/Access2.txt,testData/ImportExport/Access3.txt,testData/ImportExport/Alt1.asc,testData/ImportExport/Alt2.asc,testData/ImportExport/Alt3.asc,testData/ImportExport/Alt4.asc,testData/ImportExport/Alt5.asc,testData/ImportExport/Alt6.asc,testData/ImportExport/Tutor1.asc,testData/ImportExport/Tutor2.asc,testData/ImportExport/Tutor3.asc,testData/ImportExport/EndOfFile.txt,testData/ImportExport/derby-2193.txt
# fails: supportfiles=testData/ImportExport/sqlAnywhere2.txt,testData/ImportExport/Access1.txt,testData/ImportExport/Access2.txt,testData/ImportExport/Access3.txt,testData/ImportExport/Alt1.asc,testData/ImportExport/Alt2.asc,testData/ImportExport/Alt3.asc,testData/ImportExport/Alt4.asc,testData/ImportExport/Alt5.asc,testData/ImportExport/Alt6.asc,testData/ImportExport/Tutor1.asc,testData/ImportExport/Tutor2.asc,testData/ImportExport/Tutor3.asc,testData/ImportExport/EndOfFile.txt
#also fails: supportfiles=testData/ImportExport/sqlAnywhere1.txt,testData/ImportExport/Access1.txt,testData/ImportExport/Access2.txt,testData/ImportExport/Access3.txt,testData/ImportExport/Alt1.asc,testData/ImportExport/Alt2.asc,testData/ImportExport/Alt3.asc,testData/ImportExport/Alt4.asc,testData/ImportExport/Alt5.asc,testData/ImportExport/Alt6.asc,testData/ImportExport/Tutor1.asc,testData/ImportExport/Tutor2.asc,testData/ImportExport/Tutor3.asc,testData/ImportExport/EndOfFile.txt
usedefaults=true