--- android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2009/09/27 19:14:39 348 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2009/10/08 20:46:40 425 @@ -59,7 +59,7 @@ " SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, " + " earth_distance( ll_to_earth(latitude,longitude), ll_to_earth(?,?))::int AS calcdist " + " FROM trainstations " + - " WHERE latitude IS NOT NULL AND longitude IS NOT NULL " + + " WHERE enabled = true AND latitude IS NOT NULL AND longitude IS NOT NULL " + " ) AS trainstations2 " + "ORDER BY calcdist ASC " + "LIMIT 4 "; @@ -74,7 +74,7 @@ "WHERE name ILIKE ? AND latitude IS NOT NULL AND longitude IS NOT NULL " + "ORDER BY name "; stmt = conn.prepareStatement(SQL); - stmt.setString(1, "%" + name + "%"); + stmt.setString(1, name + "%"); break; default: // This should not be possible @@ -111,6 +111,7 @@ return buff.toString(); } + @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { double longitude = 0.0; @@ -126,7 +127,7 @@ } if (request.getParameter("name") != null) { - name = request.getParameter("name"); + name = request.getParameter("name").trim(); method = Requested.BY_NAME; }