sascha@947: sascha@947: sascha@947: sascha@947: sascha@947: sascha@947: SELECT id AS river_id, name as river_name FROM rivers sascha@947: WHERE name ILIKE ${river} sascha@947: sascha@947: sascha@947: sascha@947: sascha@947: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS gauge_id, ingo@964: name AS gauge_name ingo@964: FROM gauges WHERE river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT description AS gauge_desc, ingo@964: d.id AS discharge_id, ingo@964: ti.start_time AS g_start, ingo@964: ti.stop_time AS g_stop ingo@964: FROM discharge_tables d JOIN time_intervals ti ingo@964: ON d.time_interval_id = ti.id ingo@964: WHERE d.gauge_id = ${gauge_id} AND d.kind = 1 ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS fix_id, ingo@964: description AS fix_description ingo@964: FROM wsts WHERE kind = 2 AND river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS fix_column_id, ingo@964: name AS fix_column_name ingo@964: FROM wst_columns WHERE wst_id = ${fix_id} ingo@964: ORDER by position ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS prot_id, ingo@964: description AS prot_description ingo@964: FROM wsts WHERE kind = 5 AND river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS prot_column_id, ingo@964: name AS prot_column_name ingo@964: FROM wst_columns WHERE wst_id = ${prot_id} ingo@964: ORDER by position ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS fw_id, ingo@964: description AS fw_description ingo@964: FROM wsts WHERE kind = 4 AND river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS fw_column_id, ingo@964: name AS fw_column_name ingo@964: FROM wst_columns WHERE wst_id = ${fw_id} ingo@964: ORDER by position ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS wl_id, ingo@964: description AS wl_description ingo@964: FROM wsts WHERE kind = 0 AND river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS wl_column_id, ingo@964: name AS wl_column_name ingo@964: FROM wst_columns WHERE wst_id = ${wl_id} ingo@964: ORDER by position ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS els_id, ingo@964: description AS els_description ingo@964: FROM wsts WHERE kind = 1 AND river_id = ${river_id} ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: SELECT id AS els_column_id, ingo@964: name AS els_column_name ingo@964: FROM wst_columns WHERE wst_id = ${els_id} ingo@964: ORDER by position ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: sascha@976: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@967: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@968: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@967: ingo@964: ingo@964: ingo@964: ingo@964: ingo@964: ingo@968: ingo@964: ingo@964: ingo@964: ingo@964: sascha@947: sascha@947: sascha@947: sascha@947: sascha@947: sascha@947: