7.1. Instance Infrastructure

7.1.1. dbi_initialize_r

int dbi_initialize_r(const char *driverdir, dbi_inst *pInst);

Creates an instance of libdbi, locates all available database drivers and loads them into memory.

Arguments

driverdir: The directory to search for drivers. If NULL, DBI_DRIVER_DIR (defined at compile time) will be used instead.

pInst: A pointer to an instance handle. The function will fill in the new instance handle if successful, or set it to NULL if an error occurred.

Returns

The number of drivers successfully loaded, or -1 if there was an error. The latter may be due to an incorrect driver directory or to a lack of permissions.

Availability

0.9.0

7.1.2. dbi_initialize

int dbi_initialize(const char *driverdir);

Locates all available database drivers and loads them into memory.

Note: This function is deprecated. Use dbi_initialize_r instead. In contrast to that function, dbi_initialize allows only one (internally managed) libdbi instance per process.

Arguments

driverdir: The directory to search for drivers. If NULL, DBI_DRIVER_DIR (defined at compile time) will be used instead.

Returns

The number of drivers successfully loaded, or -1 if there was an error.

7.1.3. dbi_shutdown_r

void dbi_shutdown_r(dbi_inst Inst);

Frees all loaded drivers and terminates the libdbi instance. You should close each connection you opened before shutting down, but libdbi will clean up after you if you don't.

Arguments

Inst: The instance handle.

Availability

0.9.0

7.1.4. dbi_shutdown

void dbi_shutdown(void);

Frees all loaded drivers and terminates the DBI system. You should close each connection you opened before shutting down, but libdbi will clean up after you if you don't.

Note: This function is deprecated. Use dbi_shutdown_r instead.

7.1.5. dbi_set_verbosity_r

int dbi_set_verbosity_r(int verbosity, dbi_inst Inst);

Toggles internal error messages on or off in the given libdbi instance. This affects only those error messages which are directly sent to stderr, not those handled by the connection error API.

Arguments

verbosity: A nonzero value causes error messages to be printed on stderr. 0 (zero) suppresses error messages.

Inst: The instance handle.

Returns

The previous setting of verbosity.

Availability

0.9.0

7.1.6. dbi_set_verbosity

int dbi_set_verbosity(int verbosity);

Toggles internal error messages on or off. This affects only those error messages which are directly sent to stderr, not those handled by the connection error API.

Note: This function is deprecated. Use dbi_set_verbosity_r instead.

Arguments

verbosity: A nonzero value causes error messages to be printed on stderr. 0 (zero) suppresses error messages.

Returns

The previous setting of verbosity.

7.1.7. dbi_version

const char *dbi_version(void);

Requests the version of libdbi as a read-only string. The calling program must not attempt to free the returned string.

Returns

A string containing the library's name and version.

7.1.8. dbi_version_numeric

unsigned int dbi_version_numeric(void);

Requests the version of libdbi as an integer.

Returns

The version, computed as ((major * 10000) + (minor * 100) + patch).

Availability

0.9.0