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

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java

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

revision 292 by torben, Tue Sep 1 19:17:18 2009 UTC revision 293 by torben, Tue Sep 1 19:40:02 2009 UTC
# Line 30  public class LocateStations extends Http Line 30  public class LocateStations extends Http
30          protected String getStations(Connection conn, double latitude, double longitude) throws SQLException {          protected String getStations(Connection conn, double latitude, double longitude) throws SQLException {
31                  //inner select is workaround from not being able to use a calculated column directly in where clause                  //inner select is workaround from not being able to use a calculated column directly in where clause
32                  final String SQL = "SELECT * FROM ( "+                  final String SQL = "SELECT * FROM ( "+
33                                                     "               SELECT name,latitude,longitude,address,stationcode, " +                                                     "               SELECT name,latitude,longitude,stationcode, " +
34                                                     "                     earth_distance( ll_to_earth(latitude,longitude), ll_to_earth(?,?))::int AS calcdist " +                                                     "                     earth_distance( ll_to_earth(latitude,longitude), ll_to_earth(?,?))::int AS calcdist " +
35                                                     "               FROM trainstations " +                                                     "               FROM trainstations " +
36                                                     "       ) AS trainstations2 " +                                                     "       ) AS trainstations2 " +
# Line 59  public class LocateStations extends Http Line 59  public class LocateStations extends Http
59    
60                                  buff.append("<name>").append( res.getString(1) ) .append("</name>\n");                                  buff.append("<name>").append( res.getString(1) ) .append("</name>\n");
61                                  buff.append("<latitude>").append( res.getDouble(2) ) .append("</latitude>\n");                                  buff.append("<latitude>").append( res.getDouble(2) ) .append("</latitude>\n");
62                                  buff.append("<longitude>").append( res.getDouble(3) ) .append("</longitude>\n");                                                                  buff.append("<longitude>").append( res.getDouble(3) ) .append("</longitude>\n");                                        
63                                  buff.append("<address>").append( res.getString(4) ) .append("</address>\n");                                      buff.append("<stationcode>").append( res.getString(4) ) .append("</stationcode>\n");
64                                  buff.append("<stationcode>").append( res.getString(5) ) .append("</stationcode>\n");                                  buff.append("<calcdist>").append( res.getInt(5) ) .append("</calcdist>\n");
                                 buff.append("<calcdist>").append( res.getDouble(6) ) .append("</calcdist>\n");  
65                                                                    
66                                  buff.append("</station>\n");                                                              buff.append("</station>\n");                            
67                          }                          }

Legend:
Removed from v.292  
changed lines
  Added in v.293

  ViewVC Help
Powered by ViewVC 1.1.20