/** * Get the id of the location name given in the parameter. On success return * the id, on failure return 0 * * @param name the location name * @return location id */ public int getLocationIdByName(String name) { String sql = "SELECT a.commentid FROM " + getTagTable() + " a INNER JOIN " + getComTable() + " b ON a.commentid = b.id WHERE b.topic = '" + name + "'"; try { ResultSet rs = select(sql); if(! rs.next()) return 0; int lid = rs.getInt("commentid"); rs.close(); return lid; } catch (SQLException e) { e.printStackTrace(); return 0; } }