Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
47cc6a9f
Commit
47cc6a9f
authored
Jun 23, 2025
by
Riegel
Browse files
Feat: Implement database entry counting
parent
bd7cb123
Changes
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/DatabaseHandler.java
View file @
47cc6a9f
...
@@ -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
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment