|
libcmdbm 0.2.0
MyBatis-like SQL mapping library for C99
|
Data Structures | |
| struct | CMDBM_PoolConfig |
| How a datasource pools its connections. More... | |
| struct | CMDBM_Database |
| A datasource: one database, its pool and its statements. More... | |
Functions | |
| CMDBM_Database * | CMDBM_DatabaseCreate (const char *sourceid, const char *dbmskey, const char *dbcharset, CMDBM_PoolConfig *poolconf, CMUTIL_JsonObject *params) |
| Build a datasource in code. | |
A datasource is one database: the module which talks to it, the pool of connections to it, and the mapper files whose statements may be run against it. Applications which keep their configuration in the JSON file never build one by hand - CMDBM_ContextCreate does it - but the objects are public so that a datasource can be assembled in code.
| CMDBM_Database * CMDBM_DatabaseCreate | ( | const char * | sourceid, |
| const char * | dbmskey, | ||
| const char * | dbcharset, | ||
| CMDBM_PoolConfig * | poolconf, | ||
| CMUTIL_JsonObject * | params | ||
| ) |
Build a datasource in code.
Nothing is opened here. The module is initialized, the pool filled and the mappers loaded when the datasource is handed to CMDBM_Context::AddDatabase, so mappers and the monitor interval are set between the two calls.
Both poolconf and params are copied, and the caller keeps ownership of what it passed in.
| sourceid | The id sessions will name this datasource by. |
| dbmskey | The registered name of the DBMS module - "PGSQL", "MARIA", "SQLITE", "ORACLE", "ODBC" or one of an application's own. Matched case insensitively. |
| dbcharset | The character set the database stores text in. |
| poolconf | How the connections are pooled. |
| params | The connection parameters, handed to CMDBM_ModuleInterface::OpenConnection as they are - which keys are expected is up to the module. |