db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r561638 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/impl/load/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyT...
Date Wed, 01 Aug 2007 04:09:59 GMT
Author: kmarsden
Date: Tue Jul 31 21:09:58 2007
New Revision: 561638

URL: http://svn.apache.org/viewvc?view=rev&rev=561638
Log:
DERBY-2925 Prevent export from overwriting existing files


Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Export.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/LoadError.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.3/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Export.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Export.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Export.java (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Export.java Tue Jul 31 21:09:58 2007
@@ -26,6 +26,8 @@
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.*;    
+import org.apache.derby.iapi.util.PrivilegedFileOps;
+import java.io.File;
 import org.apache.derby.iapi.error.PublicAPI;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.error.StandardException;
@@ -41,7 +43,7 @@
 	private String outputFileName;
 	/* Name of the file to  which large object data has to be exported */
 	private String lobsFileName;
-
+          
 	private void doExport() throws SQLException
 	{
 		try {
@@ -50,6 +52,15 @@
 			
 			if (outputFileName == null)
 				throw LoadError.dataFileNull();
+                        else
+                        {
+                            if (dataFileExists(outputFileName))
+                                throw LoadError.dataFileExists(outputFileName);
+                        }
+
+			if (lobsFileName != null && lobsFileExists(lobsFileName))
+                                throw LoadError.lobsFileExists(lobsFileName);
+                        
 			try {
 				doAllTheWork();
 			} catch (IOException iex) {
@@ -59,7 +70,6 @@
 		} catch (Exception ex) {
 			throw LoadError.unexpectedError(ex);
 		}
-
 	}
 	
 	private Export(Connection con, String schemaName , 
@@ -102,7 +112,39 @@
 		lobsInExtFile = true;
 	}
 
+    /**
+     * Checks whether the lobs file exists .
+     * @param fileName  the file to to which lob data has to be exported.
+     * @exception SQLException  if file name is null.	
+     */
+	private boolean lobsFileExists(String fileName) throws SQLException {
+
+            if (fileName == null) {
+            throw PublicAPI.wrapStandardException(
+                      StandardException.newException(
+		      SQLState.LOB_DATA_FILE_NULL));
+        }
+            File file = new File(fileName);
 
+            return PrivilegedFileOps.exists(file);
+
+        }
+    /**
+     * Checks whether the data file exists .
+     * @param fileName  the file to to which lob data has to be exported.
+     * @exception SQLException  if file name is null.
+     */ 
+	private boolean dataFileExists(String fileName) throws SQLException {
+            
+            if (fileName == null) {
+            throw PublicAPI.wrapStandardException(
+                      StandardException.newException(
+                      SQLState.DATA_FILE_NULL));
+        }
+            File file = new File(fileName);
+            
+           return PrivilegedFileOps.exists(file); 
+        }
 
 	/**
 	 * SYSCS_EXPORT_TABLE  system Procedure from ij or from a Java application

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/LoadError.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/LoadError.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/LoadError.java (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/LoadError.java Tue Jul 31 21:09:58 2007
@@ -76,7 +76,20 @@
     return PublicAPI.wrapStandardException(
 			   StandardException.newException(SQLState.DATA_FILE_NULL));
 	}
-
+        /**
+	   Raised if, data file exists.
+	*/
+	static SQLException dataFileExists(String fileName) {
+    return PublicAPI.wrapStandardException(
+			   StandardException.newException(SQLState.DATA_FILE_EXISTS, fileName));
+	}
+	/**
+           Raised if, lob file exists.
+        */
+        static SQLException lobsFileExists(String fileName) {
+    return PublicAPI.wrapStandardException(
+                           StandardException.newException(SQLState.LOB_DATA_FILE_EXISTS, fileName));
+        }
 	/**
 	   Raised if, the entity (ie table/view) for import/export is missing in the database.
 	*/

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/loc/messages.xml?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/loc/messages.xml Tue Jul 31 21:09:58 2007
@@ -3925,6 +3925,17 @@
                 <arg>details</arg>
             </msg>
 
+	    <msg>
+                <name>XIE0S.S</name>
+		<text>The export operation was not performed, because the specified output file ({0}) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the output file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.</text>
+                <arg>fileName</arg>
+            </msg>
+
+	    <msg>
+                <name>XIE0T.S</name>
+		<text>The export operation was not performed, because the specified large object auxiliary file ({0}) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the large object auxiliary file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.</text> 
+                <arg>fileName</arg>
+            </msg>
 
         </family>
 

Modified: db/derby/code/branches/10.3/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/shared/org/apache/derby/shared/common/reference/SQLState.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/branches/10.3/java/shared/org/apache/derby/shared/common/reference/SQLState.java Tue Jul 31 21:09:58 2007
@@ -1725,6 +1725,8 @@
 	String LOB_DATA_FILE_NOT_FOUND                                 ="XIE0P.S";
 	String LOB_DATA_FILE_NULL                                      ="XIE0Q.S";
 	String UNEXPECTED_IMPORT_ERROR                       ="XIE0R.S";
+	String DATA_FILE_EXISTS		                     ="XIE0S.S";
+	String LOB_DATA_FILE_EXISTS                          ="XIE0T.S";
 
 
 

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/iepnegativetests_ES.out Tue Jul 31 21:09:58 2007
@@ -52,6 +52,10 @@
                                  null, null, null) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: La tabla/vista 'IEP.NOTABLE' no existe.' al evaluar una expresi EnC:>243< n.
 ERROR 42X05: La tabla/vista 'IEP.NOTABLE' no existe.
+ij> --export table is null
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', null, 'extinout/t1.dat' ,
+                                 null, null, null) ;
+ERROR XIE06: Nombre de entidad nulo.
 ij> ---export schema is not valid
 call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
                                  null, null, null) ;
@@ -62,57 +66,61 @@
                                     'extinout/t1.dat' , null, null, null) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Error de sintaxis: Encountered "from" at line 1, column 8.' al evaluar una expresi EnC:>243< n.
 ERROR 42X01: Error de sintaxis: Encountered "from" at line 1, column 8.
