The dbx command

The dbx command is used to manage database driver extensions. The command has the following subcommands:

dbx defined

dbx defined dbtype

Check whether a driver module for the specified database type is either already loaded, or available. If a module can be found, and it not yet loaded, it is automatically loaded.

The return value is a boolean status code. No error is generated when the database type cannot be resolved to a module.

dbx exists

dbx exists dbtype

Check whether a driver module for the specified database type is already loaded. No attempt is made to auto-load a module if it is not already loaded.

The return value is a boolean status code. No error is generated when the database type cannot be resolved to a module.

dbx get

dbx get dbtype attribute

Get an attribute the database driver module. The following attributes can be queried:

dbx list

dbx list ?pattern?

Return a list of all currently loaded database driver modules. The output may be filtered by a string pattern. Its syntax is the same as in standard Tcl command string match .

dbx load

dbx load dbtype ?objectfile?
dbx load all

Load or re-load a database interface module. If no object file name is specified, the name of the shared library, DLL or bundle is automatically constructed from the database type name, and the module is located by traversing the database module path, which is accessible via the control array element ::cactvs(databasepath) , but this mechanism can be overridden by specifying an explicit object file with or without a path.

The all command variant locates all currently available database interface modules in the module search path and loads these. This is primarily useful for automatic database interface attribute documentation.

Example:

dbx load mysql

Above statement locates and loads the standard driver for interacting with Mysql and Mariadb databases. Depending on the platform, the object file would be named dbx_mysql.so , dbx_mysql.dll, etc.. It is located in the module directory of a standard Cactvs distribution. The return value of the command is the driver table slot number the module was loaded into.

In case the interface module is already loaded, the current module is unloaded first, so this command can be used to update a driver in a running application. Nevertheless, swapping a driver while database access objects which rely on this driver are in existence in the current process is usually not a good idea, though the details on whether this is possible or not depend on the module implementation.

dbx subcommands

dbx subcommands

This command returns a list of all the defined subcommands of the dbx command.

dbx unload

dbx unload ?dbtype?..

Unload zero or more database connector modules. Built-in modules cannot be unloaded. Unloading connector modules for which there are currently active database management objects is potentially dangerous.