📄 quicksearchmanager.java
字号:
} catch (Exception e) { e.printStackTrace(); } return res;} public String searchReligiousSpots(String name, String keywords) { String res = ""; int count = 0; String query = "select name,mythology,place,lat,log from religious_spots where name like '%" + name + "%' and (mythology like '%" + keywords + "%' or history like '%" + keywords + "%')"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" ; res += "#"; } }catch (Exception e) { e.printStackTrace(); } return res;}public String searchReligiousSpots(String name){ String res = ""; int count = 0; String query = "select * from religious_spots where name like'%"+name+"%' or (mythology like '%" + name + "%' or history like '%" + name + "%')"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(2) + ":" + rs.getString(5) + ":" + rs.getString(7) + ":" + rs.getString(6) + ":" ; res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchReligiousSpots() { String res = ""; int count = 0; // String query = "select * from religious_spots "; // String query = "select * from religious_spots "; String query = "SELECT ((ACOS(SIN("+latitude+"* PI() / 180) * SIN(lat * PI() / 180) + COS("+latitude+" * PI() / 180) * COS(lat * PI() / 180) * COS(("+longitude+"- log) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance,name,mythology,place,lat,log FROM religious_spots HAVING distance<='10' ORDER BY distance ASC"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" ; res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchRestaurants(String name, String keywords) { String res = ""; int count = 0; String query = "select * from restaurant where name like '%" + name + "%' and menu like '%" + keywords + "%'"; System.out.println("Inside function"); System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(3) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" + rs.getString(7) + ":";// + rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res;} public String searchRestaurants(String name) { String res = ""; int count = 0; String query = "select * from restaurant where name like '%" + name + "%' or menu like '%" +name + "%'"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(3) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" + rs.getString(7) + ":" ;//+ rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res;}public String searchRestaurants() { String res = ""; int count = 0; // String query = "select * from restaurant "; String query = "SELECT ((ACOS(SIN("+latitude+"* PI() / 180) * SIN(lat * PI() / 180) + COS("+latitude+" * PI() / 180) * COS(lat * PI() / 180) * COS(("+longitude+"- log) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance,name,menu,place,lat,log FROM restaurant HAVING distance<='10' ORDER BY distance ASC"; System.out.println (query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" ;//+ rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; }public String searchShops(String name, String keywords) { String res = ""; int count = 0; String query = "select * from shop where name like '%" + name + "%' and facilities like '%" + keywords + "%'"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(2) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" + rs.getString(7) + ":" + rs.getString(8) + ":" ; res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchShops(String name) { String res = ""; int count = 0; String query = "select * from shop where name like '%" + name + "%' or facilities like '%" + name + "%'"; System.out.println(query); try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(2) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" + rs.getString(7) + ":" + rs.getString(8) + ":" ; res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchShops() { String res = ""; int count = 0; String query = "SELECT ((ACOS(SIN("+latitude+"* PI() / 180) * SIN(lat * PI() / 180) + COS("+latitude+" * PI() / 180) * COS(lat * PI() / 180) * COS(("+longitude+"- log) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance,name,facilities,place,lat,log FROM shop HAVING distance<='10' ORDER BY distance ASC"; // String query = "select * from shop "; try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6) + ":" ; res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchTourLocations(String name, String keywords) { String res = ""; int count = 0; String query = "select * from tour_location where name='" + name + "' and speciality like '%" + keywords + "%'"; try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchTourLocations(String name) { String res = ""; int count = 0; String query = "select * from tour_location where name='" + name + "' and speciality like '%" + name + "%'"; try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public String searchTourLocations() { String res = ""; int count = 0; String query = "select * from tour_location "; try { ResultSet rs = getStatement().executeQuery(query); while (rs.next()) { res += rs.getString(1) + ":" + rs.getString(2) + ":" + rs.getString(3) + ":" + rs.getString(4) + ":" + rs.getString(5) + ":" + rs.getString(6); res += "#"; } } catch (Exception e) { e.printStackTrace(); } return res; } public static void main(String[] args) { // QuickSearchManager Qmanager = new QuickSearchManager(); // Qmanager.SearchOnGps(); QuickSearchManager quicksearch ; quicksearch = new QuickSearchManager(8.518796f,76.942266f); String rse = quicksearch.searchLocations("Pattom","Horizon"); System.out.println(rse); } public float getLatitude() { return latitude; } public void setLatitude(float latitude) { this.latitude = latitude; } public float getLongitude() { return longitude; } public void setLongitude(float longitude) { this.longitude = longitude; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -