sascha@4075: select.river = SELECT id, name FROM rivers sascha@4085: select.gauges = SELECT id, name, official_number FROM gauges WHERE river_id = :river_id sascha@4087: next.gauge.id = SELECT NEXTVAL('GAUGES_ID_SEQ') AS gauge_id sascha@4087: insert.gauge = INSERT INTO gauges (id, name, river_id, station, aeo, official_number, datum) \ sascha@4087: VALUES(:id, :name, :river_id, :station, :aeo, :official_number, :datum) sascha@4089: select.timeintervals = SELECT id, start_time, stop_time FROM time_intervals sascha@4090: next.timeinterval.id = SELECT NEXTVAL('TIME_INTERVALS_ID_SEQ') AS time_interval_id sascha@4090: insert.timeinterval = INSERT INTO time_intervals (id, start_time, stop_time) VALUES (:id, :start_time, :stop_time) sascha@4090: next.discharge.id = SELECT NEXTVAL('DISCHARGE_TABLES_ID_SEQ') AS discharge_table_id sascha@4090: insert.dischargetable = INSERT INTO discharge_tables (id, gauge_id, description, kind, time_interval_id) \ sascha@4090: VALUES (:id, :gauge_id, :description, 0, :time_interval_id) sascha@4091: select.discharge.table.values = SELECT id, w, q FROM discharge_table_values WHERE table_id = :table_id sascha@4092: next.discharge.table.values.id = SELECT NEXTVAL('DISCHARGE_TABLE_VALUES_ID_SEQ') AS discharge_table_values_id sascha@4096: insert.discharge.table.value = INSERT INTO discharge_table_values (id, table_id, w, q) VALUES (:id, :table_id, :w, :q) sascha@4096: delete.discharge.table.value = DELETE FROM discharge_table_values WHERE id = :id sascha@4097: select.gauge.discharge.tables = SELECT dt.id AS id, dt.description AS description, ti.start_time AS start_time, ti.stop_time AS stop_time \ sascha@4097: FROM discharge_tables dt LEFT OUTER JOIN time_intervals ti ON dt.time_interval_id = ti.id \ sascha@4097: WHERE gauge_id = :gauge_id