[ https://issues.apache.org/jira/browse/DERBY-2925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512577 ]
Ramin Moazeni edited comment on DERBY-2925 at 7/13/07 11:50 AM: ---------------------------------------------------------------- Hello, I am attaching an interim patch for this issue. I am still working on adding the tests to ImportExportBaseTest. Your review and feedback is greatly appreciated. To test the patch: 1) ij> connect 'jdbc:derby:test1;create=true'; 2) create table ex_emp(id int , name char(7) , skills varchar(200), salary decimal(10,2)); 3) ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' , '/home/ramin/emp.dat', null, null, null); 4) ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' , '/home/ramin/emp.dat', null, null, null); ERROR XSDF0: Could not create file /home/ramin/emp.dat as it already exists. 5) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','emp.del', ',' ,'"','UTF-8','pictures.dat'); 0 rows inserted/updated/deleted 6) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','emp.del', ',' ,'"','UTF-8','pictures.dat'); ERROR XSDF0: Could not create file emp.del as it already exists. 7) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','staff.del', ',' ,'"','UTF-8','pictures.dat'); ERROR XSDF0: Could not create file pictures.dat as it already exists. Thanks Ramin was: Hello, I am attaching an interim patch for this issue. I am still working on adding the tests to ImportExportBaseTest. Your review and feedback is greatly appreciated. To test the patch: 1) ij> connect 'jdbc:derby:test1;create=true'; 2) create table ex_emp(id int , name char(7) , skills varchar(200), salary decimal(10,2)); 3) ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' , '/home/ramin/emp.dat', null, null, null); 4) ij> call SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'EX_EMP' , '/home/ramin/emp.dat', null, null, null); ERROR XSDF0: Could not create file /home/ramin/emp.dat as it already exists. 5) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','emp.del', ',' ,'"','UTF-8','pictures.dat'); 0 rows inserted/updated/deleted 6) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','emp.del', ',' ,'"','UTF-8','pictures.dat'); ERROR XSDF0: Could not create file staff.del as it already exists. 7) ij> CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE('SELECT * FROM EX_EMP','staff.del', ',' ,'"','UTF-8','pictures.dat'); ERROR XSDF0: Could not create file pictures.dat as it already exists. Thanks Ramin > Prevent export from overwriting existing files > ---------------------------------------------- > > Key: DERBY-2925 > URL: https://issues.apache.org/jira/browse/DERBY-2925 > Project: Derby > Issue Type: Sub-task > Components: Security, Tools > Affects Versions: 10.1.2.1, 10.2.2.0, 10.3.1.3, 10.4.0.0 > Reporter: Kathey Marsden > Assignee: Ramin Moazeni > Attachments: DERBY-2925v0.diff, DERBY-2925v0.stat > > > Export should not overwrite existing files, but rather insist that the user > remove them before writing to the file. This will help prevent accidental or > intentional corruption of the database with export. This may introduce a > compatibility issue with export but because export is usually an attended > utility and not typically invoked as part of an application, I think the risk > is worth the additional security this will provide. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.