libdballe 9.6
postgresql/station.h
1#ifndef DBALLE_DB_V7_POSTGRESQL_STATION_H
2#define DBALLE_DB_V7_POSTGRESQL_STATION_H
3
4#include <dballe/db/v7/station.h>
5#include <functional>
6#include <memory>
7
8namespace wreport {
9struct Var;
10}
11
12namespace dballe {
13namespace db {
14namespace v7 {
15namespace postgresql {
16
21{
22protected:
27
28 void _dump(std::function<void(int, int, const Coords& coords, const char* ident)> out) override;
29
30public:
33 PostgreSQLStation(const PostgreSQLStation&) = delete;
34 PostgreSQLStation(const PostgreSQLStation&&) = delete;
35 PostgreSQLStation& operator=(const PostgreSQLStation&) = delete;
36
37 DBStation lookup(Tracer<>& trc, int id_station) override;
38 int maybe_get_id(Tracer<>& trc, const dballe::DBStation& st) override;
39 int insert_new(Tracer<>& trc, const dballe::DBStation& desc) override;
40 void get_station_vars(Tracer<>& trc, int id_station, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
41 void add_station_vars(Tracer<>& trc, int id_station, DBValues& values) override;
42 void run_station_query(Tracer<>& trc, const v7::StationQueryBuilder& qb, std::function<void(const dballe::DBStation&)>) override;
43};
44
45}
46}
47}
48}
49#endif
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:46
Precompiled queries to manipulate the station table.
Definition: postgresql/station.h:21
void get_station_vars(Tracer<> &trc, int id_station, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
int insert_new(Tracer<> &trc, const dballe::DBStation &desc) override
Insert a new station in the database, without checking if it already exists.
dballe::sql::PostgreSQLConnection & conn
DB connection.
Definition: postgresql/station.h:26
DBStation lookup(Tracer<> &trc, int id_station) override
Lookup station data by ID.
int maybe_get_id(Tracer<> &trc, const dballe::DBStation &st) override
Get the station ID given latitude, longitude and mobile identifier.
void add_station_vars(Tracer<> &trc, int id_station, DBValues &values) override
Add all station variables (without attributes) to values.
Database connection.
Definition: postgresql.h:242
Coordinates.
Definition: types.h:369
Definition: types.h:851
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:192
Definition: qbuilder.h:82
Definition: station.h:25
Definition: transaction.h:16