/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1416 by torben, Mon May 2 11:59:40 2011 UTC revision 1417 by torben, Mon May 2 16:21:37 2011 UTC
# Line 258  public class StationDAO { Line 258  public class StationDAO {
258                  return result;                  return result;
259    
260          }          }
261            @Deprecated
262          public static String getStationName(int stationID) {          public static String getStationName(int stationID) {
263                  String station = "";                  String station = "";
264    
# Line 280  public class StationDAO { Line 281  public class StationDAO {
281    
282                  return station;                  return station;
283          }          }
284            
285            public StationEntry getSimpleByName(String name) throws SQLException {
286                    String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, 0.0 " +
287                    "FROM trainstations " +
288                    "WHERE name = ?  AND enabled = true " +
289                    "LIMIT 1 ";
290    
291                    StationBean result;
292                    Connection conn = null;
293                    PreparedStatement stmt = null;
294                    ResultSet res = null;
295                    try {
296                            conn = DBConnection.getConnection();
297                            stmt = conn.prepareStatement(SQL);
298    
299                            stmt.setString(1, name );
300    
301                            res = stmt.executeQuery();
302                            result = convertResultset(res);
303    
304                    } finally {
305                            if (res != null)
306                                    res.close();
307                            if (stmt != null)
308                                    stmt.close();
309                            if (conn!= null)
310                                    conn.close();
311                    }
312    
313                    if (result.entries.size() == 1) {
314                            return result.entries.get(0);
315                    } else {
316                            return null;
317                    }
318            }
319    
320            @Deprecated
321          public int getIdByName(String name) throws SQLException {          public int getIdByName(String name) throws SQLException {
322                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, 0.0 " +                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, 0.0 " +
323                  "FROM trainstations " +                  "FROM trainstations " +

Legend:
Removed from v.1416  
changed lines
  Added in v.1417

  ViewVC Help
Powered by ViewVC 1.1.20