libcmdbm 0.2.0
MyBatis-like SQL mapping library for C99
Loading...
Searching...
No Matches
DBMS modules and the module interface.

Data Structures

struct  CMDBM_ModuleInterface
 The set of callbacks a DBMS module implements. More...
 

Functions

CMBool CMDBM_RegisterDBMS (const char *dbmskey, CMDBM_ModuleInterface *modif)
 Make a DBMS module available under a name.
 

Detailed Description

A module is what turns the generic query machinery into calls of a particular client library. The modules for MySQL/MariaDB, PostgreSQL, SQLite, Oracle and ODBC ship with the library and are registered by CMDBM_Init when they are compiled in; an application can add its own with CMDBM_RegisterDBMS.

Only CMDBM_ModuleInterface::Initialize, CMDBM_ModuleInterface::CleanUp and CMDBM_ModuleInterface::OpenConnection know anything about connection parameters. Everything else works on the opaque pointers those return, so a module never has to know how the library is configured.

Function Documentation

◆ CMDBM_RegisterDBMS()

CMBool CMDBM_RegisterDBMS ( const char *  dbmskey,
CMDBM_ModuleInterface modif 
)

Make a DBMS module available under a name.

The name is what a datasource asks for - the type of the configuration, or the dbmskey of CMDBM_DatabaseCreate - and is matched case insensitively. Registering a name which is taken replaces it, which is how a module of an application can override one that ships with the library.

The registry keeps modif by pointer, so it must live until CMDBM_Clear; each datasource created from it takes its own copy.

Parameters
dbmskeyThe name to register the module under.
modifThe module interface.
Returns
CMTrue.