changeset 327:e09634fbf6bc

Moved the query complexity of creating a w/q value table into view 'wst_value_table' and used this instead. flys-artifacts/trunk@1724 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Apr 2011 16:01:23 +0000
parents 07eba6d3b4a5
children 07e642030172
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java
diffstat 2 files changed, 9 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Apr 18 14:40:35 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Apr 18 16:01:23 2011 +0000
@@ -1,3 +1,9 @@
+2011-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
+	  Moved the query complexity into view 'wst_value_table' and
+	  used this instead.
+
 2011-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Mon Apr 18 14:40:35 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Mon Apr 18 16:01:23 2011 +0000
@@ -26,25 +26,9 @@
 
     // TODO: put this into a property file
     public static final String SQL_POS_WQ = 
-        "SELECT wcv.position AS position,"                           +
-        "       w,"                                                  +
-        "       (SELECT q"                                           +
-        "        FROM   wst_column_q_ranges wcqr"                    +
-        "               JOIN wst_q_ranges wqr"                       +
-        "                 ON wcqr.wst_q_range_id = wqr.id"           +
-        "               JOIN ranges r"                               +
-        "                 ON r.id = wqr.range_id"                    +
-        "        WHERE  wcqr.wst_column_id = wc.id"                  +
-        "               AND wcv.position BETWEEN r.a AND r.b) AS q," +
-        "       wc.position AS column_pos "                          +
-        "FROM   wst_column_values wcv"                               +
-        "       JOIN wst_columns wc"                                 +
-        "         ON wcv.wst_column_id = wc.id"                      +
-        "       JOIN wsts w"                                         +
-        "         ON wc.wst_id = w.id "                              +
-        "WHERE  w.id = :wst_id"                                      +
-        "ORDER  BY wcv.position ASC,"                                +
-        "          wc.position DESC";
+        "SELECT position, w, q, column_pos" +
+        "    FROM wst_value_table"          +
+        "    WHERE wst_id = :wst_id";
 
     public static class Column
     implements          Serializable

http://dive4elements.wald.intevation.org