1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.addam.ddlrun.custom;
20
21
22 import java.sql.Connection;
23 import java.sql.PreparedStatement;
24 import java.sql.ResultSet;
25 import java.sql.SQLException;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.List;
29
30 import net.sourceforge.addam.ddlrun.utils.CompletedScriptRetriever;
31
32 /**
33 * ENTER A DESCRIPTION HERE
34 *
35 * @author TIM3
36 * @since Sep 16, 2005
37 */
38 public class IDSCompletedScriptRetriever implements CompletedScriptRetriever {
39
40 public static final String GET_COMPLETED_SCRIPTS_SQL = "SELECT SCL_SCRIPT FROM SCRIPT_LOG";
41
42 public IDSCompletedScriptRetriever(Connection conn) {
43 this.connection = conn;
44 }
45
46 public Collection getCompletedScripts() {
47 List runScripts = new ArrayList();
48 try {
49 PreparedStatement statement = connection.prepareStatement(GET_COMPLETED_SCRIPTS_SQL);
50 ResultSet runScriptsSet = statement.executeQuery();
51 while (runScriptsSet.next()) {
52 runScripts.add(runScriptsSet.getString(1));
53 }
54 } catch (SQLException e) {
55 throw new RuntimeException("unable to retrieve completed scripts", e);
56 }
57 return runScripts;
58 }
59
60 private final Connection connection;
61 }