[PATCH] Nachtrag Pos. 20: improved infrastructure query
Wald Commits
scm-commit at wald.intevation.org
Mon Oct 14 12:55:30 CEST 2019
# HG changeset patch
# User mschaefer
# Date 1571050507 -7200
# Mon Oct 14 12:55:07 2019 +0200
# Node ID ad852be69900cffbfc9f012b750b95467b456f4b
# Parent 07f02019065ebefd09cb83f92d1606bd02dea983
Nachtrag Pos. 20: improved infrastructure query
diff -r 07f02019065e -r ad852be69900 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml Mon Oct 14 08:14:58 2019 +0200
+++ b/artifacts/doc/conf/meta-data.xml Mon Oct 14 12:55:07 2019 +0200
@@ -1417,24 +1417,30 @@
<!-- XXXXXXX -->
<dc:macro name="predefined_infrastructures">
<infrastructures TODO="i10n">
- <dc:context connection="system">
- <!--dc:choose>
- <dc:when test="dc:contains($riverside, 'left')">
+ <dc:choose>
+ <dc:when test="dc:contains($riverside, 'left')">
+ <dc:context connection="system">
+ <dc:variable name="infra_rs_clause" expr="'AND (lower(rs.value) = ''links'')'" />
+ <!--dc:call-macro name="infrastructures_statement" /-->
<dc:call-macro name="infrastructures_leftside_statement" />
<dc:call-macro name="infrastructures_groups_fill" />
- </dc:when>
- <dc:when test="dc:contains($riverside, 'right')">
+ </dc:context>
+ </dc:when>
+ <dc:when test="dc:contains($riverside, 'right')">
+ <dc:context connection="system">
+ <dc:variable name="infra_rs_clause" expr="'AND (lower(rs.value) = ''rechts'')'" />
<dc:call-macro name="infrastructures_rightside_statement" />
<dc:call-macro name="infrastructures_groups_fill" />
- </dc:when>
- <dc:otherwise>
+ </dc:context>
+ </dc:when>
+ <dc:otherwise>
+ <dc:context connection="system">
+ <dc:variable name="infra_rs_clause" expr="" />
<dc:call-macro name="infrastructures_bothsides_statement" />
<dc:call-macro name="infrastructures_groups_fill" />
- </dc:otherwise>
- </dc:choose-->
- <dc:call-macro name="infrastructures_bothsides_statement" />
- <dc:call-macro name="infrastructures_groups_fill" />
- </dc:context>
+ </dc:context>
+ </dc:otherwise>
+ </dc:choose>
</infrastructures>
</dc:macro>
@@ -1450,6 +1456,25 @@
</dc:group>
</dc:macro>
+ <dc:macro name="infrastructures_statement">
+ <dc:comment>die expansion von infra_rs_clause funktioniert nicht richtig, die messages erscheinen leider nicht im log...</dc:comment>
+ <dc:message>infrastructures_statement.infra_rs_clause: $infra_rs_clause</dc:message>
+ <dc:message>infrastructures_statement.infra_rs_clause: ${infra_rs_clause}</dc:message>
+ <dc:statement>
+ SELECT s.id, MIN(s.filename) AS filename, MIN(s.group_id) AS group_id, MIN(g.name) AS group_label,
+ MIN(s.annotation_type_id) AS type_id, MIN(t.name) AS type_label
+ FROM (((infrastructure AS s INNER JOIN infrastructure_values AS v ON v.infrastructure_id = s.id)
+ INNER JOIN annotation_types AS g ON s.group_id = g.id)
+ INNER JOIN annotation_types AS t ON s.annotation_type_id = t.id)
+ INNER JOIN attributes AS rs ON v.attribute_id = rs.id
+ WHERE (s.river_id = ${river_id})
+ AND (v.station BETWEEN ${fromkm}-0.0001 AND ${tokm}+0.0001)
+ ${infra_rs_clause}
+ GROUP BY s.id
+ ORDER BY MIN(g.name), MIN(t.name)
+ </dc:statement>
+ </dc:macro>
+
<dc:macro name="infrastructures_leftside_statement">
<dc:statement>
SELECT s.id, MIN(s.filename) AS filename, MIN(s.group_id) AS group_id, MIN(g.name) AS group_label,
More information about the Dive4Elements-commits
mailing list