[Dive4elements-commits] [PATCH] Moved check for calculation range intersection to SQL statement

Wald Commits scm-commit at wald.intevation.org
Sat Jan 5 13:46:32 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1357389987 -3600
# Node ID 9dcc32fc51679b550cc664915fca51eb41c78b58
# Parent  f0b3ad10f67f19c41ac99c5f5d51956b97937317
Moved check for calculation range intersection to SQL statement.

diff -r f0b3ad10f67f -r 9dcc32fc5167 flys-aft/src/main/java/de/intevation/aft/River.java
--- 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) {
diff -r f0b3ad10f67f -r 9dcc32fc5167 flys-aft/src/main/resources/sql/aft-common.properties
--- 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, \


More information about the Dive4elements-commits mailing list