1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Sun Jan 05 00:17:27 2014 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Sun Jan 05 00:49:01 2014 +0100
1.3 @@ -59,27 +59,32 @@
1.4 public void showInfo() throws ConfigurationException, FormatterException {
1.5 EnumSet<InfoType> commands = options.getShowInfo();
1.6
1.7 + boolean formattinNeeded = false;
1.8 +
1.9 for (InfoType infoType : commands) {
1.10 switch (infoType) {
1.11 - // only these need formatted output
1.12 case CONNECTION:
1.13 case DATABASES:
1.14 case FORMATTERS:
1.15 case TYPES:
1.16 - try (Formatter f = getFormatter()) {
1.17 - formatter = f;
1.18 - formatter.writeStartBatch();
1.19 - formatter.writeStartDatabase(new DatabaseDefinition());
1.20 - showInfos(commands);
1.21 - formatter.writeEndDatabase();
1.22 - formatter.writeEndBatch();
1.23 - formatter.close();
1.24 - }
1.25 + formattinNeeded = true;
1.26 break;
1.27 - default:
1.28 - showInfos(commands);
1.29 }
1.30 }
1.31 +
1.32 + if (formattinNeeded) {
1.33 + try (Formatter f = getFormatter()) {
1.34 + formatter = f;
1.35 + formatter.writeStartBatch();
1.36 + formatter.writeStartDatabase(new DatabaseDefinition());
1.37 + showInfos(commands);
1.38 + formatter.writeEndDatabase();
1.39 + formatter.writeEndBatch();
1.40 + formatter.close();
1.41 + }
1.42 + } else {
1.43 + showInfos(commands);
1.44 + }
1.45 }
1.46
1.47 private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException {