97 |
} |
} |
98 |
} |
} |
99 |
|
|
|
public StationBean dumpAll() throws SQLException { |
|
|
|
|
|
String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " + |
|
|
"FROM trainstations WHERE enabled = true ORDER BY id"; |
|
|
|
|
|
Connection conn = null; |
|
|
Statement stmt = null; |
|
|
ResultSet res = null; |
|
|
|
|
|
|
|
|
try { |
|
|
conn = DBConnection.getConnection(); |
|
|
|
|
|
stmt = conn.createStatement(); |
|
|
res = stmt.executeQuery(SQL); |
|
|
|
|
|
// Does mostly the same as convertResultset() |
|
|
StationBean stations = new StationBean(); |
|
|
while (res.next()) { |
|
|
StationEntry entry = convertSingleRow(res); |
|
|
|
|
|
Array arr = res.getArray(10); |
|
|
if (arr != null) { |
|
|
String[] aliases = (String[]) arr.getArray(); |
|
|
entry.setAliases(aliases); |
|
|
} |
|
|
|
|
|
stations.entries.add( entry ); |
|
|
|
|
|
} |
|
|
return stations; |
|
|
|
|
100 |
|
|
|
} finally { |
|
|
if (res != null) |
|
|
res.close(); |
|
|
if (stmt != null) |
|
|
stmt.close(); |
|
|
if (conn != null) |
|
|
conn.close(); |
|
|
} |
|
|
|
|
|
} |
|
101 |
|
|
102 |
/* |
/* |
103 |
* this code requires theses statements are run on database in order to do ILIKE searches against aliases (which is defines as array of varchar(64) ) |
* this code requires theses statements are run on database in order to do ILIKE searches against aliases (which is defines as array of varchar(64) ) |
206 |
return null; |
return null; |
207 |
} |
} |
208 |
} |
} |
209 |
|
|
210 |
|
//used to create full dump in order to populate Google Appengine DB |
211 |
|
@Deprecated |
212 |
|
public StationBean dumpAll() throws SQLException { |
213 |
|
|
214 |
|
String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " + |
215 |
|
"FROM trainstations WHERE enabled = true ORDER BY id"; |
216 |
|
|
217 |
|
Connection conn = null; |
218 |
|
Statement stmt = null; |
219 |
|
ResultSet res = null; |
220 |
|
|
221 |
|
|
222 |
|
try { |
223 |
|
conn = DBConnection.getConnection(); |
224 |
|
|
225 |
|
stmt = conn.createStatement(); |
226 |
|
res = stmt.executeQuery(SQL); |
227 |
|
|
228 |
|
// Does mostly the same as convertResultset() |
229 |
|
StationBean stations = new StationBean(); |
230 |
|
while (res.next()) { |
231 |
|
StationEntry entry = convertSingleRow(res); |
232 |
|
|
233 |
|
Array arr = res.getArray(10); |
234 |
|
if (arr != null) { |
235 |
|
String[] aliases = (String[]) arr.getArray(); |
236 |
|
entry.setAliases(aliases); |
237 |
|
} |
238 |
|
|
239 |
|
stations.entries.add( entry ); |
240 |
|
|
241 |
|
} |
242 |
|
return stations; |
243 |
|
|
244 |
|
|
245 |
|
} finally { |
246 |
|
if (res != null) |
247 |
|
res.close(); |
248 |
|
if (stmt != null) |
249 |
|
stmt.close(); |
250 |
|
if (conn != null) |
251 |
|
conn.close(); |
252 |
|
} |
253 |
|
|
254 |
|
} |
255 |
|
|
256 |
@Deprecated |
@Deprecated |
257 |
public static String getStationName(int stationID) { |
public static String getStationName(int stationID) { |