repinfo.h File Reference


Detailed Description

Repinfo table management used by the db module.

#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
 repinfo cache entry
typedef struct
_dba_db_repinfo_memoidx
dba_db_repinfo_memoidx
 reverse rep_memo -> rep_cod cache entry
typedef struct _dba_db_repinfodba_db_repinfo
 Fast cached access to the repinfo table.

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.


Function Documentation

dba_err dba_db_repinfo_create ( dba_db  db,
dba_db_repinfo ins 
)

Create a new dba_db_repinfo.

Parameters:
db The database accessed by this dba_db_repinfo.
Return values:
ins The resulting dba_db_repinfo structure.
Returns:
The error indicator for the function (See error.h)

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.

Parameters:
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.

Parameters:
ri dba_db_repinfo used for the query
id id to query
Returns:
The dba_db_repinfo_cache structure found, or NULL if none was found.

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.

Parameters:
ri dba_db_repinfo used for the query
memo name to query
Returns:
The dba_db_repinfo_cache structure found, or NULL if none was found.

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.

Parameters:
ri dba_db_repinfo used for the query
memo The name to query
Return values:
id The resulting id. It will always be a valid one, because the functions fails if memo is not found.
Returns:
The error indicator for the function (See error.h)

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.

Parameters:
ri dba_db_repinfo used for the query
id id to check
Return values:
exists Set to true if id exists, else false.
Returns:
The error indicator for the function (See error.h)

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.

Parameters:
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.

Parameters:
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.
Return values:
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.


Generated on Sun May 18 19:50:17 2008 for libdballe by  doxygen 1.5.5