Mercurial > dive4elements > river
changeset 8487:3e5d69e143e9
Datacage config: Oracle has no boolean data type and thus can not handle such CASE-statement in WHERE-clause.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 02 Dec 2014 12:59:52 +0100 |
parents | d0719e98a9da |
children | a63825ab9df9 |
files | artifacts/doc/conf/meta-data.xml |
diffstat | 1 files changed, 45 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml Tue Dec 02 12:03:50 2014 +0100 +++ b/artifacts/doc/conf/meta-data.xml Tue Dec 02 12:59:52 2014 +0100 @@ -1042,10 +1042,7 @@ <dc:variable name="stop" type="number" expr="dc:date-format('yyyyMMdd', number(substring-after($year_range, ';')))"/> - <dc:variable name="refgauge" type="number" - expr="dc:get('reference_gauge')"/> - <dc:context> - <dc:call-macro name="discharge_curves"/> + <dc:call-macro name="discharge_curve_choose_context"> <dc:filter expr="$kind = 1 and number(dc:date-format('yyyyMMdd', $start_time)) < $stop and @@ -1053,14 +1050,11 @@ > $start"> <dc:call-macro name="hist_discharge_factory"/> </dc:filter> - </dc:context> + </dc:call-macro> </dc:macro> <dc:macro name="discharge_table_gauge"> - <dc:variable name="refgauge" type="number" - expr="dc:get('reference_gauge')"/> - <dc:context> - <dc:call-macro name="discharge_curves"/> + <dc:call-macro name="discharge_curve_choose_context"> <dc:filter expr="$kind = 0"> <dc:group expr="$gauge_name"> <gauge name="{dc:group-key()}"> @@ -1071,14 +1065,11 @@ </gauge> </dc:group> </dc:filter> - </dc:context> + </dc:call-macro> </dc:macro> <dc:macro name="historical_discharge_curve"> - <dc:variable name="refgauge" type="number" - expr="dc:get('reference_gauge')"/> - <dc:context> - <dc:call-macro name="discharge_curves"/> + <dc:call-macro name="discharge_curve_choose_context"> <dc:filter expr="$kind = 1"> <historical_discharge_curves> <dc:group expr="$gauge_name"> @@ -1088,10 +1079,29 @@ </dc:group> </historical_discharge_curves> </dc:filter> - </dc:context> + </dc:call-macro> </dc:macro> - <dc:macro name="discharge_curves"> + <dc:macro name="discharge_curve_choose_context"> + <dc:choose> + <dc:when test="$fromkm > -99999 and $tokm < 99999"> + <dc:context> + <dc:call-macro name="discharge_curves_km"/> + <dc:macro-body/> + </dc:context> + </dc:when> + <dc:otherwise> + <dc:variable name="refgauge" type="number" + expr="dc:get('reference_gauge')"/> + <dc:context> + <dc:call-macro name="discharge_curves_refgauge"/> + <dc:macro-body/> + </dc:context> + </dc:otherwise> + </dc:choose> + </dc:macro> + + <dc:macro name="discharge_curves_km"> <dc:statement> SELECT g.name AS gauge_name, dt.id AS dt_id, @@ -1103,13 +1113,29 @@ JOIN discharge_tables dt ON g.id = dt.gauge_id LEFT JOIN time_intervals t ON dt.time_interval_id = t.id WHERE g.river_id = ${river_id} - AND CASE WHEN ${fromkm} > -99999 AND ${tokm} < 99999 - THEN g.station BETWEEN ${fromkm} AND ${tokm} - ELSE g.official_number = ${refgauge} END + AND g.station BETWEEN ${fromkm} AND ${tokm} ORDER BY start_time </dc:statement> </dc:macro> + <dc:macro name="discharge_curves_refgauge"> + <dc:statement> + SELECT g.name AS gauge_name, + dt.id AS dt_id, + t.start_time AS start_time, + t.stop_time AS stop_time, + dt.bfg_id AS bfg_id, + dt.kind AS kind + FROM gauges g + JOIN discharge_tables dt ON g.id = dt.gauge_id + LEFT JOIN time_intervals t ON dt.time_interval_id = t.id + WHERE g.river_id = ${river_id} + AND g.official_number = ${refgauge} + ORDER BY start_time + </dc:statement> + </dc:macro> + + <!-- Cross sections --> <dc:macro name="cross_sections"> <cross_sections id="flood-protections-{$river_id}"> <dc:context connection="system">