22 #ifndef DBALLE_DB_V5_REPINFO_H
23 #define DBALLE_DB_V5_REPINFO_H
50 DBALLE_SQL_C_UINT_TYPE
id;
57 DBALLE_SQL_C_SINT_TYPE
prio;
74 Cache(
int id,
const std::string& memo,
const std::string& desc,
int prio,
const std::string& descriptor,
int tablea);
86 bool operator<(
const Memoidx& memo)
const;
97 std::vector<repinfo::Cache>
cache;
134 void update(
const char* deffile,
int* added,
int* deleted,
int* updated);
145 int get_id(
const char* memo)
const;
167 bool has_id(
unsigned id)
const;
202 void dump(FILE* out);
206 virtual int id_use_count(
unsigned id,
const char* name);
209 void cache_append(
unsigned id,
const char* memo,
const char* desc,
int prio,
const char* descriptor,
int tablea);
210 void rebuild_memo_idx()
const;
211 int cache_find_by_memo(
const char* memo)
const;
212 int cache_find_by_id(
unsigned id)
const;
213 std::vector<repinfo::Cache> read_repinfo_file(
const char* deffile);
int obtain_id(const char *memo)
Get the id of a repinfo entry given its name.
std::string desc
Report description.
Definition: db/v5/repinfo.h:55
std::vector< int > ids_by_prio(const Record &rec) const
Return a vector of IDs matching the priority constraints in the given record.
Connection * conn
DB connection.
Definition: db/v5/repinfo.h:107
Fast cached access to the repinfo table.
Definition: db/v5/repinfo.h:94
int id
Report code.
Definition: db/v5/repinfo.h:84
virtual int id_use_count(unsigned id, const char *name)
Return how many time this ID is used in the database.
Database connection.
Definition: internals.h:124
std::map< std::string, int > get_priorities() const
Get a mapping between rep_memo and their priorities.
The ODBC specification is imperfect with regards to integer sizes on 64bit platforms, and different ODBC drivers are currently interpreting it differently.
DBALLE_SQL_C_UINT_TYPE tablea
Report A table value (currently unused)
Definition: db/v5/repinfo.h:61
void dump(FILE *out)
Dump the entire contents of the table to an output stream.
void update(const char *deffile, int *added, int *deleted, int *updated)
Update the report type information in the database using the data from the given file.
DB-All.E record.
Definition: record.h:102
DBALLE_SQL_C_UINT_TYPE new_tablea
New report A table value used when updating the repinfo table.
Definition: db/v5/repinfo.h:72
void invalidate_cache()
Invalidate the repinfo cache.
reverse rep_memo -> rep_cod cache entry
Definition: db/v5/repinfo.h:79
std::string new_descriptor
New report descriptor used when updating the repinfo table.
Definition: db/v5/repinfo.h:70
const repinfo::Cache * get_by_memo(const char *memo) const
Get a repinfo cache entry by name.
std::string new_desc
New report description used when updating the repinfo table.
Definition: db/v5/repinfo.h:66
const repinfo::Cache * get_by_id(unsigned id) const
Get a repinfo cache entry by id.
std::string memo
Report name.
Definition: db/v5/repinfo.h:53
std::vector< repinfo::Cache > cache
Cache of table entries.
Definition: db/v5/repinfo.h:97
std::vector< repinfo::Memoidx > memo_idx
rep_memo -> rep_cod reverse index
Definition: db/v5/repinfo.h:100
DBALLE_SQL_C_UINT_TYPE id
Report code.
Definition: db/v5/repinfo.h:50
DBALLE_SQL_C_SINT_TYPE prio
Report priority.
Definition: db/v5/repinfo.h:57
bool has_id(unsigned id) const
Check if the database contains the given rep_cod id.
void insert_auto_entry(const char *memo)
Create an automatic entry for a missing memo, and insert it in the database.
repinfo cache entry
Definition: db/v5/repinfo.h:47
std::string descriptor
Report descriptor (currently unused)
Definition: db/v5/repinfo.h:59
std::string new_memo
New report name used when updating the repinfo table.
Definition: db/v5/repinfo.h:64
std::string memo
Report name.
Definition: db/v5/repinfo.h:82
int get_id(const char *memo) const
Get the id of a repinfo entry given its name.
DBALLE_SQL_C_SINT_TYPE new_prio
New report priority used when updating the repinfo table.
Definition: db/v5/repinfo.h:68