59 |
" SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, " + |
" SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, " + |
60 |
" 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 " + |
61 |
" FROM trainstations " + |
" FROM trainstations " + |
62 |
" WHERE latitude IS NOT NULL AND longitude IS NOT NULL " + |
" WHERE enabled = true AND latitude IS NOT NULL AND longitude IS NOT NULL " + |
63 |
" ) AS trainstations2 " + |
" ) AS trainstations2 " + |
64 |
"ORDER BY calcdist ASC " + |
"ORDER BY calcdist ASC " + |
65 |
"LIMIT 4 "; |
"LIMIT 4 "; |
74 |
"WHERE name ILIKE ? AND latitude IS NOT NULL AND longitude IS NOT NULL " + |
"WHERE name ILIKE ? AND latitude IS NOT NULL AND longitude IS NOT NULL " + |
75 |
"ORDER BY name "; |
"ORDER BY name "; |
76 |
stmt = conn.prepareStatement(SQL); |
stmt = conn.prepareStatement(SQL); |
77 |
stmt.setString(1, "%" + name + "%"); |
stmt.setString(1, name + "%"); |
78 |
break; |
break; |
79 |
default: |
default: |
80 |
// This should not be possible |
// This should not be possible |
111 |
return buff.toString(); |
return buff.toString(); |
112 |
} |
} |
113 |
|
|
114 |
|
@Override |
115 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
116 |
|
|
117 |
double longitude = 0.0; |
double longitude = 0.0; |
127 |
} |
} |
128 |
|
|
129 |
if (request.getParameter("name") != null) { |
if (request.getParameter("name") != null) { |
130 |
name = request.getParameter("name"); |
name = request.getParameter("name").trim(); |
131 |
method = Requested.BY_NAME; |
method = Requested.BY_NAME; |
132 |
} |
} |
133 |
|
|