/[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 1573 by torben, Sat Jul 9 15:58:47 2011 UTC revision 1574 by torben, Sat Jul 9 17:18:59 2011 UTC
# Line 6  import java.sql.PreparedStatement; Line 6  import java.sql.PreparedStatement;
6  import java.sql.ResultSet;  import java.sql.ResultSet;
7  import java.sql.SQLException;  import java.sql.SQLException;
8  import java.sql.Statement;  import java.sql.Statement;
9    import java.util.Collections;
10    import java.util.Comparator;
11  import java.util.logging.Logger;  import java.util.logging.Logger;
12    
13  import dk.thoerup.android.traininfo.common.StationBean;  import dk.thoerup.android.traininfo.common.StationBean;
# Line 257  public class StationDAO { Line 259  public class StationDAO {
259                  }                  }
260          }          }
261                    
262            Comparator<StationEntry> nameComparator = new Comparator<StationEntry>() {
263                    @Override
264                    public int compare(StationEntry arg0, StationEntry arg1) {
265                            return arg0.getName().compareTo( arg1.getName() );
266                    }              
267            };
268            
269          //used to create full dump in order to populate Google Appengine DB          //used to create full dump in order to populate Google Appengine DB
270          //after 1.1.0 also used to populate client-side station list          //after 1.1.0 also used to populate client-side station list
271          public StationBean dumpAll() throws SQLException {          public StationBean dumpAll() throws SQLException {
272                                    
273                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " +                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro,address,0.0,aliases " +
274                                  "FROM trainstations WHERE enabled = true ORDER BY name";                                  "FROM trainstations WHERE enabled = true";
275                                    
276                  Connection conn = null;                  Connection conn = null;
277                  Statement stmt = null;                  Statement stmt = null;
# Line 289  public class StationDAO { Line 298  public class StationDAO {
298                                  stations.entries.add( entry );                                  stations.entries.add( entry );
299                                                                    
300                          }                          }
301                            Collections.sort( stations.entries,nameComparator );
302                          return stations;                          return stations;
303                                                    
304    

Legend:
Removed from v.1573  
changed lines
  Added in v.1574

  ViewVC Help
Powered by ViewVC 1.1.20