Commit 47cc6a9f authored by Riegel's avatar Riegel
Browse files

Feat: Implement database entry counting

parent bd7cb123
...@@ -148,6 +148,23 @@ public class DatabaseHandler { ...@@ -148,6 +148,23 @@ public class DatabaseHandler {
return intersectingObjects; return intersectingObjects;
} }
public static int getFeatureCount() {
int count = -1;
try (Connection con = new ConnectionWrapper(H2GISDBFactory.openSpatialDataBase(DB_NAME))) {
try (PreparedStatement ps = con.prepareStatement("SELECT COUNT(gmlid) AS nr FROM features")) {
ResultSet rs = ps.executeQuery();
if (rs.next()) {
count = rs.getInt("nr");
}
}
} catch (SQLException e) {
logger.error("Connection to database failed while trying to get bbox intersecting objects!");
logger.debug(e.getMessage());
}
return count;
}
private static List<? extends CityObject> retrieveCityObjects(ResultSet rs) throws SQLException { private static List<? extends CityObject> retrieveCityObjects(ResultSet rs) throws SQLException {
List<CityObject> cos = new ArrayList<>(); List<CityObject> cos = new ArrayList<>();
while (rs.next()) { while (rs.next()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment