libdballe  9.14
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 
8 namespace wreport {
9 struct Var;
10 }
11 
12 namespace dballe {
13 namespace db {
14 namespace v7 {
15 namespace postgresql {
16 
21 {
22 protected:
27 
28  void
29  _dump(std::function<void(int, int, const Coords& coords, const char* ident)>
30  out) override;
31 
32 public:
36  PostgreSQLStation(const PostgreSQLStation&) = delete;
37  PostgreSQLStation(const PostgreSQLStation&&) = delete;
38  PostgreSQLStation& operator=(const PostgreSQLStation&) = delete;
39 
40  DBStation lookup(Tracer<>& trc, int id_station) override;
41  int maybe_get_id(Tracer<>& trc, const dballe::DBStation& st) override;
42  int insert_new(Tracer<>& trc, const dballe::DBStation& desc) override;
43  void get_station_vars(
44  Tracer<>& trc, int id_station,
45  std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
46  void add_station_vars(Tracer<>& trc, int id_station,
47  DBValues& values) override;
48  void
49  run_station_query(Tracer<>& trc, const v7::StationQueryBuilder& qb,
50  std::function<void(const dballe::DBStation&)>) override;
51 };
52 
53 } // namespace postgresql
54 } // namespace v7
55 } // namespace db
56 } // namespace dballe
57 #endif
Definition: qbuilder.h:82
Database connection.
Definition: postgresql.h:239
void get_station_vars(Tracer<> &trc, int id_station, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
dballe::sql::PostgreSQLConnection & conn
DB connection.
Definition: postgresql/station.h:26
Precompiled queries to manipulate the station table.
Definition: postgresql/station.h:20
Coordinates.
Definition: types.h:371
Definition: cmdline.h:18
Definition: station.h:24
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:229
int maybe_get_id(Tracer<> &trc, const dballe::DBStation &st) override
Get the station ID given latitude, longitude and mobile identifier.
Definition: transaction.h:15
DBStation lookup(Tracer<> &trc, int id_station) override
Lookup station data by ID.
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:44
Definition: types.h:939
int insert_new(Tracer<> &trc, const dballe::DBStation &desc) override
Insert a new station in the database, without checking if it already exists.
void add_station_vars(Tracer<> &trc, int id_station, DBValues &values) override
Add all station variables (without attributes) to values.