libdballe  7.19
v6/mysql/station.h
1 #ifndef DBALLE_DB_V6_MYSQL_STATION_H
2 #define DBALLE_DB_V6_MYSQL_STATION_H
3 
4 #include <dballe/db/v6/station.h>
5 #include <dballe/sql/fwd.h>
6 #include <functional>
7 #include <memory>
8 
9 namespace wreport {
10 struct Var;
11 }
12 
13 namespace dballe {
14 namespace db {
15 namespace v6 {
16 namespace mysql {
17 
22 {
23 protected:
28 
30  bool maybe_get_id(int lat, int lon, const char* ident, int* id);
31 
33  void read_station_vars(const std::string& query, std::function<void(std::unique_ptr<wreport::Var>)> dest);
34 
35 public:
38  MySQLStationBase(const MySQLStationBase&) = delete;
39  MySQLStationBase(const MySQLStationBase&&) = delete;
40  MySQLStationBase& operator=(const MySQLStationBase&) = delete;
41 
50  int get_id(int lat, int lon, const char* ident=nullptr) override;
51 
60  int obtain_id(int lat, int lon, const char* ident=nullptr, bool* inserted=NULL) override;
61 
62  void get_station_vars(int id_station, int id_report, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
63  void add_station_vars(int id_station, Record& rec) override;
64 
68  void dump(FILE* out) override;
69 };
70 
72 {
73 public:
75 };
76 
77 }
78 }
79 }
80 }
81 #endif
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
Forward declarations for public dballe/sql names.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Precompiled queries to manipulate the station table.
Definition: v6/mysql/station.h:21
Definition: v6/station.h:18
Definition: v6/mysql/station.h:71
Database connection.
Definition: mysql.h:125
sql::MySQLConnection & conn
DB connection.
Definition: v6/mysql/station.h:27