libdballe  8.6
sqlite/station.h
1 #ifndef DBALLE_DB_V7_SQLITE_STATION_H
2 #define DBALLE_DB_V7_SQLITE_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 sqlite {
16 
20 class SQLiteStation : public v7::Station
21 {
22 protected:
27 
29  dballe::sql::SQLiteStatement* sfstm = nullptr;
31  dballe::sql::SQLiteStatement* smstm = nullptr;
35  dballe::sql::SQLiteStatement* ssdstm = nullptr;
36 
37  void _dump(std::function<void(int, int, const Coords& coords, const char* ident)> out) override;
38 
39 public:
41  ~SQLiteStation();
42  SQLiteStation(const SQLiteStation&) = delete;
43  SQLiteStation(const SQLiteStation&&) = delete;
44  SQLiteStation& operator=(const SQLiteStation&) = delete;
45 
46  DBStation lookup(Tracer<>& trc, int id_station) override;
47  int maybe_get_id(Tracer<>& trc, const dballe::DBStation& st) override;
48  int insert_new(Tracer<>& trc, const dballe::DBStation& desc) override;
49  void get_station_vars(Tracer<>& trc, int id_station, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
50  void add_station_vars(Tracer<>& trc, int id_station, DBValues& values) override;
51  void run_station_query(Tracer<>& trc, const v7::StationQueryBuilder& qb, std::function<void(const dballe::DBStation&)>) override;
52 };
53 
54 }
55 }
56 }
57 }
58 #endif
Definition: qbuilder.h:81
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
Precompiled queries to manipulate the station table.
Definition: sqlite/station.h:20
Definition: transaction.h:15
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:45
SQLite statement.
Definition: sqlite.h:98
Definition: types.h:850
dballe::sql::SQLiteConnection & conn
DB connection.
Definition: sqlite/station.h:26
Database connection.
Definition: sqlite.h:34