Database Independent Abstraction Layer for C: libdbi Driver Author's Guide | ||
---|---|---|
Prev | Chapter 2. Driver Infrastructure | Next |
Driver capabilities are essentially an array of key/value pairs which the drivers set when they're loaded. Both the libdbi framework and programs linked against libdbi can query these capabilities and adjust their behaviour accordingly.
The perfect place to set driver capabilities is in the dbd_initialize function which is called right after the driver is loaded by libdbi. To set capabilities, call the _dbd_register_driver_cap function for each of them:
driver: the driver as passed to dbd_initialize.
capname: A string containing the name of the capability (i.e. the key).
value: The value of the capability.
libdbi currently queries only one driver capability.
A nonzero value indicates that the driver can safely be unloaded from memory by calling dlclose(). A value of 0 (zero) indicates that the driver should not be unloaded when libdbi is shut down. Drivers must not be unloaded if they, or any library they are linked against, install exit handlers via atexit() as this would leave dangling pointers, causing segfaults on some platforms.