sascha@1046: sascha@1046: sascha@1046: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS river_id, name as river_name FROM rivers ingo@1181: WHERE lower(name) LIKE lower(${river}) ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS gauge_id, ingo@1181: name AS gauge_name ingo@1181: FROM gauges WHERE river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT description AS gauge_desc, ingo@1181: d.id AS discharge_id, ingo@1181: ti.start_time AS g_start, ingo@1181: ti.stop_time AS g_stop ingo@1181: FROM discharge_tables d JOIN time_intervals ti ingo@1181: ON d.time_interval_id = ti.id ingo@1181: WHERE d.gauge_id = ${gauge_id} AND d.kind = 1 ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS fix_id, ingo@1181: description AS fix_description ingo@1181: FROM wsts WHERE kind = 2 AND river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS fix_column_id, ingo@1181: name AS fix_column_name ingo@1181: FROM wst_columns WHERE wst_id = ${fix_id} ingo@1181: ORDER by position ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS prot_id, ingo@1181: description AS prot_description ingo@1181: FROM wsts WHERE kind = 5 AND river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS prot_column_id, ingo@1181: name AS prot_column_name ingo@1181: FROM wst_columns WHERE wst_id = ${prot_id} ingo@1181: ORDER by position ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS fw_id, ingo@1181: description AS fw_description ingo@1181: FROM wsts WHERE kind = 4 AND river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS fw_column_id, ingo@1181: name AS fw_column_name ingo@1181: FROM wst_columns WHERE wst_id = ${fw_id} ingo@1181: ORDER by position ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS wl_id, ingo@1181: description AS wl_description ingo@1181: FROM wsts WHERE kind = 0 AND river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS wl_column_id, ingo@1181: name AS wl_column_name ingo@1181: FROM wst_columns WHERE wst_id = ${wl_id} ingo@1181: ORDER by position ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS els_id, ingo@1181: description AS els_description ingo@1181: FROM wsts WHERE kind = 1 AND river_id = ${river_id} ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: SELECT id AS els_column_id, ingo@1181: name AS els_column_name ingo@1181: FROM wst_columns WHERE wst_id = ${els_id} ingo@1181: ORDER by position ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: FIXME: Following two macros look identical to me. ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: ingo@1181: sascha@1046: sascha@1046: sascha@1046: User specific part sascha@1046: ------------------ sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: SELECT u.id AS user_id, c.id AS collection_id sascha@1046: FROM collections c JOIN users u ON c.user_id = u.id sascha@1046: WHERE u.gid = CAST(${user-id} AS uuid) sascha@1046: ORDER BY c.creation DESC sascha@1046: sascha@1046: sascha@1046: sascha@1046: SELECT id AS a_id, state AS a_state, gid AS a_gid, creation AS a_creation sascha@1046: FROM master_artifacts m sascha@1046: WHERE collection_id = ${collection_id} AND gid <> CAST(${artifact-id} AS uuid) sascha@1046: AND EXISTS ( sascha@1046: SELECT id FROM artifact_data WHERE artifact_id = m.id AND k = 'river' AND v = ${river}) sascha@1046: sascha@1046: sascha@1046: sascha@1054: sascha@1046: sascha@1046: SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' sascha@1046: sascha@1046: sascha@1046: sascha@1046: SELECT name AS facet_name, num as facet_num, description AS facet_description sascha@1046: FROM facets WHERE out_id = ${out_id} ORDER BY num ASC, name DESC sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1069: sascha@1054: sascha@1046: sascha@1054: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: sascha@1046: ingo@1181: ingo@1181: System specific part ingo@1181: -------------------- ingo@1181: ingo@1181: sascha@1046: sascha@1046: ingo@1181: System specific part only ingo@1181: ------------------------- sascha@1046: sascha@1046: ingo@1181: sascha@1046: sascha@1046: sascha@1046: sascha@1046: