FR [ 1829798 ] Easy generation of migration scripts

Generate different names for different sessions
This commit is contained in:
Carlos Ruiz 2008-07-25 16:06:32 +00:00
parent 609c0e2023
commit 79d3469f72
1 changed files with 3 additions and 6 deletions

View File

@ -17,6 +17,7 @@
package org.compiere.dbPort; package org.compiere.dbPort;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
@ -422,9 +423,7 @@ public abstract class Convert
// migration_script_oracle.sql and migration_script_postgresql.sql // migration_script_oracle.sql and migration_script_postgresql.sql
try { try {
if (tempFileOr == null) { if (tempFileOr == null) {
String fileNameOr = System.getProperty("java.io.tmpdir") File fileNameOr = File.createTempFile("migration_script_", "_oracle.sql");
+ System.getProperty("file.separator")
+ "migration_script_oracle.sql";
tempFileOr = new FileOutputStream(fileNameOr, true); tempFileOr = new FileOutputStream(fileNameOr, true);
osOr = new DataOutputStream(tempFileOr); osOr = new DataOutputStream(tempFileOr);
} }
@ -440,9 +439,7 @@ public abstract class Convert
pgStatement = r[0]; pgStatement = r[0];
} }
if (tempFilePg == null) { if (tempFilePg == null) {
String fileNamePg = System.getProperty("java.io.tmpdir") File fileNamePg = File.createTempFile("migration_script_", "_postgresql.sql");
+ System.getProperty("file.separator")
+ "migration_script_postgresql.sql";
tempFilePg = new FileOutputStream(fileNamePg, true); tempFilePg = new FileOutputStream(fileNamePg, true);
osPg = new DataOutputStream(tempFilePg); osPg = new DataOutputStream(tempFilePg);
} }