1 |
|
package org.codehaus.mojo.sql; |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
import java.io.BufferedOutputStream; |
17 |
|
import java.io.BufferedReader; |
18 |
|
import java.io.File; |
19 |
|
import java.io.FileInputStream; |
20 |
|
import java.io.FileOutputStream; |
21 |
|
import java.io.FileReader; |
22 |
|
import java.io.IOException; |
23 |
|
import java.io.InputStream; |
24 |
|
import java.io.InputStreamReader; |
25 |
|
import java.io.OutputStream; |
26 |
|
import java.io.PrintStream; |
27 |
|
import java.io.Reader; |
28 |
|
import java.io.StringReader; |
29 |
|
import java.sql.Connection; |
30 |
|
import java.sql.Driver; |
31 |
|
import java.sql.ResultSet; |
32 |
|
import java.sql.ResultSetMetaData; |
33 |
|
import java.sql.SQLException; |
34 |
|
import java.sql.SQLWarning; |
35 |
|
import java.sql.Statement; |
36 |
|
import java.util.ArrayList; |
37 |
|
import java.util.Collections; |
38 |
|
import java.util.Enumeration; |
39 |
|
import java.util.List; |
40 |
|
import java.util.Properties; |
41 |
|
import java.util.StringTokenizer; |
42 |
|
import java.util.Vector; |
43 |
|
|
44 |
|
import org.apache.commons.io.IOUtils; |
45 |
|
import org.apache.commons.lang.StringEscapeUtils; |
46 |
|
import org.apache.maven.execution.MavenSession; |
47 |
|
import org.apache.maven.plugin.AbstractMojo; |
48 |
|
import org.apache.maven.plugin.MojoExecutionException; |
49 |
|
import org.apache.maven.project.MavenProject; |
50 |
|
import org.apache.maven.settings.Server; |
51 |
|
import org.apache.maven.settings.Settings; |
52 |
|
import org.apache.maven.shared.filtering.MavenFileFilter; |
53 |
|
import org.apache.maven.shared.filtering.MavenFileFilterRequest; |
54 |
|
import org.apache.maven.shared.filtering.MavenFilteringException; |
55 |
|
import org.codehaus.plexus.util.FileUtils; |
56 |
|
import org.codehaus.plexus.util.IOUtil; |
57 |
|
import org.codehaus.plexus.util.StringUtils; |
58 |
|
import org.springframework.core.io.DefaultResourceLoader; |
59 |
|
import org.springframework.core.io.Resource; |
60 |
|
import org.springframework.core.io.ResourceLoader; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 0% |
Uncovered Elements: 562 (562) |
Complexity: 167 |
Complexity Density: 0.49 |
|
67 |
|
public class SqlExecMojo extends AbstractMojo { |
68 |
|
|
69 |
|
|
70 |
|
@link |
71 |
|
|
72 |
|
public static final String ON_ERROR_ABORT = "abort"; |
73 |
|
|
74 |
|
|
75 |
|
@link |
76 |
|
|
77 |
|
|
78 |
|
public static final String ON_ERROR_ABORT_AFTER = "abortAfter"; |
79 |
|
|
80 |
|
|
81 |
|
@link |
82 |
|
|
83 |
|
public static final String ON_ERROR_CONTINUE = "continue"; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
@since |
92 |
|
|
93 |
|
|
94 |
|
private String username; |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@since |
101 |
|
|
102 |
|
|
103 |
|
private String password; |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
@since |
110 |
|
|
111 |
|
|
112 |
|
private boolean enableAnonymousPassword; |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@since |
118 |
|
|
119 |
|
|
120 |
|
private String driverProperties; |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
@since |
126 |
|
|
127 |
|
|
128 |
|
private Settings settings; |
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
@since |
135 |
|
|
136 |
|
|
137 |
|
private String settingsKey; |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
@since |
144 |
|
|
145 |
|
|
146 |
|
private boolean skipOnConnectionError; |
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
private boolean forceMojoExecution; |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
protected MavenProject project; |
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
private MavenSession mavenSession; |
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
@since |
179 |
|
|
180 |
|
|
181 |
|
private String sqlCommand = ""; |
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
@since |
187 |
|
|
188 |
|
|
189 |
|
private File[] srcFiles; |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
@since |
195 |
|
|
196 |
|
|
197 |
|
private String[] resourceLocations; |
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
@since |
203 |
|
|
204 |
|
|
205 |
|
private Fileset fileset; |
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
@since |
211 |
|
|
212 |
|
|
213 |
|
private boolean skip; |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
@since |
222 |
|
|
223 |
|
private String url; |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
@since |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
private String driver; |
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
@since |
239 |
|
|
240 |
|
|
241 |
|
private boolean autocommit; |
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
@since |
247 |
|
|
248 |
|
|
249 |
|
private String onError = ON_ERROR_ABORT; |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
@since |
257 |
|
|
258 |
|
|
259 |
|
private String delimiter = ";"; |
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
@since |
272 |
|
|
273 |
|
|
274 |
|
private String delimiterType = DelimiterType.NORMAL; |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
@since |
281 |
|
|
282 |
|
|
283 |
|
private Order orderFile; |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
@deprecated |
291 |
|
@since |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
@Deprecated |
296 |
|
private boolean enableBlockMode = false; |
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
@since |
302 |
|
|
303 |
|
|
304 |
|
private boolean keepFormat = false; |
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
|
310 |
|
|
311 |
|
@since |
312 |
|
|
313 |
|
private boolean printResultSet = false; |
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
private boolean showheaders = true; |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
|
324 |
|
@since |
325 |
|
|
326 |
|
private File outputFile; |
327 |
|
|
328 |
|
|
329 |
|
|
330 |
|
@since |
331 |
|
|
332 |
|
private String outputDelimiter; |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
@since |
339 |
|
|
340 |
|
private String encoding = ""; |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
|
private boolean append = false; |
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
@since |
352 |
|
|
353 |
|
|
354 |
|
private boolean escapeProcessing = true; |
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
private int successfulStatements = 0; |
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
private int totalStatements = 0; |
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
private Connection conn = null; |
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
377 |
|
private Statement statement = null; |
378 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
private Vector<Transaction> transactions = new Vector<Transaction>(); |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
@since |
387 |
|
|
388 |
|
private MavenFileFilter fileFilter; |
389 |
|
|
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
@since |
395 |
|
|
396 |
|
private boolean enableFiltering; |
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
@since |
404 |
|
|
405 |
|
private boolean executeTrailingSQL; |
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
@return |
417 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
418 |
0
|
public Transaction createTransaction() {... |
419 |
0
|
Transaction t = new Transaction(); |
420 |
0
|
transactions.addElement(t); |
421 |
0
|
return t; |
422 |
|
} |
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
@param |
428 |
|
|
429 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
430 |
0
|
public void addText(String sql) {... |
431 |
0
|
this.sqlCommand += sql; |
432 |
|
} |
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
|
@param |
438 |
|
|
439 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
440 |
0
|
public void setEncoding(String encoding) {... |
441 |
0
|
this.encoding = encoding; |
442 |
|
} |
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
@param |
448 |
|
|
449 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
450 |
0
|
public void setDelimiter(String delimiter) {... |
451 |
0
|
this.delimiter = delimiter; |
452 |
|
} |
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
|
@param |
458 |
|
|
459 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
460 |
0
|
public void setDelimiterType(String delimiterType) {... |
461 |
0
|
this.delimiterType = delimiterType; |
462 |
|
} |
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
@param |
468 |
|
|
469 |
|
@deprecated |
470 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
471 |
0
|
@Deprecated... |
472 |
|
public void setPrintResutlSet(boolean print) { |
473 |
0
|
setPrintResultSet(print); |
474 |
|
} |
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
@param |
480 |
|
|
481 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
482 |
0
|
public void setPrintResultSet(boolean print) {... |
483 |
0
|
this.printResultSet = print; |
484 |
|
} |
485 |
|
|
486 |
|
|
487 |
|
|
488 |
|
|
489 |
|
@param |
490 |
|
|
491 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
492 |
0
|
public void setShowheaders(boolean showheaders) {... |
493 |
0
|
this.showheaders = showheaders; |
494 |
|
} |
495 |
|
|
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
@param |
500 |
|
|
501 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
502 |
0
|
public void setOutputFile(File output) {... |
503 |
0
|
this.outputFile = output; |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
@param |
510 |
|
|
511 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
512 |
0
|
public void setAppend(boolean append) {... |
513 |
0
|
this.append = append; |
514 |
|
} |
515 |
|
|
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
@param |
520 |
|
|
521 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
522 |
0
|
public void setKeepFormat(boolean keepformat) {... |
523 |
0
|
this.keepFormat = keepformat; |
524 |
|
} |
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
|
529 |
|
@param |
530 |
|
|
531 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
532 |
0
|
public void setEscapeProcessing(boolean enable) {... |
533 |
0
|
escapeProcessing = enable; |
534 |
|
} |
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
@link |
543 |
|
@link |
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
@return |
548 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
549 |
0
|
protected boolean skipMojo() {... |
550 |
0
|
if (skip) { |
551 |
0
|
getLog().info("Skip sql execution"); |
552 |
0
|
return true; |
553 |
|
} |
554 |
|
|
555 |
0
|
if (!forceMojoExecution && project != null && "pom".equals(project.getPackaging())) { |
556 |
0
|
getLog().info("Skipping sql execution for project with packaging type 'pom'"); |
557 |
0
|
return true; |
558 |
|
} |
559 |
|
|
560 |
0
|
return false; |
561 |
|
} |
562 |
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
@throws |
567 |
|
|
|
|
| 0% |
Uncovered Elements: 64 (64) |
Complexity: 20 |
Complexity Density: 0.45 |
|
568 |
0
|
@Override... |
569 |
|
public void execute() throws MojoExecutionException { |
570 |
|
|
571 |
0
|
if (skipMojo()) { |
572 |
0
|
return; |
573 |
|
} |
574 |
|
|
575 |
0
|
successfulStatements = 0; |
576 |
|
|
577 |
0
|
totalStatements = 0; |
578 |
|
|
579 |
0
|
loadUserInfoFromSettings(); |
580 |
|
|
581 |
0
|
addCommandToTransactions(); |
582 |
|
|
583 |
0
|
addFilesToTransactions(); |
584 |
|
|
585 |
0
|
addFileSetToTransactions(); |
586 |
|
|
587 |
0
|
addResourcesToTransactions(); |
588 |
|
|
589 |
0
|
sortTransactions(); |
590 |
|
|
591 |
0
|
try { |
592 |
0
|
conn = getConnection(); |
593 |
|
} catch (SQLException e) { |
594 |
0
|
if (!this.skipOnConnectionError) { |
595 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
596 |
|
} else { |
597 |
|
|
598 |
0
|
return; |
599 |
|
} |
600 |
|
} |
601 |
|
|
602 |
0
|
try { |
603 |
0
|
statement = conn.createStatement(); |
604 |
0
|
statement.setEscapeProcessing(escapeProcessing); |
605 |
|
|
606 |
0
|
PrintStream out = System.out; |
607 |
0
|
try { |
608 |
0
|
if (outputFile != null) { |
609 |
0
|
getLog().debug("Opening PrintStream to output file " + outputFile); |
610 |
0
|
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile.getAbsolutePath(), |
611 |
|
append))); |
612 |
|
} |
613 |
|
|
614 |
|
|
615 |
0
|
for (Enumeration<Transaction> e = transactions.elements(); e.hasMoreElements();) { |
616 |
0
|
Transaction t = e.nextElement(); |
617 |
|
|
618 |
0
|
t.runTransaction(out); |
619 |
|
|
620 |
0
|
if (!autocommit) { |
621 |
0
|
getLog().debug("Committing transaction"); |
622 |
0
|
conn.commit(); |
623 |
|
} |
624 |
|
} |
625 |
|
} finally { |
626 |
0
|
if (out != null && out != System.out) { |
627 |
0
|
out.close(); |
628 |
|
} |
629 |
|
} |
630 |
|
} catch (IOException e) { |
631 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
632 |
|
} catch (SQLException e) { |
633 |
0
|
if (!autocommit && conn != null && ON_ERROR_ABORT.equalsIgnoreCase(getOnError())) { |
634 |
0
|
try { |
635 |
0
|
conn.rollback(); |
636 |
|
} catch (SQLException ex) { |
637 |
|
|
638 |
|
} |
639 |
|
} |
640 |
0
|
throw new MojoExecutionException(e.getMessage(), e); |
641 |
|
} finally { |
642 |
0
|
try { |
643 |
0
|
if (statement != null) { |
644 |
0
|
statement.close(); |
645 |
|
} |
646 |
0
|
if (conn != null) { |
647 |
0
|
conn.close(); |
648 |
|
} |
649 |
|
} catch (SQLException ex) { |
650 |
|
|
651 |
|
} |
652 |
|
} |
653 |
|
|
654 |
0
|
getLog().info( |
655 |
|
getSuccessfulStatements() + " of " + getTotalStatements() + " SQL statements executed successfully"); |
656 |
|
|
657 |
0
|
if (ON_ERROR_ABORT_AFTER.equalsIgnoreCase(getOnError()) && totalStatements != successfulStatements) { |
658 |
0
|
throw new MojoExecutionException("Some SQL statements failed to execute"); |
659 |
|
} |
660 |
|
|
661 |
|
} |
662 |
|
|
663 |
|
|
664 |
|
|
665 |
|
|
666 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
667 |
0
|
private void addCommandToTransactions() {... |
668 |
0
|
createTransaction().addText(sqlCommand.trim()); |
669 |
|
} |
670 |
|
|
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
675 |
0
|
private void addFileSetToTransactions() {... |
676 |
0
|
String[] includedFiles; |
677 |
0
|
if (fileset != null) { |
678 |
0
|
fileset.scan(); |
679 |
0
|
includedFiles = fileset.getIncludedFiles(); |
680 |
|
} else { |
681 |
0
|
includedFiles = new String[0]; |
682 |
|
} |
683 |
|
|
684 |
0
|
for (int j = 0; j < includedFiles.length; j++) { |
685 |
0
|
createTransaction().setSrc(new File(fileset.getBasedir(), includedFiles[j])); |
686 |
|
} |
687 |
|
} |
688 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
689 |
0
|
protected Resource[] getResources(String[] locations) throws MojoExecutionException {... |
690 |
0
|
if (locations == null || locations.length == 0) { |
691 |
0
|
return new Resource[] {}; |
692 |
|
} |
693 |
0
|
ResourceLoader loader = new DefaultResourceLoader(); |
694 |
0
|
List<Resource> resources = new ArrayList<Resource>(); |
695 |
0
|
for (int i = 0; i < locations.length; i++) { |
696 |
0
|
String location = locations[i]; |
697 |
|
|
698 |
0
|
if (StringUtils.isEmpty(location)) { |
699 |
0
|
continue; |
700 |
|
} |
701 |
0
|
Resource resource = loader.getResource(location); |
702 |
0
|
if (!resource.exists()) { |
703 |
|
|
704 |
0
|
throw new MojoExecutionException("Resource " + location + " was not found"); |
705 |
|
} |
706 |
0
|
resources.add(resource); |
707 |
|
} |
708 |
0
|
return resources.toArray(new Resource[resources.size()]); |
709 |
|
} |
710 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
711 |
0
|
protected void copy(Resource resource, File file) throws IOException {... |
712 |
0
|
InputStream in = resource.getInputStream(); |
713 |
0
|
OutputStream out = new FileOutputStream(file); |
714 |
0
|
IOUtils.copyLarge(in, out); |
715 |
|
} |
716 |
|
|
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
@throws |
721 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 8 |
Complexity Density: 0.25 |
|
722 |
0
|
private void addResourcesToTransactions() throws MojoExecutionException {... |
723 |
0
|
String[] locations = getResourceLocations(); |
724 |
0
|
Resource[] resources = getResources(locations); |
725 |
|
|
726 |
0
|
MavenFileFilterRequest request = new MavenFileFilterRequest(); |
727 |
0
|
request.setEncoding(encoding); |
728 |
0
|
request.setMavenSession(mavenSession); |
729 |
0
|
request.setMavenProject(project); |
730 |
0
|
request.setFiltering(enableFiltering); |
731 |
0
|
for (int i = 0; i < resources.length; i++) { |
732 |
0
|
Resource resource = resources[i]; |
733 |
0
|
String filename = resource.getFilename(); |
734 |
0
|
String basename = FileUtils.basename(filename); |
735 |
0
|
String extension = FileUtils.extension(filename); |
736 |
0
|
if (!extension.startsWith(".")) { |
737 |
0
|
extension = "." + extension; |
738 |
|
} |
739 |
0
|
File sourceFile = FileUtils.createTempFile(basename, extension, null); |
740 |
0
|
if (!getLog().isDebugEnabled()) { |
741 |
0
|
sourceFile.deleteOnExit(); |
742 |
|
} |
743 |
|
|
744 |
0
|
try { |
745 |
0
|
copy(resource, sourceFile); |
746 |
|
} catch (IOException e) { |
747 |
0
|
throw new MojoExecutionException("Error copying resource " + resource + " to a local temporary file", e); |
748 |
|
} |
749 |
|
|
750 |
0
|
if (!enableFiltering) { |
751 |
0
|
createTransaction().setSrc(sourceFile); |
752 |
0
|
continue; |
753 |
|
} |
754 |
|
|
755 |
0
|
File targetFile = FileUtils.createTempFile(basename, extension, null); |
756 |
0
|
if (!getLog().isDebugEnabled()) { |
757 |
0
|
sourceFile.deleteOnExit(); |
758 |
|
} |
759 |
|
|
760 |
0
|
request.setFrom(sourceFile); |
761 |
0
|
request.setTo(targetFile); |
762 |
|
|
763 |
0
|
try { |
764 |
0
|
fileFilter.copyFile(request); |
765 |
|
} catch (MavenFilteringException e) { |
766 |
0
|
throw new MojoExecutionException(e.getMessage()); |
767 |
|
} |
768 |
|
|
769 |
0
|
createTransaction().setSrc(targetFile); |
770 |
|
} |
771 |
|
} |
772 |
|
|
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
@throws |
777 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 9 |
Complexity Density: 0.35 |
|
778 |
0
|
private void addFilesToTransactions() throws MojoExecutionException {... |
779 |
0
|
File[] files = getSrcFiles(); |
780 |
|
|
781 |
0
|
MavenFileFilterRequest request = new MavenFileFilterRequest(); |
782 |
0
|
request.setEncoding(encoding); |
783 |
0
|
request.setMavenSession(mavenSession); |
784 |
0
|
request.setMavenProject(project); |
785 |
0
|
request.setFiltering(enableFiltering); |
786 |
0
|
for (int i = 0; files != null && i < files.length; ++i) { |
787 |
0
|
if (files[i] != null && !files[i].exists()) { |
788 |
0
|
throw new MojoExecutionException(files[i].getPath() + " not found."); |
789 |
|
} |
790 |
|
|
791 |
0
|
if (!enableFiltering) { |
792 |
0
|
createTransaction().setSrc(files[i]); |
793 |
0
|
continue; |
794 |
|
} |
795 |
|
|
796 |
0
|
File sourceFile = files[i]; |
797 |
0
|
String basename = FileUtils.basename(sourceFile.getName()); |
798 |
0
|
String extension = FileUtils.extension(sourceFile.getName()); |
799 |
0
|
if (!extension.startsWith(".")) { |
800 |
0
|
extension = "." + extension; |
801 |
|
} |
802 |
0
|
File targetFile = FileUtils.createTempFile(basename, extension, null); |
803 |
0
|
if (!getLog().isDebugEnabled()) { |
804 |
0
|
targetFile.deleteOnExit(); |
805 |
|
} |
806 |
|
|
807 |
0
|
request.setFrom(sourceFile); |
808 |
0
|
request.setTo(targetFile); |
809 |
|
|
810 |
0
|
try { |
811 |
0
|
fileFilter.copyFile(request); |
812 |
|
} catch (MavenFilteringException e) { |
813 |
0
|
throw new MojoExecutionException(e.getMessage()); |
814 |
|
} |
815 |
|
|
816 |
0
|
createTransaction().setSrc(targetFile); |
817 |
|
} |
818 |
|
} |
819 |
|
|
820 |
|
|
821 |
|
|
822 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.36 |
|
823 |
0
|
protected void sortTransactions() {... |
824 |
0
|
switch (orderFile) { |
825 |
0
|
case ASCENDING: |
826 |
0
|
Collections.sort(transactions); |
827 |
0
|
break; |
828 |
0
|
case DESCENDING: |
829 |
0
|
Collections.sort(transactions, Collections.reverseOrder()); |
830 |
0
|
break; |
831 |
0
|
case NONE: |
832 |
0
|
break; |
833 |
0
|
default: |
834 |
0
|
throw new RuntimeException("Unknown value for orderFile: " + orderFile); |
835 |
|
} |
836 |
|
} |
837 |
|
|
838 |
|
|
839 |
|
|
840 |
|
|
841 |
|
@throws |
842 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 10 |
Complexity Density: 0.77 |
|
843 |
0
|
private void loadUserInfoFromSettings() throws MojoExecutionException {... |
844 |
0
|
if (this.settingsKey == null) { |
845 |
0
|
this.settingsKey = getUrl(); |
846 |
|
} |
847 |
|
|
848 |
0
|
if ((getUsername() == null || getPassword() == null) && (settings != null)) { |
849 |
0
|
Server server = this.settings.getServer(this.settingsKey); |
850 |
|
|
851 |
0
|
if (server != null) { |
852 |
0
|
if (getUsername() == null) { |
853 |
0
|
setUsername(server.getUsername()); |
854 |
|
} |
855 |
|
|
856 |
0
|
if (getPassword() == null) { |
857 |
0
|
setPassword(server.getPassword()); |
858 |
|
} |
859 |
|
} |
860 |
|
} |
861 |
|
|
862 |
0
|
if (getUsername() == null) { |
863 |
|
|
864 |
0
|
setUsername(""); |
865 |
|
} |
866 |
|
|
867 |
0
|
if (getPassword() == null) { |
868 |
|
|
869 |
0
|
setPassword(""); |
870 |
|
} |
871 |
|
} |
872 |
|
|
873 |
|
|
874 |
|
|
875 |
|
|
876 |
|
|
877 |
|
|
878 |
|
@return |
879 |
|
@throws |
880 |
|
|
881 |
|
@throws |
882 |
|
|
883 |
|
|
884 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.29 |
|
885 |
0
|
private Connection getConnection() throws MojoExecutionException, SQLException {... |
886 |
0
|
getLog().debug("connecting to " + getUrl()); |
887 |
0
|
Properties info = new Properties(); |
888 |
0
|
info.put("user", getUsername()); |
889 |
|
|
890 |
0
|
if (!enableAnonymousPassword) { |
891 |
0
|
info.put("password", getPassword()); |
892 |
|
} |
893 |
|
|
894 |
0
|
info.putAll(this.getDriverProperties()); |
895 |
|
|
896 |
0
|
Driver driverInstance = null; |
897 |
|
|
898 |
0
|
try { |
899 |
0
|
Class<?> dc = Class.forName(getDriver()); |
900 |
0
|
driverInstance = (Driver) dc.newInstance(); |
901 |
|
} catch (ClassNotFoundException e) { |
902 |
0
|
throw new MojoExecutionException("Driver class not found: " + getDriver(), e); |
903 |
|
} catch (Exception e) { |
904 |
0
|
throw new MojoExecutionException("Failure loading driver: " + getDriver(), e); |
905 |
|
} |
906 |
|
|
907 |
0
|
Connection conn = driverInstance.connect(getUrl(), info); |
908 |
|
|
909 |
0
|
if (conn == null) { |
910 |
|
|
911 |
0
|
throw new SQLException("No suitable Driver for " + getUrl()); |
912 |
|
} |
913 |
|
|
914 |
0
|
conn.setAutoCommit(autocommit); |
915 |
0
|
return conn; |
916 |
|
} |
917 |
|
|
918 |
|
|
919 |
|
|
920 |
|
|
921 |
|
@return |
922 |
|
@throws |
923 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
924 |
0
|
protected Properties getDriverProperties() throws MojoExecutionException {... |
925 |
0
|
Properties properties = new Properties(); |
926 |
|
|
927 |
0
|
if (!StringUtils.isEmpty(this.driverProperties)) { |
928 |
0
|
String[] tokens = StringUtils.split(this.driverProperties, ","); |
929 |
0
|
for (int i = 0; i < tokens.length; ++i) { |
930 |
0
|
String[] keyValueTokens = StringUtils.split(tokens[i].trim(), "="); |
931 |
0
|
if (keyValueTokens.length != 2) { |
932 |
0
|
throw new MojoExecutionException("Invalid JDBC Driver properties: " + this.driverProperties); |
933 |
|
} |
934 |
|
|
935 |
0
|
properties.setProperty(keyValueTokens[0], keyValueTokens[1]); |
936 |
|
|
937 |
|
} |
938 |
|
} |
939 |
|
|
940 |
0
|
return properties; |
941 |
|
} |
942 |
|
|
943 |
|
|
944 |
|
|
945 |
|
|
946 |
|
@param |
947 |
|
|
948 |
|
@param |
949 |
|
|
950 |
|
@throws |
951 |
|
@throws |
952 |
|
|
|
|
| 0% |
Uncovered Elements: 58 (58) |
Complexity: 15 |
Complexity Density: 0.47 |
|
953 |
0
|
private void runStatements(Reader reader, PrintStream out) throws SQLException, IOException {... |
954 |
0
|
String line; |
955 |
|
|
956 |
0
|
if (enableBlockMode) { |
957 |
|
|
958 |
|
|
959 |
0
|
line = IOUtil.toString(reader); |
960 |
0
|
execSQL(line, out); |
961 |
0
|
return; |
962 |
|
} |
963 |
|
|
964 |
0
|
StringBuffer sql = new StringBuffer(); |
965 |
|
|
966 |
0
|
BufferedReader in = new BufferedReader(reader); |
967 |
|
|
968 |
0
|
while ((line = in.readLine()) != null) { |
969 |
0
|
getLog().debug("line='" + line + "'"); |
970 |
0
|
if (!keepFormat) { |
971 |
0
|
line = line.trim(); |
972 |
|
} |
973 |
|
|
974 |
0
|
if (!keepFormat) { |
975 |
0
|
if (line.startsWith("//")) { |
976 |
0
|
continue; |
977 |
|
} |
978 |
0
|
if (line.startsWith("--")) { |
979 |
0
|
continue; |
980 |
|
} |
981 |
0
|
StringTokenizer st = new StringTokenizer(line); |
982 |
0
|
if (st.hasMoreTokens()) { |
983 |
0
|
String token = st.nextToken(); |
984 |
0
|
if ("REM".equalsIgnoreCase(token)) { |
985 |
0
|
continue; |
986 |
|
} |
987 |
|
} |
988 |
|
} |
989 |
|
|
990 |
0
|
if (!keepFormat) { |
991 |
0
|
sql.append(" ").append(line); |
992 |
|
} else { |
993 |
0
|
sql.append("\n").append(line); |
994 |
|
} |
995 |
|
|
996 |
|
|
997 |
|
|
998 |
|
|
999 |
0
|
if (!keepFormat) { |
1000 |
0
|
if (SqlSplitter.containsSqlEnd(line, delimiter) == SqlSplitter.NO_END) { |
1001 |
0
|
sql.append("\n"); |
1002 |
|
} |
1003 |
|
} |
1004 |
|
|
1005 |
0
|
if (isEnd(line)) { |
1006 |
0
|
execSQL(sql.substring(0, sql.length() - delimiter.length()), out); |
1007 |
0
|
sql.setLength(0); |
1008 |
|
} |
1009 |
|
} |
1010 |
|
|
1011 |
|
|
1012 |
0
|
if (executeTrailingSQL && !sql.toString().equals("")) { |
1013 |
0
|
execSQL(sql.toString(), out); |
1014 |
|
} |
1015 |
|
} |
1016 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1017 |
0
|
protected boolean isEnd(String line) {... |
1018 |
0
|
if (delimiterType.equals(DelimiterType.ROW)) { |
1019 |
0
|
return line.trim().equals(delimiter); |
1020 |
|
} |
1021 |
0
|
int pos = SqlSplitter.containsSqlEnd(line, delimiter); |
1022 |
0
|
if (delimiterType.equals(DelimiterType.NORMAL) && pos > 0) { |
1023 |
0
|
return true; |
1024 |
|
} |
1025 |
0
|
return false; |
1026 |
|
} |
1027 |
|
|
1028 |
|
|
1029 |
|
|
1030 |
|
|
1031 |
|
@param |
1032 |
|
|
1033 |
|
@param |
1034 |
|
|
1035 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 11 |
Complexity Density: 0.31 |
|
1036 |
0
|
private void execSQL(String sql, PrintStream out) throws SQLException {... |
1037 |
|
|
1038 |
0
|
if ("".equals(sql.trim())) { |
1039 |
0
|
return; |
1040 |
|
} |
1041 |
|
|
1042 |
0
|
ResultSet resultSet = null; |
1043 |
0
|
try { |
1044 |
0
|
totalStatements++; |
1045 |
0
|
getLog().debug("SQL: " + sql); |
1046 |
|
|
1047 |
0
|
boolean ret; |
1048 |
0
|
int updateCountTotal = 0; |
1049 |
|
|
1050 |
0
|
ret = statement.execute(sql); |
1051 |
0
|
do { |
1052 |
0
|
if (!ret) { |
1053 |
0
|
int updateCount = statement.getUpdateCount(); |
1054 |
0
|
if (updateCount != -1) { |
1055 |
0
|
updateCountTotal += updateCount; |
1056 |
|
} |
1057 |
|
} else { |
1058 |
0
|
resultSet = statement.getResultSet(); |
1059 |
0
|
if (printResultSet) { |
1060 |
0
|
printResultSet(resultSet, out); |
1061 |
|
} |
1062 |
|
} |
1063 |
0
|
ret = statement.getMoreResults(); |
1064 |
0
|
} while (ret); |
1065 |
|
|
1066 |
0
|
getLog().debug(updateCountTotal + " rows affected"); |
1067 |
|
|
1068 |
0
|
if (printResultSet) { |
1069 |
0
|
StringBuffer line = new StringBuffer(); |
1070 |
0
|
line.append(updateCountTotal).append(" rows affected"); |
1071 |
0
|
out.println(line); |
1072 |
|
} |
1073 |
|
|
1074 |
0
|
SQLWarning warning = conn.getWarnings(); |
1075 |
0
|
while (warning != null) { |
1076 |
0
|
getLog().debug(warning + " sql warning"); |
1077 |
0
|
warning = warning.getNextWarning(); |
1078 |
|
} |
1079 |
0
|
conn.clearWarnings(); |
1080 |
0
|
successfulStatements++; |
1081 |
|
} catch (SQLException e) { |
1082 |
0
|
getLog().error("Failed to execute: " + sql); |
1083 |
0
|
if (ON_ERROR_ABORT.equalsIgnoreCase(getOnError())) { |
1084 |
0
|
throw e; |
1085 |
|
} |
1086 |
0
|
getLog().error(e.toString()); |
1087 |
|
} finally { |
1088 |
0
|
if (resultSet != null) { |
1089 |
0
|
resultSet.close(); |
1090 |
|
} |
1091 |
|
} |
1092 |
|
} |
1093 |
|
|
1094 |
|
|
1095 |
|
|
1096 |
|
|
1097 |
|
@param |
1098 |
|
|
1099 |
|
@param |
1100 |
|
|
1101 |
|
@throws |
1102 |
|
|
1103 |
|
|
|
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 12 |
Complexity Density: 0.35 |
|
1104 |
0
|
private void printResultSet(ResultSet rs, PrintStream out) throws SQLException {... |
1105 |
0
|
if (rs != null) { |
1106 |
0
|
getLog().debug("Processing new result set."); |
1107 |
0
|
ResultSetMetaData md = rs.getMetaData(); |
1108 |
0
|
int columnCount = md.getColumnCount(); |
1109 |
0
|
StringBuffer line = new StringBuffer(); |
1110 |
0
|
if (showheaders) { |
1111 |
0
|
boolean first = true; |
1112 |
0
|
for (int col = 1; col <= columnCount; col++) { |
1113 |
0
|
String columnValue = md.getColumnName(col); |
1114 |
|
|
1115 |
0
|
if (columnValue != null) { |
1116 |
0
|
columnValue = columnValue.trim(); |
1117 |
|
|
1118 |
0
|
if (",".equals(outputDelimiter)) { |
1119 |
0
|
columnValue = StringEscapeUtils.escapeCsv(columnValue); |
1120 |
|
} |
1121 |
|
} |
1122 |
|
|
1123 |
0
|
if (first) { |
1124 |
0
|
first = false; |
1125 |
|
} else { |
1126 |
0
|
line.append(outputDelimiter); |
1127 |
|
} |
1128 |
0
|
line.append(columnValue); |
1129 |
|
} |
1130 |
0
|
out.println(line); |
1131 |
0
|
line = new StringBuffer(); |
1132 |
|
} |
1133 |
0
|
while (rs.next()) { |
1134 |
0
|
boolean first = true; |
1135 |
0
|
for (int col = 1; col <= columnCount; col++) { |
1136 |
0
|
String columnValue = rs.getString(col); |
1137 |
0
|
if (columnValue != null) { |
1138 |
0
|
columnValue = columnValue.trim(); |
1139 |
|
|
1140 |
0
|
if (",".equals(outputDelimiter)) { |
1141 |
0
|
columnValue = StringEscapeUtils.escapeCsv(columnValue); |
1142 |
|
} |
1143 |
|
} |
1144 |
|
|
1145 |
0
|
if (first) { |
1146 |
0
|
first = false; |
1147 |
|
} else { |
1148 |
0
|
line.append(outputDelimiter); |
1149 |
|
} |
1150 |
0
|
line.append(columnValue); |
1151 |
|
} |
1152 |
0
|
out.println(line); |
1153 |
0
|
line = new StringBuffer(); |
1154 |
|
} |
1155 |
|
} |
1156 |
0
|
out.println(); |
1157 |
|
} |
1158 |
|
|
1159 |
|
|
1160 |
|
|
1161 |
|
|
1162 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 10 |
Complexity Density: 0.48 |
|
1163 |
|
private class Transaction implements Comparable<Transaction> { |
1164 |
|
private File tSrcFile = null; |
1165 |
|
|
1166 |
|
private String tSqlCommand = ""; |
1167 |
|
|
1168 |
|
|
1169 |
|
|
1170 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1171 |
0
|
public void setSrc(File src) {... |
1172 |
0
|
this.tSrcFile = src; |
1173 |
|
} |
1174 |
|
|
1175 |
|
|
1176 |
|
|
1177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1178 |
0
|
public void addText(String sql) {... |
1179 |
0
|
this.tSqlCommand += sql; |
1180 |
|
} |
1181 |
|
|
1182 |
|
|
1183 |
|
|
1184 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1185 |
0
|
private void runTransaction(PrintStream out) throws IOException, SQLException {... |
1186 |
0
|
if (tSqlCommand.length() != 0) { |
1187 |
0
|
getLog().info("Executing commands"); |
1188 |
|
|
1189 |
0
|
runStatements(new StringReader(tSqlCommand), out); |
1190 |
|
} |
1191 |
|
|
1192 |
0
|
if (tSrcFile != null) { |
1193 |
0
|
getLog().info("Executing file: " + tSrcFile.getAbsolutePath()); |
1194 |
|
|
1195 |
0
|
Reader reader = null; |
1196 |
|
|
1197 |
0
|
if (StringUtils.isEmpty(encoding)) { |
1198 |
0
|
reader = new FileReader(tSrcFile); |
1199 |
|
} else { |
1200 |
0
|
reader = new InputStreamReader(new FileInputStream(tSrcFile), encoding); |
1201 |
|
} |
1202 |
|
|
1203 |
0
|
try { |
1204 |
0
|
runStatements(reader, out); |
1205 |
|
} finally { |
1206 |
0
|
reader.close(); |
1207 |
|
} |
1208 |
|
} |
1209 |
|
} |
1210 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1211 |
0
|
@Override... |
1212 |
|
public int compareTo(Transaction transaction) { |
1213 |
|
|
1214 |
0
|
if (transaction.tSrcFile == null) { |
1215 |
0
|
if (this.tSrcFile == null) { |
1216 |
0
|
return 0; |
1217 |
|
} else { |
1218 |
0
|
return Integer.MAX_VALUE; |
1219 |
|
} |
1220 |
|
} else { |
1221 |
0
|
if (this.tSrcFile == null) { |
1222 |
0
|
return Integer.MIN_VALUE; |
1223 |
|
} else { |
1224 |
0
|
return this.tSrcFile.compareTo(transaction.tSrcFile); |
1225 |
|
} |
1226 |
|
} |
1227 |
|
} |
1228 |
|
} |
1229 |
|
|
1230 |
|
|
1231 |
|
|
1232 |
|
|
1233 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1234 |
0
|
public String getUsername() {... |
1235 |
0
|
return this.username; |
1236 |
|
} |
1237 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1238 |
0
|
public void setUsername(String username) {... |
1239 |
0
|
this.username = username; |
1240 |
|
} |
1241 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1242 |
0
|
public String getPassword() {... |
1243 |
0
|
return this.password; |
1244 |
|
} |
1245 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1246 |
0
|
public void setPassword(String password) {... |
1247 |
0
|
this.password = password; |
1248 |
|
} |
1249 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1250 |
0
|
public String getUrl() {... |
1251 |
0
|
return this.url; |
1252 |
|
} |
1253 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1254 |
0
|
public void setUrl(String url) {... |
1255 |
0
|
this.url = url; |
1256 |
|
} |
1257 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1258 |
0
|
public String getDriver() {... |
1259 |
0
|
return this.driver; |
1260 |
|
} |
1261 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1262 |
0
|
public void setDriver(String driver) {... |
1263 |
0
|
this.driver = driver; |
1264 |
|
} |
1265 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1266 |
0
|
void setAutocommit(boolean autocommit) {... |
1267 |
0
|
this.autocommit = autocommit; |
1268 |
|
} |
1269 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1270 |
0
|
void setFileset(Fileset fileset) {... |
1271 |
0
|
this.fileset = fileset; |
1272 |
|
} |
1273 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1274 |
0
|
public File[] getSrcFiles() {... |
1275 |
0
|
return this.srcFiles; |
1276 |
|
} |
1277 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1278 |
0
|
public void setSrcFiles(File[] files) {... |
1279 |
0
|
this.srcFiles = files; |
1280 |
|
} |
1281 |
|
|
1282 |
|
|
1283 |
|
@deprecated@link |
1284 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1285 |
0
|
@Deprecated... |
1286 |
|
int getGoodSqls() { |
1287 |
0
|
return this.getSuccessfulStatements(); |
1288 |
|
} |
1289 |
|
|
1290 |
|
|
1291 |
|
|
1292 |
|
|
1293 |
|
@return |
1294 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1295 |
0
|
public int getSuccessfulStatements() {... |
1296 |
0
|
return successfulStatements; |
1297 |
|
} |
1298 |
|
|
1299 |
|
|
1300 |
|
|
1301 |
|
|
1302 |
|
@return |
1303 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1304 |
0
|
public int getTotalStatements() {... |
1305 |
0
|
return totalStatements; |
1306 |
|
} |
1307 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1308 |
0
|
public String getOnError() {... |
1309 |
0
|
return this.onError; |
1310 |
|
} |
1311 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1312 |
0
|
public void setOnError(String action) {... |
1313 |
0
|
if (ON_ERROR_ABORT.equalsIgnoreCase(action)) { |
1314 |
0
|
this.onError = ON_ERROR_ABORT; |
1315 |
0
|
} else if (ON_ERROR_CONTINUE.equalsIgnoreCase(action)) { |
1316 |
0
|
this.onError = ON_ERROR_CONTINUE; |
1317 |
0
|
} else if (ON_ERROR_ABORT_AFTER.equalsIgnoreCase(action)) { |
1318 |
0
|
this.onError = ON_ERROR_ABORT_AFTER; |
1319 |
|
} else { |
1320 |
0
|
throw new IllegalArgumentException(action + " is not a valid value for onError, only '" + ON_ERROR_ABORT |
1321 |
|
+ "', '" + ON_ERROR_ABORT_AFTER + "', or '" + ON_ERROR_CONTINUE + "'."); |
1322 |
|
} |
1323 |
|
} |
1324 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1325 |
0
|
void setSettings(Settings settings) {... |
1326 |
0
|
this.settings = settings; |
1327 |
|
} |
1328 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1329 |
0
|
void setSettingsKey(String key) {... |
1330 |
0
|
this.settingsKey = key; |
1331 |
|
} |
1332 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1333 |
0
|
void setSkip(boolean skip) {... |
1334 |
0
|
this.skip = skip; |
1335 |
|
} |
1336 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1337 |
0
|
public void setDriverProperties(String driverProperties) {... |
1338 |
0
|
this.driverProperties = driverProperties; |
1339 |
|
} |
1340 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1341 |
0
|
public boolean isEnableBlockMode() {... |
1342 |
0
|
return enableBlockMode; |
1343 |
|
} |
1344 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1345 |
0
|
public void setEnableBlockMode(boolean enableBlockMode) {... |
1346 |
0
|
this.enableBlockMode = enableBlockMode; |
1347 |
|
} |
1348 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1349 |
0
|
public String getSqlCommand() {... |
1350 |
0
|
return sqlCommand; |
1351 |
|
} |
1352 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1353 |
0
|
public void setSqlCommand(String sqlCommand) {... |
1354 |
0
|
this.sqlCommand = sqlCommand; |
1355 |
|
} |
1356 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1357 |
0
|
public Vector<Transaction> getTransactions() {... |
1358 |
0
|
return transactions; |
1359 |
|
} |
1360 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1361 |
0
|
public void setTransactions(Vector<Transaction> transactions) {... |
1362 |
0
|
this.transactions = transactions; |
1363 |
|
} |
1364 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1365 |
0
|
public void setFileFilter(MavenFileFilter filter) {... |
1366 |
0
|
this.fileFilter = filter; |
1367 |
|
} |
1368 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1369 |
0
|
public String[] getResourceLocations() {... |
1370 |
0
|
return resourceLocations; |
1371 |
|
} |
1372 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1373 |
0
|
public void setResourceLocations(String[] resourceLocations) {... |
1374 |
0
|
this.resourceLocations = resourceLocations; |
1375 |
|
} |
1376 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1377 |
0
|
public boolean isExecuteTrailingSQL() {... |
1378 |
0
|
return executeTrailingSQL; |
1379 |
|
} |
1380 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1381 |
0
|
public void setExecuteTrailingSQL(boolean executeTrailingSQL) {... |
1382 |
0
|
this.executeTrailingSQL = executeTrailingSQL; |
1383 |
|
} |
1384 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1385 |
0
|
public Order getOrderFile() {... |
1386 |
0
|
return orderFile; |
1387 |
|
} |
1388 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1389 |
0
|
public void setOrderFile(String orderFile) {... |
1390 |
0
|
this.orderFile = Order.valueOf(orderFile.toUpperCase()); |
1391 |
|
} |
1392 |
|
} |