libdballe  7.6
db/mysql/levtr.h
1 /*
2  * db/mysql/lev_tr - lev_tr table management
3  *
4  * Copyright (C) 2015 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef DBALLE_DB_MYSQL_LEVTRV6_H
23 #define DBALLE_DB_MYSQL_LEVTRV6_H
24 
25 #include <dballe/db/db.h>
26 #include <dballe/db/sql/levtr.h>
27 #include <dballe/db/mysql/internals.h>
28 #include <cstdio>
29 #include <memory>
30 
31 namespace dballe {
32 struct Record;
33 struct Msg;
34 
35 namespace msg {
36 struct Context;
37 }
38 
39 namespace db {
40 struct Connection;
41 
42 namespace mysql {
43 struct DB;
44 
48 struct MySQLLevTrV6 : public sql::LevTr
49 {
50 protected:
53 
54  DBRow working_row;
55 
56 public:
58  MySQLLevTrV6(const LevTr&) = delete;
59  MySQLLevTrV6(const LevTr&&) = delete;
60  MySQLLevTrV6& operator=(const MySQLLevTrV6&) = delete;
61  ~MySQLLevTrV6();
62 
67  int obtain_id(const Level& lev, const Trange& tr) override;
68 
69  const DBRow* read(int id) override;
70  void read_all(std::function<void(const DBRow&)> dest) override;
71 
75  void dump(FILE* out) override;
76 };
77 
78 
79 }
80 }
81 }
82 #endif
83 
const DBRow * read(int id) override
Read the LevTr data for an id, returns nullptr if not found.
Database connection.
Definition: mysql/internals.h:145
void dump(FILE *out) override
Dump the entire contents of the table to an output stream.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:565
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Vertical level or layer.
Definition: types.h:515
Functions used to connect to DB-All.e and insert, query and delete data.
Precompiled queries to manipulate the lev_tr table.
Definition: db/mysql/levtr.h:48
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...
Precompiled queries to manipulate the lev_tr table.
Definition: db/sql/levtr.h:46
MySQLConnection & conn
DB connection.
Definition: db/mysql/levtr.h:52