equal
deleted
inserted
replaced
44 public static final String DEFAULT_NAME_PREFIX = ":"; |
44 public static final String DEFAULT_NAME_PREFIX = ":"; |
45 public static final String DEFAULT_NAME_SUFFIX = "(?=([^\\w]|$))"; |
45 public static final String DEFAULT_NAME_SUFFIX = "(?=([^\\w]|$))"; |
46 private String sql; |
46 private String sql; |
47 private String databaseName; |
47 private String databaseName; |
48 private Set<String> databaseNamesToTest = new HashSet<>(); |
48 private Set<String> databaseNamesToTest = new HashSet<>(); |
|
49 private Set<String> databaseNamesToListProperties = new HashSet<>(); |
49 private String namePrefix = DEFAULT_NAME_PREFIX; |
50 private String namePrefix = DEFAULT_NAME_PREFIX; |
50 private String nameSuffix = DEFAULT_NAME_SUFFIX; |
51 private String nameSuffix = DEFAULT_NAME_SUFFIX; |
51 private String formatterName; |
52 private String formatterName; |
52 private boolean batch; |
53 private boolean batch; |
53 private Properties formatterProperties = new Properties(); |
54 private Properties formatterProperties = new Properties(); |
92 if (!equalz(nameSuffix, DEFAULT_NAME_SUFFIX)) { |
93 if (!equalz(nameSuffix, DEFAULT_NAME_SUFFIX)) { |
93 e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify name suffix if just showing info.")); |
94 e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify name suffix if just showing info.")); |
94 } |
95 } |
95 if (showInfo.contains(InfoType.CONNECTION) && databaseNamesToTest.isEmpty()) { |
96 if (showInfo.contains(InfoType.CONNECTION) && databaseNamesToTest.isEmpty()) { |
96 e.addProblem(new InvalidOptionsException.OptionProblem("Please specify which database should be tested.")); |
97 e.addProblem(new InvalidOptionsException.OptionProblem("Please specify which database should be tested.")); |
|
98 } |
|
99 if (showInfo.contains(InfoType.JDBC_PROPERTIES) && databaseNamesToListProperties.isEmpty()) { |
|
100 e.addProblem(new InvalidOptionsException.OptionProblem("Please specify for which database the properties should be listed.")); |
97 } |
101 } |
98 } |
102 } |
99 |
103 |
100 if (!namedParameters.isEmpty() && !numberedParameters.isEmpty()) { |
104 if (!namedParameters.isEmpty() && !numberedParameters.isEmpty()) { |
101 e.addProblem(new InvalidOptionsException.OptionProblem("Named and numbered parameters can not be used together in one command.")); |
105 e.addProblem(new InvalidOptionsException.OptionProblem("Named and numbered parameters can not be used together in one command.")); |
236 |
240 |
237 public Set<String> getDatabaseNamesToTest() { |
241 public Set<String> getDatabaseNamesToTest() { |
238 return databaseNamesToTest; |
242 return databaseNamesToTest; |
239 } |
243 } |
240 |
244 |
241 public void addDatabaseNamesToTest(String databaseNameToTest) { |
245 public void addDatabaseNameToTest(String name) { |
242 this.databaseNamesToTest.add(databaseNameToTest); |
246 databaseNamesToTest.add(name); |
243 } |
247 } |
244 |
248 |
|
249 public Set<String> getDatabaseNamesToListProperties() { |
|
250 return databaseNamesToListProperties; |
|
251 } |
|
252 |
|
253 public void addDatabaseNameToListProperties(String name) { |
|
254 databaseNamesToListProperties.add(name); |
|
255 } |
|
256 |
245 public SQLCommand getSQLCommand() { |
257 public SQLCommand getSQLCommand() { |
246 if (namedParameters.isEmpty()) { |
258 if (namedParameters.isEmpty()) { |
247 return new SQLCommandNumbered(sql, numberedParameters); |
259 return new SQLCommandNumbered(sql, numberedParameters); |
248 } else { |
260 } else { |
249 return new SQLCommandNamed(sql, namedParameters, namePrefix, nameSuffix); |
261 return new SQLCommandNamed(sql, namedParameters, namePrefix, nameSuffix); |