libdballe  7.7
db/odbc/levtr.h
Go to the documentation of this file.
1 /*
2  * db/odbc/lev_tr - lev_tr table management
3  *
4  * Copyright (C) 2005--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_ODBC_LEV_TR_H
23 #define DBALLE_DB_ODBC_LEV_TR_H
24 
31 #include <dballe/db/db.h>
32 #include <dballe/db/sql/levtr.h>
34 #include <cstdio>
35 #include <memory>
36 
37 namespace dballe {
38 struct Record;
39 struct Msg;
40 
41 namespace msg {
42 struct Context;
43 }
44 
45 namespace db {
46 struct Connection;
47 struct Statement;
48 
49 namespace odbc {
50 struct DB;
51 
55 struct ODBCLevTrV6 : public sql::LevTr
56 {
57 protected:
62 
64  db::Sequence* seq_lev_tr = nullptr;
65 
67  ODBCStatement* sstm = nullptr;
69  ODBCStatement* sdstm = nullptr;
71  ODBCStatement* istm = nullptr;
73  ODBCStatement* dstm = nullptr;
74 
75  DBRow working_row;
76 
83  int insert();
84 
91  int get_id();
92 
96  void remove();
97 
98 public:
100  ODBCLevTrV6(const LevTr&) = delete;
101  ODBCLevTrV6(const LevTr&&) = delete;
102  ODBCLevTrV6& operator=(const ODBCLevTrV6&) = delete;
103  ~ODBCLevTrV6();
104 
109  int obtain_id(const Level& lev, const Trange& tr) override;
110 
111  const DBRow* read(int id) override;
112  void read_all(std::function<void(const DBRow&)> dest) override;
113 
117  void dump(FILE* out) override;
118 };
119 
120 
121 }
122 }
123 }
124 #endif
125 
Precompiled queries to manipulate the lev_tr table.
Definition: db/odbc/levtr.h:55
ODBC statement.
Definition: odbc/internals.h:170
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.
ODBC statement to read a sequence.
Definition: odbc/internals.h:247
ODBCConnection & conn
DB connection.
Definition: db/odbc/levtr.h:61
Database functions and data structures used by the db module, but not exported as official API...
Precompiled queries to manipulate the lev_tr table.
Definition: db/sql/levtr.h:46
Database connection.
Definition: odbc/internals.h:87