use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.
the class GpsHelper method getCoordinate.
public NodeGps getCoordinate(HikariDataSource ds, String id_concept, String id_theso) {
NodeGps coordonnees = null;
if (isHaveCoordinate(ds, id_concept, id_theso)) {
Connection conn;
Statement stmt;
ResultSet resultSet;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select latitude, longitude from gps" + " where id_concept ='" + id_concept + "'" + " and id_theso = '" + id_theso + "'";
resultSet = stmt.executeQuery(query);
if (resultSet.next()) {
coordonnees = new NodeGps();
coordonnees.setLatitude(resultSet.getDouble("latitude"));
coordonnees.setLongitude(resultSet.getDouble("longitude"));
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while Add coordonnes : " + id_concept, sqle);
}
}
return coordonnees;
}
Aggregations