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
27 import net.sourceforge.addam.ddlrun.utils.StartFolderRetriever;
28
29 /**
30 * ENTER A DESCRIPTION HERE
31 *
32 * @author TIM3
33 * @since Sep 16, 2005
34 * @todo make folder SQL configurable
35 */
36 public class IDSStartFolderRetriever implements StartFolderRetriever {
37
38
39 public static final String GET_START_FOLDER_SQL = "SELECT VRS_START_FOLDER FROM VERSION WHERE VRS_TYPE='PF'";
40
41 public IDSStartFolderRetriever(Connection conn) {
42 this.connection = conn;
43 }
44
45 public String getStartFolder() {
46 PreparedStatement versionStatement = null;
47 String version;
48 try {
49 versionStatement = connection.prepareStatement(GET_START_FOLDER_SQL);
50 ResultSet results = versionStatement.executeQuery();
51 if (results.next()) {
52 version = results.getString(1);
53 } else {
54 throw new SQLException("no results returned for " + GET_START_FOLDER_SQL);
55 }
56 } catch (SQLException e) {
57 throw new RuntimeException("unable to retrieve start folder", e);
58 }
59 return version;
60 }
61
62 private final Connection connection;
63 }