-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Apache Commons CSV --> 01:27
2023-02-16T02:34:38.933511 ProxiedStatement: getConnection
2023-02-16T02:34:39.141314 m=streamSelect, sql=SELECT * FROM TMP, autoCommit=true
2023-02-16T02:34:39.160498 m=streamSelect, status=executed, sql=SELECT * FROM TMP
2023-02-16T02:34:39.586226 status=printingRecords
2023-02-16T02:36:06.345703 status=csvWritten
2023-02-16T02:36:14.271099 status=linesCount, lines=7000000
2023-02-16T02:36:14.271566 m=getWarningsprivate int extractQueryToCsv() throws SQLException {
try {
CsvTableDaos.streamSelect(this.connection, this.csvStm.getExtractSql(), (rs) -> {
try (final CSVPrinter printer = this.createCsvPrinter()) {
Log.log("status=printingRecords");
printer.printRecords(rs, true);
}
});
} catch (Exception e) {
throw new SQLException(e);
}
Log.log("status=csvWritten");
try {
final int lines = Files.countLines(this.csvStm.getFile()) - HEADER_COUNT;
Log.log("status=linesCount, lines={}", lines);
return lines;
} catch (IOException e) {
throw new SQLException(e);
}
}Vanilla BufferedWritter --> 01:08
2023-02-16T02:41:39.530363 ProxiedStatement: getConnection
2023-02-16T02:41:40.230132 m=streamSelect, sql=SELECT * FROM TMP, autoCommit=true
2023-02-16T02:41:40.251840 m=streamSelect, status=executed, sql=SELECT * FROM TMP
2023-02-16T02:42:48.085736 m=getWarnings
2023-02-16T02:42:48.086107 m=clearWarnings
2023-02-16T02:42:48.086320 ProxiedStatement: getWarnings
2023-02-16T02:42:48.086503 ProxiedStatement: clearWarnings
2023-02-16T02:42:48.086680 m=getMetaData
2023-02-16T02:42:48.086866 ProxiedStatement: getUpdateCount
20
private int extractQueryToCsv0() throws SQLException {
try {
final BufferedWriter out = java.nio.file.Files.newBufferedWriter(this.csvStm.getFile());
CsvTableDaos.streamSelect(this.connection, this.csvStm.getExtractSql(), (rs) -> {
// try (final CSVPrinter printer = this.createCsvPrinter()) {
final int columns = rs
.getMetaData()
.getColumnCount();
while (rs.next()){
for (int i = 1; i <= columns; i++) {
out.write(rs.getString(i));
out.write(", ");
}
out.write('\n');
}
// printer.printRecords(rs, true);
// }
});
} catch (Exception e) {
throw new SQLException(e);
}
try {
return Files.countLines(this.csvStm.getFile()) - HEADER_COUNT;
} catch (IOException e) {
throw new SQLException(e);
}
}Metadata
Metadata
Assignees
Labels
No labels