equal
deleted
inserted
replaced
18 package info.globalcode.sql.dk; |
18 package info.globalcode.sql.dk; |
19 |
19 |
20 import static info.globalcode.sql.dk.Functions.isNotEmpty; |
20 import static info.globalcode.sql.dk.Functions.isNotEmpty; |
21 import static info.globalcode.sql.dk.Functions.isEmpty; |
21 import static info.globalcode.sql.dk.Functions.isEmpty; |
22 import static info.globalcode.sql.dk.Functions.equalz; |
22 import static info.globalcode.sql.dk.Functions.equalz; |
23 import info.globalcode.sql.dk.SQLCommand.COMMAND_TYPE; |
|
24 import java.io.OutputStream; |
23 import java.io.OutputStream; |
25 import java.util.ArrayList; |
24 import java.util.ArrayList; |
26 import java.util.Collection; |
25 import java.util.Collection; |
27 import java.util.EnumSet; |
26 import java.util.EnumSet; |
28 import java.util.List; |
27 import java.util.List; |
57 FORMATTERS, |
56 FORMATTERS, |
58 TYPES, |
57 TYPES, |
59 DATABASES, |
58 DATABASES, |
60 CONNECTION |
59 CONNECTION |
61 } |
60 } |
62 private COMMAND_TYPE commandType; |
|
63 private final List<NamedParameter> namedParameters = new ArrayList<>(); |
61 private final List<NamedParameter> namedParameters = new ArrayList<>(); |
64 private final List<Parameter> numberedParameters = new ArrayList<>(); |
62 private final List<Parameter> numberedParameters = new ArrayList<>(); |
65 private final EnumSet<INFO_TYPE> showInfo = EnumSet.noneOf(INFO_TYPE.class); |
63 private final EnumSet<INFO_TYPE> showInfo = EnumSet.noneOf(INFO_TYPE.class); |
66 |
64 |
67 public void validate() throws InvalidOptionsException { |
65 public void validate() throws InvalidOptionsException { |
151 |
149 |
152 public void setBatch(boolean batch) { |
150 public void setBatch(boolean batch) { |
153 this.batch = batch; |
151 this.batch = batch; |
154 } |
152 } |
155 |
153 |
156 public COMMAND_TYPE getCommandType() { |
|
157 return commandType; |
|
158 } |
|
159 |
|
160 public void setCommandType(COMMAND_TYPE commandType) { |
|
161 this.commandType = commandType; |
|
162 } |
|
163 |
|
164 public Collection<NamedParameter> getNamedParameters() { |
154 public Collection<NamedParameter> getNamedParameters() { |
165 return namedParameters; |
155 return namedParameters; |
166 } |
156 } |
167 |
157 |
168 public List<Parameter> getNumberedParameters() { |
158 public List<Parameter> getNumberedParameters() { |
209 this.databaseNameToTest = databaseNameToTest; |
199 this.databaseNameToTest = databaseNameToTest; |
210 } |
200 } |
211 |
201 |
212 public SQLCommand getSQLCommand() { |
202 public SQLCommand getSQLCommand() { |
213 if (namedParameters.isEmpty()) { |
203 if (namedParameters.isEmpty()) { |
214 return new SQLCommandNumbered(commandType, sql, numberedParameters); |
204 return new SQLCommandNumbered(sql, numberedParameters); |
215 } else { |
205 } else { |
216 return new SQLCommandNamed(commandType, sql, namedParameters); |
206 return new SQLCommandNamed(sql, namedParameters); |
217 } |
207 } |
218 } |
208 } |
219 |
209 |
220 public OutputStream getOutputStream() { |
210 public OutputStream getOutputStream() { |
221 return System.out; |
211 return System.out; |