102 |
} |
} |
103 |
|
|
104 |
public List<StationBean> getByLocation(double latitude, double longitude) throws SQLException { |
public List<StationBean> getByLocation(double latitude, double longitude) throws SQLException { |
105 |
String SQL = "SELECT * FROM ( "+ |
String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address," + |
106 |
" SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address," + |
" earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " + |
107 |
" earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " + |
"FROM trainstations " + |
108 |
" FROM trainstations " + |
"WHERE enabled = true " + |
109 |
" WHERE enabled = true " + |
"ORDER BY calcdist ASC " + |
110 |
" ) AS trainstations2 " + |
"LIMIT 4 "; |
|
"ORDER BY calcdist ASC " + |
|
|
"LIMIT 4 "; |
|
111 |
List<StationBean> result; |
List<StationBean> result; |
112 |
Connection conn = null; |
Connection conn = null; |
113 |
PreparedStatement stmt = null; |
PreparedStatement stmt = null; |