libdballe  9.11
mysql/station.h
1 #ifndef DBALLE_DB_V7_MYSQL_STATION_H
2 #define DBALLE_DB_V7_MYSQL_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 mysql {
16 
20 class MySQLStation : public v7::Station
21 {
22 protected:
27 
28  void _dump(std::function<void(int, int, const Coords& coords, const char* ident)> out) override;
29 
30 public:
32  ~MySQLStation();
33  MySQLStation(const MySQLStation&) = delete;
34  MySQLStation(const MySQLStation&&) = delete;
35  MySQLStation& operator=(const MySQLStation&) = 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
Definition: qbuilder.h:81
void get_station_vars(Tracer<> &trc, int id_station, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
Coordinates.
Definition: types.h:368
Definition: cmdline.h:18
Definition: station.h:24
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:191
DBStation lookup(Tracer<> &trc, int id_station) override
Lookup station data by ID.
Definition: transaction.h:15
int maybe_get_id(Tracer<> &trc, const dballe::DBStation &st) override
Get the station ID given latitude, longitude and mobile identifier.
dballe::sql::MySQLConnection & conn
DB connection.
Definition: mysql/station.h:26
int insert_new(Tracer<> &trc, const dballe::DBStation &desc) override
Insert a new station in the database, without checking if it already exists.
Precompiled queries to manipulate the station table.
Definition: mysql/station.h:20
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:45
void add_station_vars(Tracer<> &trc, int id_station, DBValues &values) override
Add all station variables (without attributes) to values.
Definition: types.h:850
Database connection.
Definition: mysql.h:126