diff --git a/jrunner/src/main/java/jrunner/jrunner.java b/jrunner/src/main/java/jrunner/jrunner.java index 865a9f7..70d9c4d 100644 --- a/jrunner/src/main/java/jrunner/jrunner.java +++ b/jrunner/src/main/java/jrunner/jrunner.java @@ -322,8 +322,11 @@ public class jrunner { options.setBatchSize(10000); options.setBulkCopyTimeout(0); bulkCopy.setBulkCopyOptions(options); - bulkCopy.writeToServer(new BulkSource(rs, cols, dtn, trim)); + BulkSource src = new BulkSource(rs, cols, dtn, trim); + bulkCopy.writeToServer(src); bulkCopy.close(); + // print the count so the trailing " rows written" line is parseable + System.out.print(src.rowsWritten()); } catch (Exception e) { e.printStackTrace(); System.exit(0); @@ -518,6 +521,7 @@ public class jrunner { private final boolean trim; private final int[] jdbcType; private final boolean[] asString; + private long rows = 0; BulkSource(ResultSet rs, int cols, String[] dtn, boolean trim) throws SQLException { this.rs = rs; @@ -596,7 +600,10 @@ public class jrunner { catch (SQLException e) { throw new RuntimeException(e); } } + public long rowsWritten() { return rows; } + public Object[] getRowData() throws SQLServerException { + rows++; Object[] row = new Object[cols]; try { for (int i = 1; i <= cols; i++) {