libcmdbm 0.2.0
MyBatis-like SQL mapping library for C99
Loading...
Searching...
No Matches
The context: configuration, datasources and

Data Structures

struct  CMDBM_Context
 The root object: the datasources of an application and the sessions which use them. More...
 

Functions

CMDBM_ContextCMDBM_ContextCreate (const char *confjson, const char *progcharset, CMUTIL_Timer *timer)
 Create a context, optionally from a configuration file.
 

Detailed Description

sessions.

Function Documentation

◆ CMDBM_ContextCreate()

CMDBM_Context * CMDBM_ContextCreate ( const char *  confjson,
const char *  progcharset,
CMUTIL_Timer *  timer 
)

Create a context, optionally from a configuration file.

With a configuration file this is the only call an application needs: the datasources declared in it are created, started and ready to be used through a session when it returns. Without one the context comes up empty, to be filled with CMDBM_DatabaseCreate and CMDBM_Context::AddDatabase.

Parameters
confjsonPath of the JSON configuration file, or NULL for an empty context. A file which cannot be read leaves the context empty as well; one which parses but is not valid configuration fails the call.
progcharsetThe character set the application works in, "UTF-8" when NULL. Results are converted to it.
timerThe timer to schedule the mapper reload tasks and the pool maintenance on, or NULL to have the context keep one of its own. A timer passed in is not destroyed with the context, and must outlive it.
Returns
The context, or NULL when the configuration could not be applied.