libdballe  7.6
sqlite/attrv6.h
1 /*
2  * db/sqlite/attr - attribute 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_SQLITE_ATTRV6_H
23 #define DBALLE_DB_SQLITE_ATTRV6_H
24 
25 #include <dballe/db/sql/attrv6.h>
26 #include <dballe/db/sqlite/internals.h>
27 
28 namespace dballe {
29 namespace db {
30 namespace sqlite {
31 
35 class SQLiteAttrV6 : public sql::AttrV6
36 {
37 protected:
40 
42  SQLiteStatement* sstm = nullptr;
44  SQLiteStatement* istm = nullptr;
46  SQLiteStatement* ustm = nullptr;
47 
48 public:
50  SQLiteAttrV6(const SQLiteAttrV6&) = delete;
51  SQLiteAttrV6(const SQLiteAttrV6&&) = delete;
52  SQLiteAttrV6& operator=(const SQLiteAttrV6&) = delete;
53  ~SQLiteAttrV6();
54 
55  void insert(Transaction& t, sql::bulk::InsertAttrsV6& vars, UpdateMode update_mode=UPDATE) override;
56 
65  void read(int id_data, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
66 
70  void dump(FILE* out) override;
71 };
72 
73 }
74 }
75 }
76 #endif
void dump(FILE *out) override
Dump the entire contents of the table to an output stream.
Definition: sql/attrv6.h:103
SQLite statement.
Definition: sqlite/internals.h:124
Precompiled queries to manipulate the attr table.
Definition: sql/attrv6.h:46
Database connection.
Definition: sqlite/internals.h:56
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
SQLiteStatement * ustm
Precompiled update statement.
Definition: sqlite/attrv6.h:46
void read(int id_data, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Load from the database all the attributes for var.
SQLiteStatement * istm
Precompiled insert statement.
Definition: sqlite/attrv6.h:44
A RAII transaction interface.
Definition: sql.h:134
void insert(Transaction &t, sql::bulk::InsertAttrsV6 &vars, UpdateMode update_mode=UPDATE) override
Bulk attribute insert.
Precompiled queries to manipulate the attr table.
Definition: sqlite/attrv6.h:35
SQLiteStatement * sstm
Precompiled select statement.
Definition: sqlite/attrv6.h:42
SQLiteConnection & conn
DB connection.
Definition: sqlite/attrv6.h:39