50 lines
1.6 KiB
Java
50 lines
1.6 KiB
Java
import com.ablia.contab.Documento;
|
|
import com.ablia.db.ApplParm;
|
|
import com.ablia.db.ApplParmFull;
|
|
import com.ablia.util.DbConsole;
|
|
import com.ablia.util.Vectumerator;
|
|
|
|
public class AggDocFiglio extends DbConsole {
|
|
public static void main(String[] args) {
|
|
AggDocFiglio bean = new AggDocFiglio();
|
|
bean.doImport();
|
|
System.exit(0);
|
|
}
|
|
|
|
public void doImport() {
|
|
String db = "guidoreni";
|
|
int i = 0;
|
|
int se1 = 10;
|
|
int se2 = 100;
|
|
String hostname = "localhost";
|
|
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(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
|
apTarget.setDebug(false);
|
|
StringBuffer msg = new StringBuffer();
|
|
try {
|
|
System.out.println("calcolo tot record....");
|
|
Vectumerator vec = new Documento(apTarget).findAll();
|
|
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
|
int updRec = 0;
|
|
while (vec.hasMoreElements()) {
|
|
Documento row = (Documento)vec.nextElement();
|
|
if (row.getId_documentoFiglio() != 0L)
|
|
updRec++;
|
|
i++;
|
|
if (se1 > 0 && i % se1 == 0)
|
|
System.out.print(".");
|
|
if (se2 > 0 && i % se2 == 0)
|
|
System.out.println(String.valueOf(i) + " " + updRec);
|
|
}
|
|
System.out.println("--- fine ---");
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|