changeset 4774:9dcc32fc5167

Moved check for calculation range intersection to SQL statement.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 05 Jan 2013 13:46:27 +0100 (2013-01-05)
parents f0b3ad10f67f
children d9f1202cef78
files flys-aft/src/main/java/de/intevation/aft/River.java flys-aft/src/main/resources/sql/aft-common.properties
diffstat 2 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/River.java	Sat Jan 05 13:30:57 2013 +0100
+++ b/flys-aft/src/main/java/de/intevation/aft/River.java	Sat Jan 05 13:46:27 2013 +0100
@@ -77,23 +77,15 @@
         ResultSet messstellenRs = aftStatements
             .getStatement("select.messstelle")
             .clearParameters()
-            .setInt("GEWAESSER_NR", id2).executeQuery();
+            .setInt("GEWAESSER_NR", id2)
+            .setDouble("START_KM", from)
+            .setDouble("END_KM", to)
+            .executeQuery();
 
         try {
             while (messstellenRs.next()) {
-                String name    = messstellenRs.getString("NAME");
-                String num     = messstellenRs.getString("MESSSTELLE_NR");
-                double station = messstellenRs.getDouble("STATIONIERUNG");
-
-                if (messstellenRs.wasNull()) {
-                    log.warn("AFT: STATION of MESSSTELLE '"+name+"' is NULL -> ignored.");
-                    continue;
-                }
-
-                if (!inside(station)) {
-                    log.warn("AFT: MESSSTELLE '"+name+"' out of calculation range -> ignored.");
-                    continue;
-                }
+                String name = messstellenRs.getString("NAME");
+                String num  = messstellenRs.getString("MESSSTELLE_NR");
 
                 Long number = SyncContext.numberToLong(num);
                 if (number == null) {
--- a/flys-aft/src/main/resources/sql/aft-common.properties	Sat Jan 05 13:30:57 2013 +0100
+++ b/flys-aft/src/main/resources/sql/aft-common.properties	Sat Jan 05 13:46:27 2013 +0100
@@ -1,8 +1,8 @@
 select.gewaesser = SELECT GEWAESSER_NR, NAME FROM SL_GEWAESSER
 select.messstelle = \
-    SELECT NAME, MESSSTELLE_NR, STATIONIERUNG \
+    SELECT NAME, MESSSTELLE_NR \
     FROM MESSSTELLE \
-    WHERE GEWAESSER_NR = :GEWAESSER_NR
+    WHERE GEWAESSER_NR = :GEWAESSER_NR AND STATIONIERUNG BETWEEN :START_KM AND :END_KM
 select.abflusstafel = SELECT ABFLUSSTAFEL_NR, \
                              ABFLUSSTAFEL_BEZ, \
                              strftime('%s', GUELTIG_VON) * 1000 AS GUELTIG_VON, \

http://dive4elements.wald.intevation.org