[Dive4elements-commits] [PATCH] Schema change: make sq_relation_value.qmax NOT NULL and more informative messages in parser

Wald Commits scm-commit at wald.intevation.org
Thu Mar 28 14:02:58 CET 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1364475772 -3600
# Node ID d459a885c51fb44240de367ffd2a60f3a4ffc052
# Parent  5d99cd6e146a56df3f9357b9880fd2d877928c0d
Schema change: make sq_relation_value.qmax NOT NULL and more informative messages in parser

diff -r 5d99cd6e146a -r d459a885c51f flys-backend/doc/schema/oracle-minfo.sql
--- a/flys-backend/doc/schema/oracle-minfo.sql	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Thu Mar 28 14:02:52 2013 +0100
@@ -322,7 +322,7 @@
     parameter                VARCHAR(1) NOT NULL,
     a                        NUMBER(38,20) NOT NULL,
     b                        NUMBER(38,20) NOT NULL,
-    qmax                     NUMBER(38,20),
+    qmax                     NUMBER(38,20) NOT NULL,
     rsq                      NUMBER(38,3),
     ntot                     NUMBER(38,0),
     noutl                    NUMBER(38,0),
diff -r 5d99cd6e146a -r d459a885c51f flys-backend/doc/schema/postgresql-minfo.sql
--- a/flys-backend/doc/schema/postgresql-minfo.sql	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Thu Mar 28 14:02:52 2013 +0100
@@ -322,7 +322,7 @@
     parameter              VARCHAR(1) NOT NULL,
     a                      NUMERIC NOT NULL,
     b                      NUMERIC NOT NULL,
-    qmax                   NUMERIC,
+    qmax                   NUMERIC NOT NULL,
     rsq                    NUMERIC,
     ntot                   int,
     noutl                  int,
diff -r 5d99cd6e146a -r d459a885c51f flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java	Thu Mar 28 14:02:52 2013 +0100
@@ -119,10 +119,18 @@
         Integer nOutlier = parseInteger(cols[11], line);
         Double cFer = parseDouble(cols[12], line);
         Double cDuan = parseDouble(cols[13], line);
-        if (km == null || a == null || b == null || cols[1].length() == 0) {
-            log.error("Incomplete SQ-relation row (missing km, a, b or parameter): "
-                + line);
-            return;
+        if (km == null || a == null || b == null || 
+	    qMax == null || cols[1].length() == 0) {
+	    if (km == null) {
+		log.error("No km for measurement station: Can not reference measurement station: "
+		    + line);
+	    }
+	    if ( a == null || b == null || 
+		qMax == null || cols[1].length() == 0) {
+		log.error("Incomplete SQ-relation row (missing a, b, Qmax or parameter): "
+		    + line);
+	    }
+	    return;
         }
         current.addValue(new ImportSQRelationValue(
             cols[1],
@@ -143,7 +151,7 @@
             result = Double.valueOf(value.replace(",", "."));
         }
         catch (NumberFormatException nfe) {
-            log.warn("parsing " + value + " in sq relation row: " + line);
+            log.warn("Unparseable " + value + " in sq relation row: " + line);
         }
         return result;
     }
@@ -154,7 +162,7 @@
             result = Integer.valueOf(value);
         }
         catch (NumberFormatException nfe) {
-            log.warn("parsing " + value + " in sq relation row: " + line);
+            log.warn("Unparseable " + value + " in sq relation row: " + line);
         }
         return result;
     }


More information about the Dive4elements-commits mailing list