+ij> --export query is null 
+call SYSCS_UTIL.SYSCS_EXPORT_QUERY(null,
+                                    'extinout/t1.dat' , null, null, null) ;
+ERROR XIE06: Nombre de entidad nulo.
 ij> --export codeset is invalid
 call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from iep.t1', 
                                     'extinout/t1.dat' , null, null, 'NOSUCHCODESET') ;
 ERROR XIE0I: Se ha producido una excepci EnC:>243< n de E/S al grabar datos en el archivo.
 ERROR XJ001: Excepci EnC:>243< n de Java: ': java.io.UnsupportedEncodingException'.
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t2.dat' , 
                                  null, null, null) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: El esquema 'XXXX' no existe.' al evaluar una expresi EnC:>243< n.
 ERROR 42Y07: El esquema 'XXXX' no existe.
 ij> --export delimiter errror cases
 --period can not be used as character ot column delimiter
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '.', null) ;
 ERROR XIE0K: El punto se ha especificado como un delimitador de serie de caracteres.
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '.', null, null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --same delimter can not be used as character and column delimters
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ';', ';', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --space character can not be a delimiter
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ' ', ';', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, ' ', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --if emtry strinng is passed actual value delimiter should be space
 --and the that should become a invalid delimiter 
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '', ';', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --more than one character passed to the delimiters get truncated to one
 --following one should give error because eventually '\' delimiter 
 --is used a both for char and col
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '\a', '\', null) ;
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --DO A VALID EXPORT AND  IMPORT 
 set schema iep;
 0 rows inserted/updated/deleted
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'utf-8') ;
 0 rows inserted/updated/deleted
 ij> delete from t1 ;
 7 rows inserted/updated/deleted
-ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'utf-8', 0) ;
 0 rows inserted/updated/deleted
 ij> select * from t1;
@@ -128,21 +136,21 @@
 7 rows selected
 ij> --import error cases
 --import can not find input file
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extin/nodir/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extin/nodir/t2.dat' , 
                                  null, null, null, 0) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.' al evaluar una expresi EnC:>243< n.
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.
 ERROR XJ001: Excepci EnC:>243< n de Java: ': java.lang.reflect.InvocationTargetException'.
-ERROR XIE04: Archivo de datos no encontrado: extin/nodir/t1.dat
+ERROR XIE04: Archivo de datos no encontrado: extin/nodir/t2.dat
 ij> --import table not found
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'NOTABLE' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'NOTABLE' , 'extinout/t2.dat' , 
                                  null, null, null, 0) ;
 ERROR XIE0M: La tabla 'IEP.NOTABLE' no existe.  
 ij> --import schema is not valid
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('XXXX', 'T1' , 'extinout/t2.dat' , 
                                  null, null, null, 0) ;
 ERROR XIE0M: La tabla 'XXXX.T1' no existe.  
-ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'INCORRECTCODESET', 0) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.' al evaluar una expresi EnC:>243< n.
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.
@@ -151,20 +159,20 @@
 ij> --check import with invalid delimiter usage
 --if emtry strinng is passed actual value delimiter should be space
 --and the that should become a invalid delimiter 
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '', ';', null, 0) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.' al evaluar una expresi EnC:>243< n.
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.
 ERROR XJ001: Excepci EnC:>243< n de Java: ': java.lang.reflect.InvocationTargetException'.
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
-ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+ij> call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '', null, 0) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.' al evaluar una expresi EnC:>243< n.
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.
 ERROR XJ001: Excepci EnC:>243< n de Java: ': java.lang.reflect.InvocationTargetException'.
 ERROR XIE0J: Un delimitador no es v EnC:>225< lido o se ha utilizado m EnC:>225< s de una vez.
 ij> --same delimter can not be used as character and column delimters
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ';', ';', null, 1) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.' al evaluar una expresi EnC:>243< n.
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.lang.reflect.InvocationTargetException' al evaluar una expresi EnC:>243< n.
@@ -285,36 +293,36 @@
 ij> --repeat the above type cases with empty file and minor variation to paramters
 delete from t3 ;
 12 rows inserted/updated/deleted
-ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , 'extinout/t3.dat' , 
+ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , 'extinout/t3_1.dat' , 
                                   ';', '^', 'utf-16') ;
 0 rows inserted/updated/deleted
 ij> --import data column names are incorrect
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'X1, X2, X3, X4', null, 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
                                  ';', '^', 'utf-16', 1) ;
 ERROR XIE08: No existe una columna denominada: X1.  
 ij> call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'X1, X2, X3', '1,2,3,4', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
  EnC:>9<  EnC:>9<  EnC:>9<  EnC:>9<     ';', '^', 'utf-16', 1) ;
 ERROR XIE08: No existe una columna denominada: X1.  
 ij> --import data insert column names count < column indexes does not match
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'C1, C2, C3', null, 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
  EnC:>9<  EnC:>9<  EnC:>9<  EnC:>9<     ';', '^', 'utf-16', 1) ;
 0 rows inserted/updated/deleted
 ij> --import data column indexes count > insert columns count
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , null, '1,2', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
  EnC:>9<  EnC:>9<  EnC:>9<  EnC:>9<     ';', '^', 'utf-16', 1) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: El n EnC:>250< mero de valores asignado no coincide con el n EnC:>250< mero de columnas especificadas o impl EnC:>237< citas.' al evaluar una expresi EnC:>243< n.
 ERROR 42802: El n EnC:>250< mero de valores asignado no coincide con el n EnC:>250< mero de columnas especificadas o impl EnC:>237< citas.
 ij> --specify column indexes that are not there in the file that is being  imported
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , null, '11,22,12,24', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
  EnC:>9<  EnC:>9<  EnC:>9<  EnC:>9<     ';', '^', 'utf-16', 1) ;
 0 rows inserted/updated/deleted
 ij> --import to a system table shoud fail
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('SYS', 'SYSTABLES' , 'extinout/t3.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('SYS', 'SYSTABLES' , 'extinout/t3_1.dat' , 
                                       ';', '^', 'utf-16', 1) ;
 ERROR 38000: Se he generado la excepci EnC:>243< n 'java.sql.SQLException: 'SYS.SYSTABLES' es una tabla del sistema.  Los usuarios no tienen permitido modificar el contenido de esta tabla.' al evaluar una expresi EnC:>243< n.
 ERROR 42Y25: 'SYS.SYSTABLES' es una tabla del sistema.  Los usuarios no tienen permitido modificar el contenido de esta tabla.

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out Tue Jul 31 21:09:58 2007
@@ -819,5 +819,83 @@
 ij> --
 -- end test case for derby-2193:
 --
