Repinfo table management used by the db module. More...
#include <dballe/db/internals.h>
Go to the source code of this file.
Data Structures | |
struct | _dba_db_repinfo_cache |
repinfo cache entry More... | |
struct | _dba_db_repinfo_memoidx |
reverse rep_memo -> rep_cod cache entry More... | |
struct | _dba_db_repinfo |
Fast cached access to the repinfo table. More... | |
Typedefs | |
typedef struct _dba_db_repinfo_cache * | dba_db_repinfo_cache |
typedef struct _dba_db_repinfo_memoidx * | dba_db_repinfo_memoidx |
typedef struct _dba_db_repinfo * | dba_db_repinfo |
Functions | |
dba_err | dba_db_repinfo_create (dba_db db, dba_db_repinfo *ins) |
Create a new dba_db_repinfo. | |
void | dba_db_repinfo_delete (dba_db_repinfo ins) |
Delete a dba_db_repinfo. | |
void | dba_db_repinfo_invalidate_cache (dba_db_repinfo ins) |
Invalidate the repinfo cache. | |
dba_err | dba_db_repinfo_get_id (dba_db_repinfo ri, const char *memo, int *id) |
Get the id of a repinfo entry given its name. | |
dba_err | dba_db_repinfo_has_id (dba_db_repinfo ri, int id, int *exists) |
Check if the database contains the given rep_cod id. | |
dba_db_repinfo_cache | dba_db_repinfo_get_by_id (dba_db_repinfo ri, int id) |
Get a repinfo cache entry by id. | |
dba_db_repinfo_cache | dba_db_repinfo_get_by_memo (dba_db_repinfo ri, const char *memo) |
Get a repinfo cache entry by name. | |
dba_err | dba_db_repinfo_update (dba_db_repinfo ri, const char *deffile, int *added, int *deleted, int *updated) |
Update the report type information in the database using the data from the given file. |
Repinfo table management used by the db module.
typedef struct _dba_db_repinfo* dba_db_repinfo |
Fast cached access to the repinfo table.
typedef struct _dba_db_repinfo_cache* dba_db_repinfo_cache |
repinfo cache entry
typedef struct _dba_db_repinfo_memoidx* dba_db_repinfo_memoidx |
reverse rep_memo -> rep_cod cache entry
dba_err dba_db_repinfo_create | ( | dba_db | db, |
dba_db_repinfo * | ins | ||
) |
Create a new dba_db_repinfo.
db | The database accessed by this dba_db_repinfo. |
ins | The resulting dba_db_repinfo structure. |
References _dba_db_repinfo::cache, _dba_db_repinfo::cache_alloc_size, _dba_db_repinfo::cache_size, _dba_db_repinfo::db, DBA_RUN_OR_GOTO, and _dba_db_repinfo::memo_idx.
void dba_db_repinfo_delete | ( | dba_db_repinfo | ins ) |
Delete a dba_db_repinfo.
ins | The dba_db_repinfo to delete. |
References _dba_db_repinfo::cache.
dba_db_repinfo_cache dba_db_repinfo_get_by_id | ( | dba_db_repinfo | ri, |
int | id | ||
) |
Get a repinfo cache entry by id.
ri | dba_db_repinfo used for the query |
id | id to query |
References _dba_db_repinfo::cache.
dba_db_repinfo_cache dba_db_repinfo_get_by_memo | ( | dba_db_repinfo | ri, |
const char * | memo | ||
) |
Get a repinfo cache entry by name.
ri | dba_db_repinfo used for the query |
memo | name to query |
References _dba_db_repinfo_memoidx::id, and _dba_db_repinfo::memo_idx.
dba_err dba_db_repinfo_get_id | ( | dba_db_repinfo | ri, |
const char * | memo, | ||
int * | id | ||
) |
Get the id of a repinfo entry given its name.
ri | dba_db_repinfo used for the query |
memo | The name to query |
id | The resulting id. It will always be a valid one, because the functions fails if memo is not found. |
References dba_error_notfound, DBA_RUN_OR_RETURN, _dba_db_repinfo_memoidx::id, and _dba_db_repinfo::memo_idx.
dba_err dba_db_repinfo_has_id | ( | dba_db_repinfo | ri, |
int | id, | ||
int * | exists | ||
) |
Check if the database contains the given rep_cod id.
ri | dba_db_repinfo used for the query |
id | id to check |
exists | Set to true if id exists, else false. |
void dba_db_repinfo_invalidate_cache | ( | dba_db_repinfo | ins ) |
Invalidate the repinfo cache.
To be called if the repinfo table is modified externally; for example, when the table is recreated on database reset.
ins | The dba_db_repinfo whose cache is to be invalidated. |
References _dba_db_repinfo::cache, and _dba_db_repinfo::cache_size.
dba_err dba_db_repinfo_update | ( | dba_db_repinfo | ri, |
const char * | deffile, | ||
int * | added, | ||
int * | deleted, | ||
int * | updated | ||
) |
Update the report type information in the database using the data from the given file.
ri | dba_db_repinfo used to update the database |
deffile | Pathname of the file to use for the update. The NULL value is accepted and means to use the default configure repinfo.csv file. |
added | Number of entries that have been added during the update. |
deleted | Number of entries that have been deleted during the update. |
updated | Number of entries that have been updated during the update. |
References _dba_db_repinfo::cache, _dba_db_repinfo::cache_size, _dba_db_repinfo::db, dba_error_consistency, DBA_RUN_OR_GOTO, DBA_RUN_OR_RETURN, _dba_db_repinfo_cache::id, _dba_db_repinfo_cache::memo, _dba_db_repinfo_cache::new_desc, _dba_db_repinfo_cache::new_descriptor, _dba_db_repinfo_cache::new_memo, _dba_db_repinfo_cache::new_prio, and _dba_db_repinfo_cache::new_tablea.