54 lines
1.8 KiB
Java
54 lines
1.8 KiB
Java
import it.acxent.contab.Documento;
|
|
import it.acxent.contab.DocumentoCR;
|
|
import it.acxent.db.ApplParm;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.util.DbConsole;
|
|
import it.acxent.util.Timer;
|
|
import it.acxent.util.Vectumerator;
|
|
|
|
public class SaveDocumento extends DbConsole {
|
|
public static void main(String[] args) {
|
|
SaveDocumento bean = new SaveDocumento();
|
|
bean.doImport();
|
|
System.exit(0);
|
|
}
|
|
|
|
public void doImport() {
|
|
String db = "ncc";
|
|
int i = 0;
|
|
int se1 = 10;
|
|
int se2 = 100;
|
|
String hostname = "localhost:3308";
|
|
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
|
if (!temp.isEmpty())
|
|
hostname = temp;
|
|
temp = getCi().readLine("Database name (" + db + "):");
|
|
if (!temp.isEmpty())
|
|
db = temp;
|
|
System.out.println("Db: " + db);
|
|
ApplParmFull apTarget = new ApplParmFull(new ApplParm(17, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300));
|
|
apTarget.setDebug(false);
|
|
StringBuffer msg = new StringBuffer();
|
|
try {
|
|
DocumentoCR CR = new DocumentoCR();
|
|
Vectumerator<Documento> vec = new Documento(apTarget).findByCR(CR, 0, 0);
|
|
System.out.println("TOT RECORD: " + vec.getTotNumberOfRecords());
|
|
Timer timer = new Timer();
|
|
timer.start();
|
|
while (vec.hasMoreElements()) {
|
|
Documento row = (Documento)vec.nextElement();
|
|
row.superSave();
|
|
i++;
|
|
if (se1 > 0 && i % se1 == 0)
|
|
System.out.print(".");
|
|
if (se2 > 0 && i % se2 == 0)
|
|
System.out.println("" + i + " /" + i + " " + vec.getTotNumberOfRecords());
|
|
}
|
|
timer.stop();
|
|
System.out.println(timer.getDurata());
|
|
System.out.println("\n\n ------------- Fine ---------------");
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|