java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
branchv_0
changeset 101 97b0d9069133
parent 93 5a4dbe6f962c
child 104 245f1b88a3e6
equal deleted inserted replaced
100:de65409a9f26 101:97b0d9069133
    64 				// only these need formatted output
    64 				// only these need formatted output
    65 				case CONNECTION:
    65 				case CONNECTION:
    66 				case DATABASES:
    66 				case DATABASES:
    67 				case FORMATTERS:
    67 				case FORMATTERS:
    68 				case TYPES:
    68 				case TYPES:
    69 					formatter = getFormatter();
    69 					try (Formatter f = getFormatter()) {
    70 					formatter.writeStartBatch();
    70 						formatter = f;
    71 					formatter.writeStartDatabase(new DatabaseDefinition());
    71 						formatter.writeStartBatch();
    72 			}
    72 						formatter.writeStartDatabase(new DatabaseDefinition());
    73 		}
    73 						showInfos(commands);
    74 
    74 						formatter.writeEndDatabase();
       
    75 						formatter.writeEndBatch();
       
    76 						formatter.close();
       
    77 					}
       
    78 					break;
       
    79 				default:
       
    80 					showInfos(commands);
       
    81 			}
       
    82 		}
       
    83 	}
       
    84 
       
    85 	private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException {
    75 		for (InfoType infoType : commands) {
    86 		for (InfoType infoType : commands) {
    76 			infoType.showInfo(this);
    87 			infoType.showInfo(this);
    77 		}
       
    78 
       
    79 		if (formatter != null) {
       
    80 			formatter.writeEndDatabase();
       
    81 			formatter.writeEndBatch();
       
    82 		}
    88 		}
    83 	}
    89 	}
    84 
    90 
    85 	private void listFormatters() throws ConfigurationException, FormatterException {
    91 	private void listFormatters() throws ConfigurationException, FormatterException {
    86 		ColumnsHeader header = constructHeader(
    92 		ColumnsHeader header = constructHeader(