libdballe  7.29
v7/mysql/levtr.h
1 #ifndef DBALLE_DB_V7_MYSQL_LEVTRV7_H
2 #define DBALLE_DB_V7_MYSQL_LEVTRV7_H
3 
4 #include <dballe/db/db.h>
5 #include <dballe/db/v7/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 v7 {
20 namespace mysql {
21 struct DB;
22 
26 struct MySQLLevTr : public v7::LevTr
27 {
28 protected:
33 
34  void _dump(std::function<void(int, const Level&, const Trange&)> out) override;
35 
36 public:
38  MySQLLevTr(const LevTr&) = delete;
39  MySQLLevTr(const LevTr&&) = delete;
40  MySQLLevTr& operator=(const MySQLLevTr&) = delete;
41  ~MySQLLevTr();
42 
43  void prefetch_ids(const std::set<int>& ids, std::function<void(int, const LevTrDesc&)> dest) override;
44  void prefetch_same_level(int id, std::function<void(int, const LevTrDesc&)> dest) override;
45  levtrs_t::iterator lookup_id(State& st, int id) override;
46  levtrs_t::iterator obtain_id(State& state, const LevTrDesc& desc) override;
47 };
48 
49 
50 }
51 }
52 }
53 }
54 #endif
void prefetch_same_level(int id, std::function< void(int, const LevTrDesc &)> dest) override
Given an ID, load LevTr information for all the entries with the same level type. ...
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
levtrs_t::iterator lookup_id(State &st, int id) override
Look up a LevTr from the database given its ID.
Forward declarations for public dballe/sql names.
Vertical level or layer.
Definition: types.h:532
Functions used to connect to DB-All.e and insert, query and delete data.
void prefetch_ids(const std::set< int > &ids, std::function< void(int, const LevTrDesc &)> dest) override
Given a set of IDs, load LevTr information for them and add it to data.
Precompiled queries to manipulate the lev_tr table.
Definition: v7/levtr.h:25
dballe::sql::MySQLConnection & conn
DB connection.
Definition: v7/mysql/levtr.h:32
levtrs_t::iterator obtain_id(State &state, const LevTrDesc &desc) override
Look up a LevTr from the database given its description.
Precompiled queries to manipulate the lev_tr table.
Definition: v7/mysql/levtr.h:26
Definition: state.h:58
Database connection.
Definition: mysql.h:126