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