+--
+-- begin test case for derby-2925:
+--
+-- Prevent export from overwriting existing files 
+--
+create table derby_2925_tab
+(
+    a  varchar( 50 ),
+    b  varchar( 50 )
+);
+0 rows inserted/updated/deleted
+ij> --
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_TABLE
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE
+( null, 'DERBY_2925_TAB', 'extout/derby-2925.txt', null, null, null);
+0 rows inserted/updated/deleted
+ij> --
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_TABLE
+-- since extout/derby-2925.txt already exists. 
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE
+( null, 'DERBY_2925_TAB', 'extout/derby-2925.txt', null, null, null);
+ERROR XIE0S: The export operation was not performed, because the specified output file (extout/derby-2925.txt) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the output file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.
+ij> --
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY
+('select * from DERBY_2925_TAB', 'extout/derby-2925-query.dat', null , null , null ) ;
+0 rows inserted/updated/deleted
+ij> --
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY
+-- since extout/derby-2925-query.dat already exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY
+('select * from DERBY_2925_TAB', 'extout/derby-2925-query.dat', null , null , null ) ;
+ERROR XIE0S: The export operation was not performed, because the specified output file (extout/derby-2925-query.dat) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the output file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.
+ij> --
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+--
+create table derby_2925_lob
+(
+	id 	int,
+        name 	varchar(30),
+        content clob, 
+        pic 	blob 
+);
+0 rows inserted/updated/deleted
+ij> --
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- where data file exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+0 rows inserted/updated/deleted
+ij> --
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- since extout/derby-2925_data.dat already exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+ERROR XIE0S: The export operation was not performed, because the specified output file (extout/derby-2925_data.dat) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the output file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.
+ij> --
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- where lob file exists.
+--
+-- Errors should should happen in the 
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- since extout/derby-2925_lobs.dat already exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data1.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+ERROR XIE0T: The export operation was not performed, because the specified large object auxiliary file (extout/derby-2925_lobs.dat) already exists. Export processing will not overwrite an existing file, even if the process has permissions to write to that file, due to security concerns, and to avoid accidental file damage. Please either change the large object auxiliary file name in the export procedure arguments to specify a file which does not exist, or delete the existing file, then retry the export operation.
+ij> --
+-- end test case for derby-2925:
 ;
 ij> 

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java Tue Jul 31 21:09:58 2007
@@ -50,12 +50,12 @@
     public static Test suite() throws Exception {
 
         TestSuite suite = new TestSuite("AllPackages");
-        
+
+	suite.addTest(org.apache.derbyTesting.functionTests.tests.tools._Suite.suite());
         suite.addTest(org.apache.derbyTesting.functionTests.tests.derbynet._Suite.suite());
         suite.addTest(org.apache.derbyTesting.functionTests.tests.lang._Suite.suite());
         suite.addTest(org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite.suite());
         suite.addTest(org.apache.derbyTesting.functionTests.tests.store._Suite.suite());
-        suite.addTest(org.apache.derbyTesting.functionTests.tests.tools._Suite.suite());
 
         // Suites that are compiled using Java SE 6 target need to
         // be added this way, otherwise creating the suite

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest2.java Tue Jul 31 21:09:58 2007
@@ -651,6 +651,9 @@
     String      codeset) 
         throws SQLException 
     {
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile(fileName);
+
         CallableStatement ps = 
             conn.prepareCall(
                 "call SYSCS_UTIL.SYSCS_EXPORT_TABLE (? , ? , ? , ?, ? , ?)");

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java Tue Jul 31 21:09:58 2007
@@ -347,23 +347,23 @@
 
         CallableStatement cSt = prepareCall(
             "CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE ("
-            + "  null, 'T1', 'xmlexport.del', null, null, null)");
+            + "  null, 'T1', 'extinout/xmlexport.del', null, null, null)");
 
         assertStatementError("42Z71", cSt);
         
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY("
-            + "  'select x from t1', 'xmlexport.del', null, null, null)");
+            + "  'select x from t1', 'extinout/xmlexport.del', null, null, null)");
         assertStatementError("42Z71", cSt);
 
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE ("
-            + "  null, 'T1', 'shouldntmatter.del', null, null, null, 0)");
+            + "  null, 'T1', 'extinout/shouldntmatter.del', null, null, null, 0)");
         assertStatementError("XIE0B", cSt);
         
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_IMPORT_DATA ("
-            + "  NULL, 'T1', null, '2', 'shouldntmatter.del', "
+            + "  NULL, 'T1', null, '2', 'extinout/shouldntmatter.del', "
             + "null, null, null,0)");
         assertStatementError("XIE0B", cSt);
 

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java Tue Jul 31 21:09:58 2007
@@ -82,6 +82,11 @@
                               "C1 varchar(20)," + 
                               "C2 varchar(20)," +
                               "C3 varchar(20))");
+		    // Create a table to test
+		    // DERBY-2925: Prevent export from overwriting existing files
+		    s.execute("create table derby_2925_tab(a varchar( 50 )," +
+			      "b varchar( 50 ))");
+
                 }
             };
     }
@@ -98,7 +103,15 @@
         s.executeUpdate("DELETE FROM BIN_TAB_IMP");
         s.close();
     }
