--- android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2010/01/25 15:28:21 548 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2010/01/26 20:18:57 549 @@ -48,7 +48,7 @@ if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) { //inner select is workaround from not being able to use a calculated column directly in where clause SQL = "SELECT * FROM ( "+ - " SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, address," + + " SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address," + " earth_distance( ll_to_earth(latitude,longitude), ll_to_earth(?,?))::int AS calcdist " + " FROM trainstations " + " WHERE enabled = true " + @@ -61,7 +61,7 @@ stmt.setDouble(1, latitude); stmt.setDouble(2, longitude); } else if (req.getParameter("name") != null) { - SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, address, 0.0 " + + SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, 0.0 " + "FROM trainstations " + "WHERE name ILIKE ? AND enabled = true " + "ORDER BY name "; @@ -71,7 +71,7 @@ stmt.setString(1, name + "%"); } else if (req.getParameter("list") != null) { String list = transformToIntList( req.getParameter("list")); - SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,address,0.0 " + + SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog,stationcode_metro, address,0.0 " + "FROM trainstations " + "WHERE id IN " + list + " AND enabled = true " + "ORDER BY name "; @@ -105,10 +105,12 @@ buff.append("").append( !res.wasNull() ) .append("\n"); res.getString(6); buff.append("").append( !res.wasNull() ) .append("\n"); + res.getString(7); + buff.append("").append( !res.wasNull() ).append("\n"); - String address = res.getString(7); - buff.append("
").append( res.wasNull() ? "" : address ).append("
"); - buff.append("").append( res.getInt(8) ) .append("\n"); + String address = res.getString(8); + buff.append("
").append( res.wasNull() ? "" : address ).append("
"); + buff.append("").append( res.getInt(9) ) .append("\n"); buff.append("\n"); }