|
libcmdbm 0.2.0
MyBatis-like SQL mapping library for C99
|
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. | |
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.
| 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.
| dbmskey | The name to register the module under. |
| modif | The module interface. |