libdballe  7.29
v6/sqlite/levtr.h
1 #ifndef DBALLE_DB_V6_SQLITE_LEVTRV6_H
2 #define DBALLE_DB_V6_SQLITE_LEVTRV6_H
3 
4 #include <dballe/db/db.h>
5 #include <dballe/db/v6/levtr.h>
6 #include <dballe/sql/fwd.h>
7 #include <cstdio>
8 #include <memory>
9 
10 namespace dballe {
11 struct Record;
12 struct Msg;
13 
14 namespace msg {
15 struct Context;
16 }
17 
18 namespace db {
19 namespace v6 {
20 namespace sqlite {
21 struct DB;
22 
26 struct SQLiteLevTrV6 : public v6::LevTr
27 {
28 protected:
33 
42 
43  DBRow working_row;
44 
45 public:
47  SQLiteLevTrV6(const LevTr&) = delete;
48  SQLiteLevTrV6(const LevTr&&) = delete;
49  SQLiteLevTrV6& operator=(const SQLiteLevTrV6&) = delete;
50  ~SQLiteLevTrV6();
51 
56  int obtain_id(const Level& lev, const Trange& tr) override;
57 
58  const DBRow* read(int id) override;
59  void read_all(std::function<void(const DBRow&)> dest) override;
60 
64  void dump(FILE* out) override;
65 };
66 
67 
68 }
69 }
70 }
71 }
72 #endif
dballe::sql::SQLiteStatement * istm
Precompiled insert statement.
Definition: v6/sqlite/levtr.h:39
void read_all(std::function< void(const DBRow &)> dest) override
Read the contents of the LevTr table.
Precompiled queries to manipulate the lev_tr table.
Definition: v6/sqlite/levtr.h:26
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
Forward declarations for public dballe/sql names.
dballe::sql::SQLiteConnection & conn
DB connection.
Definition: v6/sqlite/levtr.h:32
Vertical level or layer.
Definition: types.h:532
Functions used to connect to DB-All.e and insert, query and delete data.
dballe::sql::SQLiteStatement * sstm
Precompiled select statement.
Definition: v6/sqlite/levtr.h:35
Definition: v6/levtr.h:25
const DBRow * read(int id) override
Read the LevTr data for an id, returns nullptr if not found.
dballe::sql::SQLiteStatement * dstm
Precompiled delete statement.
Definition: v6/sqlite/levtr.h:41
Precompiled queries to manipulate the lev_tr table.
Definition: v6/levtr.h:23
dballe::sql::SQLiteStatement * sdstm
Precompiled select data statement.
Definition: v6/sqlite/levtr.h:37
SQLite statement.
Definition: sqlite.h:89
void dump(FILE *out) override
Dump the entire contents of the table to an output stream.
int obtain_id(const Level &lev, const Trange &tr) override
Return the ID for the given Level and Trange, adding it to the database if it does not already exist...
Database connection.
Definition: sqlite.h:34