--- android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2009/10/10 08:33:27 431 +++ 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, " + + " 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,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,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,7 +105,12 @@ buff.append("").append( !res.wasNull() ) .append("\n"); res.getString(6); buff.append("").append( !res.wasNull() ) .append("\n"); - buff.append("").append( res.getInt(7) ) .append("\n"); + res.getString(7); + buff.append("").append( !res.wasNull() ).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"); } @@ -145,7 +150,7 @@ if (conn != null) { conn.close(); } - } catch (Throwable t) {} + } catch (Exception t) {} } }