libdballe  7.7
odbc/repinfo.h
Go to the documentation of this file.
1 /*
2  * db/odbc/repinfo - repinfo 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_REPINFO_H
23 #define DBALLE_DB_ODBC_REPINFO_H
24 
31 #include <dballe/db/sql/repinfo.h>
32 #include <vector>
33 #include <string>
34 #include <map>
35 
36 namespace dballe {
37 struct Record;
38 
39 namespace db {
40 struct ODBCConnection;
41 
42 namespace odbc {
43 
48 {
54 
56  ODBCRepinfoBase(const ODBCRepinfoBase&) = delete;
57  ODBCRepinfoBase(const ODBCRepinfoBase&&) = delete;
58  virtual ~ODBCRepinfoBase();
59  ODBCRepinfoBase& operator=(const ODBCRepinfoBase&) = delete;
60 
61  void dump(FILE* out) override;
62 
63 protected:
64  int id_use_count(unsigned id, const char* name) override;
65  void delete_entry(unsigned id) override;
66  void update_entry(const sql::repinfo::Cache& entry) override;
67  void insert_entry(const sql::repinfo::Cache& entry) override;
68 
69  void read_cache() override;
70  void insert_auto_entry(const char* memo) override;
71 };
72 
74 {
76 
77 protected:
78  int id_use_count(unsigned id, const char* name) override;
79 };
80 
81 }
82 }
83 }
84 #endif
85 
Fast cached access to the repinfo table.
Definition: odbc/repinfo.h:47
int id_use_count(unsigned id, const char *name) override
Return how many time this ID is used in the database.
void dump(FILE *out) override
Dump the entire contents of the database to an output stream.
void delete_entry(unsigned id) override
Delete a repinfo entry.
ODBCConnection & conn
DB connection.
Definition: odbc/repinfo.h:53
void update_entry(const sql::repinfo::Cache &entry) override
Update an entry using the new_* fields of entry.
void insert_auto_entry(const char *memo) override
Create an automatic entry for a missing memo, and insert it in the database.
int id_use_count(unsigned id, const char *name) override
Return how many time this ID is used in the database.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Definition: odbc/repinfo.h:73
repinfo cache entry
Definition: sql/repinfo.h:30
Fast cached access to the repinfo table.
Definition: sql/repinfo.h:77
void read_cache() override
Reread the repinfo cache from the database.
Repinfo table management used by the db module.
void insert_entry(const sql::repinfo::Cache &entry) override
Insert an entry using the new_* fields of entry.
Database connection.
Definition: odbc/internals.h:87