-    
+    /**
+     * delete export/import files. 
+     * @throws Exception
+     */
+    protected void tearDown() throws Exception {
+	SupportFilesSetup.deleteFile(fileName);
+        super.tearDown();
+
+    }
 
     /**
      * Test import/export of a table, using 
@@ -130,6 +143,9 @@
         doImportData(null, "BIN_TAB_IMP", "C_LVBD, C_VBD, C_BD, ID", 
                      "4, 3, 2, 1",  fileName, null, null, null, 1);
         verifyData("C_LVBD, C_VBD, C_BD, ID");
+	
+	//DERBY-2925: need to delete existing files first.
+	SupportFilesSetup.deleteFile(fileName);
 
         // test with  non-default delimiters. 
         doExportQuery("select * from BIN_TAB", fileName,
@@ -158,7 +174,9 @@
         doImportData(null, "BIN_TAB_IMP", "ID, C_VBD, C_BD", "1, 3, 2",
                      fileName, null, null, null, 1);
         verifyData("ID, C_VBD, C_BD");
-
+	
+	//DERBY-2925: need to delete the file first
+	SupportFilesSetup.deleteFile(fileName);
         // test with  non-default delimiters. 
         doExportQuery("select id, c_bd, c_vbd, c_lvbd from BIN_TAB",  
                       fileName,  "$", "!" , null);
@@ -179,20 +197,20 @@
         } catch (SQLException e) {
             assertSQLState("XIE0J", e);
         }
-
+	SupportFilesSetup.deleteFile(fileName);
         try {
             doExportQuery("select * from BIN_TAB", fileName,
                           "|", "f", null);
         } catch (SQLException e) {
             assertSQLState("XIE0J", e);
         }
-
+	SupportFilesSetup.deleteFile(fileName);
         try {
             doExportTable("APP", "BIN_TAB", fileName, "B", null , null);
         } catch (SQLException e) {
             assertSQLState("XIE0J", e);
         }
-
+	SupportFilesSetup.deleteFile(fileName);
         doExportTable("APP", "BIN_TAB", fileName, null, null , null);
 
         try {
@@ -273,8 +291,45 @@
             assertSQLState("XIE0N", e);
         }
     }
+    /*
+     * DERBY-2925: Prevent export from overwriting existing files
+     * Tests for preventing overwriting existing files
+     * when exporting tables.
+     */
+    public void testDerby2925ExportTable()
+        throws SQLException
+    {
+	doExportTable("APP", "DERBY_2925_TAB", fileName, null, null , null);
+	
+	try {
+	    doExportTable("APP", "DERBY_2925_TAB", fileName, null, null , null);
+	    fail("export should have failed on existing data file.");
+	}
+	catch (SQLException e) {
+	    assertSQLState("XIE0S", e);
+	}
 
+    }
+    /*
+     * DERBY-2925: Prevent export from overwriting existing files
+     * Tests for preventing overwriting existing files
+     * when exporting tables.
+     */
+    public void testDerby2925ExportQuery()
+        throws SQLException
+    {
+	doExportQuery("select * from DERBY_2925_TAB", fileName,
+                      null, null , null);
+        try {
+	    doExportQuery("select * from DERBY_2925_TAB", fileName,
+                      	  null, null , null);
+            fail("exportQuery should have failed on existing data file.");
+        }
+        catch (SQLException e) {
+            assertSQLState("XIE0S", e);
+        }
 
+    }
     /* 
      * Verifies data in the import test table (BIN_TAB_IMP) is same 
      * as the test table from which the data was exported earlier(BIN_TAB). 
@@ -336,5 +391,5 @@
         s.executeUpdate("insert into bin_tab values " + 
                         "(13, X'212C3B24', X'2422412221', " + 
                         "  X'212421222C23B90A2124')");
-    }
+	}
 }

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java Tue Jul 31 21:09:58 2007
@@ -52,6 +52,7 @@
 
     String fileName; // main file used to perform import/export.
     String lobsFileName; // file name used to store lobs.
+    String lobsFileName2; // file name used to store lobs.
 
     public ImportExportLobTest(String name) throws SQLException {
         super(name);
@@ -60,6 +61,8 @@
             (SupportFilesSetup.getReadWrite("books.del")).getPath();
         lobsFileName = 
             (SupportFilesSetup.getReadWrite("books_lobs.dat")).getPath();
+	lobsFileName2 =
+            (SupportFilesSetup.getReadWrite("unql_books_lobs.dat")).getPath();
     }
 
     /**
@@ -92,6 +95,9 @@
                               "C1 varchar(20)," + 
                               "C2 varchar(20)," +
                               "C3 varchar(20))");
+		    s.execute("CREATE TABLE derby_2925_lob(id int," +
+			      "name varchar(30), content clob," +
+			      "pic blob)");
                 }
             };
     }
@@ -112,8 +118,6 @@
         SupportFilesSetup.deleteFile(lobsFileName);
     }
 
-    
-
     /**
      * Test import/export of a table, using 
      * SYSCS_EXPORT_TABLE and SYSCS_IMPORT_TABLE procedures.
@@ -144,6 +148,9 @@
         doImportData(null, "BOOKS_IMP", "PIC, CONTENT, NAME, ID", 
                      "4, 3, 2, 1",  fileName, null, null, null, 1);
         verifyData("PIC, CONTENT, NAME, ID");
+	
+	//DERBY-2925: need to delete export files first
+	SupportFilesSetup.deleteFile(fileName);
 
         // test with  non-default delimiters. 
         doExportQuery("select * from BOOKS_IMP", fileName,
@@ -173,6 +180,9 @@
                      fileName, null, null, null, 1);
         verifyData("ID, CONTENT, NAME");
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+
         // test with  non-default delimiters. 
         doExportQuery("select id, name, content, pic from BOOKS",  
                       fileName,  "$", "!" , null);
@@ -214,6 +224,8 @@
         // export the invalid hex strings from the table to a file. 
         doExportTable("APP", "HEX_TAB", fileName, null, null , null);
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
 
         // attempt to import the invalid hex string data into a table 
         // with binary columns. It should fail.
@@ -229,6 +241,9 @@
              assertSQLState("XIE0N", e);
         }
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+
         try {
             doExportQuery("select * from hex_tab where id = 3",  
                           fileName,  null, null, null);
@@ -241,6 +256,9 @@
             assertSQLState("XIE0N", e);
         }
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+
         try {
             doExportQuery("select * from hex_tab where id = 4",  
                           fileName,  null, null, null);
@@ -284,10 +302,13 @@
         // lob data file should get crated at the same location, where
         // the main export file is created. And also perform import/export
         // using "UTF-16" code set.
-        
+       
+	// delete the export files.
+        SupportFilesSetup.deleteFile(lobsFileName2);
+ 
         doExportTableLobsToExtFile("APP", "BOOKS", fileName, 
                                     "\t", "|", "UTF-16", 
-                                   "unql_books_lobs.dat");
+                                   lobsFileName2);
         // DERBY-2546 - with JSR this hits a JVM issue
         if (JDBC.vmSupportsJDBC3()) 
         {
@@ -319,6 +340,10 @@
                                   "4, 3, 2, 1", fileName, null, null, null, 1);
         verifyData("PIC, CONTENT, NAME, ID");
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+        SupportFilesSetup.deleteFile(lobsFileName);
+
         // test with  non-default delimiters. 
         doExportQueryLobsToExtFile("select * from BOOKS_IMP", fileName,
                                    ";", "%" , null, lobsFileName);
@@ -348,6 +373,10 @@
                                   "1, 3, 2", fileName, null, null, null, 1);
         verifyData("ID, CONTENT, NAME");
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+        SupportFilesSetup.deleteFile(lobsFileName);
+
         // test with  non-default delimiters. 
         doExportQueryLobsToExtFile("select id, name, content, pic from BOOKS",  
                                    fileName,  "$", "!" , null, lobsFileName);
@@ -370,6 +399,10 @@
             assertSQLState("XIE0J", e);
         }
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+        SupportFilesSetup.deleteFile(lobsFileName);
+
         try {
             doExportQueryLobsToExtFile("select * from BOOKS", fileName,
                                        "|", "f", null, lobsFileName);
@@ -377,6 +410,10 @@
             assertSQLState("XIE0J", e);
         }
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+        SupportFilesSetup.deleteFile(lobsFileName);
+
         doExportQueryLobsToExtFile("select * from BOOKS where id < 10", 
                                    fileName, null, null, null, lobsFileName);
 
@@ -416,6 +453,9 @@
             assertSQLState("XIE0Q", e);
         }
 
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+
         // export of lob data into an external file.
         doExportTableLobsToExtFile("APP", "BOOKS", fileName, 
                                    null, null , null, 
@@ -431,6 +471,46 @@
             assertSQLState("XIE0P", e);
         }
     }
+
+    public void testDerby2955ExportQueryLobs()
+	throws SQLException
+    {
+	doExportTableLobsToExtFile("APP", "DERBY_2925_LOB", fileName,
+                                   "\t", "|", "UTF-16",
+                                   lobsFileName);
+	try {
+       	    doExportTableLobsToExtFile("APP", "DERBY_2925_LOB", fileName,
+                                   "\t", "|", "UTF-16",
+                                   lobsFileName);
+	    fail("export should have failed as the data file exists.");
+	}
+	catch (SQLException e) {
+            assertSQLState("XIE0S", e);
+        }
+
+	//DERBY-2925: need to delete export files first
+        SupportFilesSetup.deleteFile(fileName);
+        SupportFilesSetup.deleteFile(lobsFileName);
+
+	doExportTableLobsToExtFile("APP", "DERBY_2925_LOB", fileName,
+                                   "\t", "|", "UTF-16",
+                                   lobsFileName);
+        // delete the data file, and then perform export
+	// export should fail with lob file already exists error. 
+	SupportFilesSetup.deleteFile(fileName);
+
+        try {
+            doExportTableLobsToExtFile("APP", "DERBY_2925_LOB", fileName,
+                                   "\t", "|", "UTF-16",
+                                   lobsFileName);
+            fail("export should have failed as the data file exists.");
+        }
+        catch (SQLException e) {
+            assertSQLState("XIE0T", e);
+        }
+    }
+
+
 
 
 

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java Tue Jul 31 21:09:58 2007
@@ -95,7 +95,10 @@
             + "'tennis\"p,l,ayer\"', 190.55) ");
         
         // Perform Export:
-        
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");        
+
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' "
             + ", 'extinout/emp.dat' , null, null, null) ");
@@ -152,6 +155,9 @@
         
         // Perform Export:
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' "
             + ", 'extinout/emp.dat' , null, null, null) ");
@@ -231,7 +237,10 @@
         
         assertUpdateCount(st, 7,
             " delete from imp_emp where id < 105");
-        
+
+        //DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+
         //export from ex_emp using the a query only rows that got 
         // deleted in imp_emp
         
@@ -264,6 +273,9 @@
         
         JDBC.assertFullResultSet(rs, expRS, true);
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+
         //export the columns in different column order than in the 
         // table.
         
@@ -352,6 +364,9 @@
         
         JDBC.assertFullResultSet(rs, expRS, true);
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+
         //-testing with different delimiters single quote(') as 
         // character delimiter
         
@@ -388,6 +403,9 @@
         
         JDBC.assertFullResultSet(rs, expRS, true);
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+
         // single quote(') as column delimiter
         
         cSt = prepareCall(
@@ -425,7 +443,10 @@
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/emp.dat");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' "
             + ", 'extinout/emp.dat' , '*', '%', null) ");
@@ -474,7 +495,10 @@
         
         st.executeUpdate(
             " insert into noncast values(2.5 , 8.999) ");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/noncast.dat");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('APP' , "
             + "'NONCAST' , 'extinout/noncast.dat'  , null , null , null) ");
@@ -535,6 +559,9 @@
         st.executeUpdate(
             " insert into ttypes values(null , null , null)");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/ttypes.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'TTYPES' "
             + ", 'extinout/ttypes.del' , null, null, null) ");
@@ -581,6 +608,9 @@
         st.executeUpdate(
             " insert into t1 values(2) ");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'T1' , "
             + "'extinout/t1.del' , null, null, null) ");
@@ -683,6 +713,9 @@
         st.executeUpdate(
             " insert into t1 values(2) ");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'T1' , "
             + "'extinout/t1.del' , null, null, null) ");
@@ -800,6 +833,9 @@
         st.executeUpdate(
             " insert into t1 values(2) ");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'T1' , "
             + "'extinout/t1.del' , null, null, null) ");
@@ -994,6 +1030,9 @@
             + "10E3, 32767, '09.39.43', "
             + "'2004-09-09 11:14:11', '\"varchar\" testing')");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/alltypes.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, "
             + "'ALLTYPES' , 'extinout/alltypes.del' , null, null, null) ");
@@ -1115,6 +1154,9 @@
         st.executeUpdate(
             " insert into table2 values('Leo',102, 23.4, 'I')");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/import.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select "
             + "c1,c3,c4 from table2' , 'extinout/import.del' , "
@@ -1143,7 +1185,10 @@
         
         assertUpdateCount(st, 3,
             " delete from table1");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/import.del");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE(null , 'TABLE2' "
             + ", 'extinout/import.del',  null, null, null) ");
@@ -1185,7 +1230,10 @@
         
         //check null values import to identity columns should also 
         // fail
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/import.del");
+ 
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE(null , 'TABLE2' "
             + ", 'extinout/import.del' , null, null, null) ");
@@ -1226,6 +1274,9 @@
         st.executeUpdate(
             " insert into child values (1) , (2) , (3) , (4) ");
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/parent.del");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from "
             + "parent where a < 3' , 'extinout/parent.del' , null, "
@@ -1335,6 +1386,9 @@
         String expected = rs.getString(1);
         assertTrue(expected.startsWith("Essential Duties and Responsibilities (include"));
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/pinfo.del");
+
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE ('APP', "
             + "'POSITION_INFO', 'extinout/pinfo.del', null, null, null)");
@@ -1371,7 +1425,10 @@
         rs.next();
         expected = rs.getString(1);
         assertTrue(expected.startsWith("Essential Duties and Responsibilities (include"));
-        
+      
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/autoinc.dat");
+	
         //test for autoincrement values
         
         cSt = prepareCall(
@@ -1494,7 +1551,10 @@
         
         st.executeUpdate(
             " insert into \"Group\".\"Order\" values(5, 6, 'mouse') ");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
+ 
         //following export should fail because schema name is not 
         // matching the way it is defined using delimited quotes.
         
@@ -1502,7 +1562,10 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('GROUP', "
             + "'Order' , 'extinout/order.dat', null, null, null) ");
         assertStatementError("38000", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
+ 
         //following export should fail because table name is not 
         // matching the way it is defined in the quotes.
         
@@ -1511,6 +1574,9 @@
             + "'ORDER' , 'extinout/order.dat', null, null, null) ");
         assertStatementError("38000", cSt);
         
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
+
         //following export should fail because of unquoted table 
         // name that is a reserved word.
         
@@ -1519,6 +1585,9 @@
             + "\"Group\".Order' , 'extinout/order.dat' ,    null , "
             + "null , null ) ");
         assertStatementError("38000", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
         
         //following exports should pass.
         
@@ -1526,12 +1595,18 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('Group', "
             + "'Order' , 'extinout/order.dat', null, null, null) ");
         assertUpdateCount(cSt, 0);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
         
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from "
             + "\"Group\".\"Order\"' , 'extinout/order.dat' ,    "
             + "null , null , null ) ");
         assertUpdateCount(cSt, 0);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
         
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select "
@@ -1539,7 +1614,7 @@
             + "\"Group\".\"Order\"' , 'extinout/order.dat' ,    "
             + "null , null , null ) ");
         assertUpdateCount(cSt, 0);
-        
+
         //following import should fail because schema name is not 
         // matching the way it is defined using delimited quotes.
         
@@ -1694,7 +1769,10 @@
         st.executeUpdate(
             " insert into inventory.orderTable values(104, 8, "
             + "'buffolo wings') ");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
+ 
         //following export should fail because schema name is not 
         // in upper case.
         
@@ -1702,6 +1780,9 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('inventory', "
             + "'ORDERTABLE' , 'extinout/order.dat', null, null, null) ");
         assertStatementError("38000", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
         
         //following export should fail because table name is not 
         // in upper case.
@@ -1710,6 +1791,9 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('INVENTORY', "
             + "'ordertable' , 'extinout/order.dat', null, null, null) ");
         assertStatementError("38000", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/order.dat");
         
         //following export should pass.
         
@@ -1717,7 +1801,7 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('INVENTORY', "
             + "'ORDERTABLE' , 'extinout/order.dat', null, null, null) ");
         assertUpdateCount(cSt, 0);
-        
+
         //following import should fail because schema name is not 
         // in upper case
         
@@ -1827,6 +1911,9 @@
         st.executeUpdate(
             " insert into iep.t1 values(100) , (101) , (102) , "
             + "(103) , (104) , (105) , (106)");
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extout/nodir/t1.dat");
         
         //export error casesexport can not create file
         
@@ -1834,27 +1921,39 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extout/nodir/t1.dat' , null, null, null) ");
         assertStatementError("XIE0I", cSt);
-        
+	
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
+
         //export table not found
         
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', "
             + "'NOTABLE' , 'extinout/t1.dat' , null, null, null) ");
         assertStatementError("38000", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
+ 
         //-export schema is not valid
         
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , "
             + "'extinout/t1.dat' , null, null, null) ");
         assertStatementError("38000", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extout/t1.dat");
+ 
         //export query is invalid (syntax error)
         
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select from "
             + "t1', 'extinout/t1.dat' , null, null, null) ");
         assertStatementError("38000", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         //export codeset is invalid
         
@@ -1862,12 +1961,18 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from "
             + "iep.t1', 'extinout/t1.dat' , null, null, 'NOSUCHCODESET') ");
         assertStatementError("XIE0I", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , "
             + "'extinout/t1.dat' , null, null, null) ");
         assertStatementError("38000", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
+ 
         //export delimiter errror casesperiod can not be used as 
         // character ot column delimiter
         
@@ -1875,11 +1980,17 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , null, '.', null) ");
         assertStatementError("XIE0K", cSt);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , '.', null, null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         //same delimter can not be used as character and column 
         // delimters
@@ -1888,6 +1999,9 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , ';', ';', null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         //space character can not be a delimiter
         
@@ -1895,11 +2009,17 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , ' ', ';', null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , null, ' ', null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         //if emtry strinng is passed actual value delimiter should 
         // be spaceand the that should become a invalid delimiter
@@ -1908,11 +2028,17 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , '', ';', null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , null, '', null) ");
         assertStatementError("XIE0J", cSt);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         //more than one character passed to the delimiters get 
         // truncated to onefollowing one should give error because 
@@ -1927,6 +2053,9 @@
         
         st.executeUpdate(
             "set schema iep");
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
@@ -1935,7 +2064,7 @@
         
         assertUpdateCount(st, 7,
             " delete from t1 ");
-        
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , "
             + "'extinout/t1.dat' , null, null, 'utf-8', 0) ");
@@ -1959,6 +2088,9 @@
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extin/nodir/t1.dat");
         
         //import error casesimport can not find input file
         
@@ -1966,14 +2098,14 @@
             "call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , "
             + "'extin/nodir/t1.dat' , null, null, null, 0) ");
         assertStatementError("38000", cSt);
-        
+       
         //import table not found
         
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', "
             + "'NOTABLE' , 'extinout/t1.dat' , null, null, null, 0) ");
         assertStatementError("XIE0M", cSt);
-        
+       
         //import schema is not valid
         
         cSt = prepareCall(
@@ -2039,7 +2171,10 @@
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/temp1.dat");
+ 
         //export to from a temporary table
         
         cSt = prepareCall(
@@ -2131,7 +2266,10 @@
         
         st.executeUpdate(
             " insert into t3 values(4 , 3.5 , 8.6 , 'test strings')");
-        
+
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t3.dat");
+
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , "
             + "'extinout/t3.dat' , null, null, null) ");
@@ -2204,7 +2342,10 @@
         
         assertUpdateCount(st, 12,
             "delete from t3 ");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/t3.dat");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , "
             + "'extinout/t3.dat' , ';', '^', 'utf-16') ");
@@ -2263,7 +2404,10 @@
         
         st.executeUpdate(
             " insert into parent values (1) , (2) , (3) , (4) ");
-        
+       
+	//DERBY-2925: need to delete existing files first.
+        SupportFilesSetup.deleteFile("extinout/parent.del");
+ 
         cSt = prepareCall(
             " call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from "
             + "parent where a < 3' , 'extinout/parent.del' , null, "

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java Tue Jul 31 21:09:58 2007
@@ -217,6 +217,8 @@
 			 String charDel, 
 			 String codeset) throws SQLException 
 	{
+		 //DERBY-2925: need to delete existing files first.
+        	 SupportFilesSetup.deleteFile("extinout/" + fromTable + ".dat");
 		 String expsql = "call SYSCS_UTIL.SYSCS_EXPORT_TABLE (? , ? , ? , ?, ? , ?)";
 		 PreparedStatement ps = c.prepareStatement(expsql);
 		 ps.setString(1 , "APP");

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/iepnegativetests.sql Tue Jul 31 21:09:58 2007
@@ -25,88 +25,93 @@
 --export table not found
 call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'NOTABLE' , 'extinout/t1.dat' , 
                                  null, null, null) ;
+--export table is null
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', null, 'extinout/t1.dat' ,
+                                 null, null, null) ;
 ---export schema is not valid
 call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
                                  null, null, null) ;
 --export query is invalid (syntax error)
 call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select from t1', 
                                     'extinout/t1.dat' , null, null, null) ;
-
+--export query is null 
+call SYSCS_UTIL.SYSCS_EXPORT_QUERY(null,
+                                    'extinout/t1.dat' , null, null, null) ;
 --export codeset is invalid
 call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from iep.t1', 
                                     'extinout/t1.dat' , null, null, 'NOSUCHCODESET') ;
 
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('XXXX', 'T1' , 'extinout/t2.dat' , 
                                  null, null, null) ;
 --export delimiter errror cases
 --period can not be used as character ot column delimiter
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '.', null) ;
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '.', null, null) ;
 
 --same delimter can not be used as character and column delimters
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ';', ';', null) ;
 
 --space character can not be a delimiter
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ' ', ';', null) ;
 
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, ' ', null) ;
 
 --if emtry strinng is passed actual value delimiter should be space
 --and the that should become a invalid delimiter 
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '', ';', null) ;
 
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '', null) ;
 
 
 --more than one character passed to the delimiters get truncated to one
 --following one should give error because eventually '\' delimiter 
 --is used a both for char and col
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '\a', '\', null) ;
 
 
 --DO A VALID EXPORT AND  IMPORT 
 set schema iep;
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'utf-8') ;
 delete from t1 ;
 
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'utf-8', 0) ;
 select * from t1;
 
 --import error cases
 --import can not find input file
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extin/nodir/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE('IEP', 'T1' , 'extin/nodir/t2.dat' , 
                                  null, null, null, 0) ;
 --import table not found
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'NOTABLE' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'NOTABLE' , 'extinout/t2.dat' , 
                                  null, null, null, 0) ;
 --import schema is not valid
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('XXXX', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('XXXX', 'T1' , 'extinout/t2.dat' , 
                                  null, null, null, 0) ;
 
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, null, 'INCORRECTCODESET', 0) ;
 
 --check import with invalid delimiter usage
 --if emtry strinng is passed actual value delimiter should be space
 --and the that should become a invalid delimiter 
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  '', ';', null, 0) ;
 
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  null, '', null, 0) ;
 
 --same delimter can not be used as character and column delimters
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t1.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('IEP', 'T1' , 'extinout/t2.dat' , 
                                  ';', ';', null, 1) ;
 
 
@@ -173,35 +178,35 @@
 
 --repeat the above type cases with empty file and minor variation to paramters
 delete from t3 ;
-call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , 'extinout/t3.dat' , 
+call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T3' , 'extinout/t3_1.dat' , 
                                   ';', '^', 'utf-16') ;
 --import data column names are incorrect
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'X1, X2, X3, X4', null, 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
                                  ';', '^', 'utf-16', 1) ;
 
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'X1, X2, X3', '1,2,3,4', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
 				    ';', '^', 'utf-16', 1) ;
 
 --import data insert column names count < column indexes does not match
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , 'C1, C2, C3', null, 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
 				    ';', '^', 'utf-16', 1) ;
 --import data column indexes count > insert columns count
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , null, '1,2', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
 				    ';', '^', 'utf-16', 1) ;
 
 
 --specify column indexes that are not there in the file that is being  imported
 call SYSCS_UTIL.SYSCS_IMPORT_DATA('IEP', 'T3' , null, '11,22,12,24', 
-                                 'extinout/t3.dat' , 
+                                 'extinout/t3_1.dat' , 
 				    ';', '^', 'utf-16', 1) ;
 
 
 --import to a system table shoud fail
-call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('SYS', 'SYSTABLES' , 'extinout/t3.dat' , 
+call SYSCS_UTIL.SYSCS_IMPORT_TABLE ('SYS', 'SYSTABLES' , 'extinout/t3_1.dat' , 
                                       ';', '^', 'utf-16', 1) ;
 
 --import should aquire a lock on the table

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql Tue Jul 31 21:09:58 2007
@@ -337,5 +337,84 @@
 -- end test case for derby-2193:
 --
 
+--
+-- begin test case for derby-2925:
+--
+-- Prevent export from overwriting existing files 
+--
 
+create table derby_2925_tab
+(
+    a  varchar( 50 ),
+    b  varchar( 50 )
+);
 
+--
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_TABLE
+--
+
+CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE
+( null, 'DERBY_2925_TAB', 'extout/derby-2925.txt', null, null, null);
+--
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_TABLE
+-- since extout/derby-2925.txt already exists. 
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE
+( null, 'DERBY_2925_TAB', 'extout/derby-2925.txt', null, null, null);
+
+--
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY
+--
+
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY
+('select * from DERBY_2925_TAB', 'extout/derby-2925-query.dat', null , null , null ) ;
+--
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY
+-- since extout/derby-2925-query.dat already exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY
+('select * from DERBY_2925_TAB', 'extout/derby-2925-query.dat', null , null , null ) ;
+
+--
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+--
+
+create table derby_2925_lob
+(
+	id 	int,
+        name 	varchar(30),
+        content clob, 
+        pic 	blob 
+);
+
+--
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- where data file exists.
+--
+
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+--
+-- Errors should should happen in the second
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- since extout/derby-2925_data.dat already exists.
+--
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+
+--
+-- Testing SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- where lob file exists.
+--
+-- Errors should should happen in the 
+-- call to SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+-- since extout/derby-2925_lobs.dat already exists.
+--
+
+CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
+('SELECT * FROM DERBY_2925_LOB','extout/derby-2925_data1.dat', '\t' ,'|','UTF-16','extout/derby-2925_lobs.dat');
+
+--
+-- end test case for derby-2925:

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_3.java Tue Jul 31 21:09:58 2007
@@ -36,6 +36,7 @@
 
 import org.apache.derbyTesting.functionTests.tests.jdbcapi.BlobStoredProcedureTest;
 import org.apache.derbyTesting.functionTests.tests.jdbcapi.ClobStoredProcedureTest;
+import org.apache.derbyTesting.junit.SupportFilesSetup;
 
 
 /**
@@ -312,6 +313,11 @@
                 (SupportFilesSetup.getReadWrite("iet1_lobs.dat")).getPath();
 
             Statement s = createStatement();
+
+	    //DERBY-2925: need to delete existing files first.
+            SupportFilesSetup.deleteFile(fileName);
+            SupportFilesSetup.deleteFile(lobsFileName);
+
             s.execute(
                 "call SYSCS_UTIL.SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE" +  
                 "(null , 'IET1' , '"  +  fileName  + 
@@ -319,6 +325,11 @@
             s.execute("call SYSCS_UTIL.SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE(" + 
                       "null, 'IET1' , '" + fileName + 
                       "', null, null, null, 0)");
+
+	    //DERBY-2925: need to delete existing files first.
+            SupportFilesSetup.deleteFile(fileName);
+            SupportFilesSetup.deleteFile(lobsFileName);
+
             s.execute("call SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE(" +
                       "'select * from IET1', '" +  fileName + 
                       "' , null, null, null, '" + lobsFileName + "')");

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy?view=diff&rev=561638&r1=561637&r2=561638
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy Tue Jul 31 21:09:58 2007
@@ -70,7 +70,7 @@
   // Import/export and other support files from these locations in tests
   permission java.io.FilePermission "${user.dir}${/}extin${/}-", "read";
   permission java.io.FilePermission "${user.dir}${/}extinout${/}-", "read,  write, delete";
-  permission java.io.FilePermission "${user.dir}${/}extout${/}-", "write";
+  permission java.io.FilePermission "${user.dir}${/}extout${/}-", "read,write";
   permission java.io.FilePermission "${user.dir}${/}extinout", "read,write";
   
   // These permissions are needed to load the JCE for encryption with Sun and IBM JDK131.



Mime
View raw message