Issue 37218: Cleanup export.sample.data console output.
authorStefan Hühner <stefan.huehner@openbravo.com>
Fri, 03 Nov 2017 12:39:49 +0100
changeset 1126 61c5fea745de
parent 1125 42d211d9f505
child 1127 76d2af1669f3
Issue 37218: Cleanup export.sample.data console output.

Skip lines with '0 records exported'.
src/org/apache/ddlutils/io/DatabaseDataIO.java
src/org/apache/ddlutils/platform/postgresql/PostgreSqlDatabaseDataIO.java
--- a/src/org/apache/ddlutils/io/DatabaseDataIO.java	Thu Oct 19 10:12:04 2017 +0200
+++ b/src/org/apache/ddlutils/io/DatabaseDataIO.java	Fri Nov 03 12:39:49 2017 +0100
@@ -430,7 +430,9 @@
         writer.write(model, dsTable, row);
         nExportedRows++;
       }
-      _log.info("  " + nExportedRows + " records have been exported from table " + table.getName());
+      if (nExportedRows > 0) {
+        _log.info("  " + nExportedRows + " records have been exported from table " + table.getName());
+      }
     } catch (SQLException ex) {
       _log.error("SQL command to read rows from table failed: " + sqlstatement, ex);
     } finally {
@@ -455,7 +457,9 @@
       writer.write(model, dsTable, row);
       anyRecordsHaveBeenExported = true;
     }
-    _log.info("  " + rows.size() + " records have been exported from table " + table.getName());
+    if (rows.size() > 0) {
+      _log.info("  " + rows.size() + " records have been exported from table " + table.getName());
+    }
     platform.returnConnection(con);
     writer.writeDocumentEnd();
     return anyRecordsHaveBeenExported;
--- a/src/org/apache/ddlutils/platform/postgresql/PostgreSqlDatabaseDataIO.java	Thu Oct 19 10:12:04 2017 +0200
+++ b/src/org/apache/ddlutils/platform/postgresql/PostgreSqlDatabaseDataIO.java	Fri Nov 03 12:39:49 2017 +0100
@@ -84,7 +84,9 @@
       copyCommand.append("COPY (" + query + ")");
       copyCommand.append(" TO STDOUT WITH (FORMAT CSV, HEADER true)");
       count = copyManager.copyOut(copyCommand.toString(), output);
-      log.info("  " + count + " records have been exported from table " + dsTable.getName());
+      if (count > 0) {
+        log.info("  " + count + " records have been exported from table " + dsTable.getName());
+      }
     } catch (Exception e) {
       log.error("Error while exporting table", e);
     } finally {