Libraries are no static entities, just as any other piece of software. Some parts evolve, some optimizations are made, new features are requested, and old features may be too cumbersome to support if no one uses them anyway. Any of these developments may result in a new release. This chapter briefly discusses the issues related to library and driver versions.

The version issues with libdbi are a little more convoluted than with a run-of-the-mill library because we have to consider two application interfaces (APIs):

DBI API

- This is, as with any other library, the data structures and the functions that you, as a programmer of a software linked against libdbi, need to know about.

DBD API

- This is the interface that matters to the authors of database engine drivers.

Both interfaces may change independently, and both may affect the version number of the package as will be discussed shortly.

# Package and library versions

libdbi utilizes libtool to manage the library in a platform-independent fashion. libtool uses an abstract library versioning scheme which consists of three numbers:

current

- This is the number of the current interface. The first "incarnation" is usually 0 (zero), the next version that adds or subtracts something from this interface would be 1 (think of new API functions or functions with altered parameter lists).

revision

- This number counts the released changes of the interface which do not alter the interface (think of internal optimizations, bugfixes and so on)

age

- This is the number of previous interfaces that the current version is backwards-compatible with. That is, if `current` is "n", programs linked against "n", "n-1", and "n-2" will run with the current version.

The package version number (major.minor.patch) is computed from the above numbers using the formulas:

- major = current - age

- minor = age + 8

- patch = revision

The correction applied to `minor` is currently required to bring the package version in line with earlier releases which did not use proper libtool interface versioning. It will be dropped if `major` rises above zero.

## libdbi and libdbi-drivers versions

The libdbi-drivers package is essentially developed independently of libdbi as most new versions are mandated by improvements of existing drivers and by the implementation of new drivers. However, both changes in the DBD API and in the DBI API (which is also accessible to the drivers) may also require a new libdbi-drivers version. In order to keep the confusion at a minimum, libdbi-drivers major and minor version numbers are chosen to match the libdbi versions they are compatible with. That is, any libdbi-drivers version 0.9.* is supposed to work with any libdbi version 0.9.*. Further compatibility information, e.g. whether a putative libdbi version 2.* is able to load libdbi-drivers 1.* are found in the release notes.

## Determining the library version at runtime

The functions dbi-version and dbi-version-numeric provide access to the package version. The former returns the name and the version as a string (mainly for display purposes), whereas the latter returns an integer value for easy comparisons, defined as ((major*10000) + (minor * 100) + patch).