rendered paste body/* DBA */
#define CONFIG_TABLE_NAME "config"
/* Row fetch handler type */
typedef int (*DBRowHandler) ( void *data, int size );
/* Row fetch handler type version 2 (returns key as well) */
typedef int (*DBRowHandler2) ( char *key, void *data, int size );
/* DB API */
EXPORTFUNC int DBAOpenDatabase( void );
EXPORTFUNC int DBACloseDatabase( void );
EXPORTFUNC int DBAOpenTable( const char *table );
EXPORTFUNC int DBACloseTable( const char *table );
EXPORTFUNC int DBAStore( const char *table, const char *key, void *data, int size );
EXPORTFUNC int DBAFetch( const char *table, const char *key, void *data, int size );
EXPORTFUNC int DBADelete( const char *table, const char * key );
EXPORTFUNC int DBAFetchRows( const char *table, DBRowHandler handler );
EXPORTFUNC int DBAFetchRows2( const char *table, DBRowHandler2 handler );
/* DB API Macros to wrap common types */
#define DBAStoreBool( table, key, data ) DBAStore( table, key, ( void * )data, sizeof ( int ) )
#define DBAStoreInt( table, key, data ) DBAStore( table, key, ( void * )data, sizeof ( int ) )
#define DBAStoreStr( table, key, data, size ) DBAStore( table, key, ( void * )data, size)
#define DBAFetchBool( table, key, data ) DBAFetch( table, key, ( void * )data, sizeof ( int ) )
#define DBAFetchInt( table, key, data ) DBAFetch( table, key, ( void * )data, sizeof ( int ) )
#define DBAFetchStr( table, key, data, size ) DBAFetch( table, key, ( void * )data, size)
/* DB API Macros to wrap common config types */
#define DBAStoreConfigBool( key, data ) DBAStoreBool(CONFIG_TABLE_NAME, key, data)
#define DBAStoreConfigInt( key, data ) DBAStoreInt(CONFIG_TABLE_NAME, key, data)
#define DBAStoreConfigStr( key, data, size ) DBAStoreStr(CONFIG_TABLE_NAME, key, data, size)
#define DBAFetchConfigBool( key, data ) DBAFetchBool(CONFIG_TABLE_NAME, key, data)
#define DBAFetchConfigInt( key, data ) DBAFetchInt(CONFIG_TABLE_NAME, key, data)
#define DBAFetchConfigStr( key, data , size) DBAFetchStr(CONFIG_TABLE_NAME, key, data, size)