OpenDBX: An unified database API and C library

91
Norbert Sendetzky writes “The release of version 1.0 marks a major step in the development process of the
OpenDBX project.
Envisioned as a clean and lightweight Open Source API for
accessing native databases libraries, the interface and its implementation have
proven their stability and completeness in different applications. Version 1.0
is the first in a series of milestones for providing a fast, easy to use and
extensible C API for all developers.

Some of you may ask: Why do we need another database API at all?
Fact is that most applications rather implement plugins for accessing databases
of their own and there are only a few libraries trying to archive independence
from the native database libraries by implementing a real C interface. There are
a few more trying to do that by providing C++ classes but it’s difficult to use
a C++ library from a C program. The other way round is possible without any
problems.

The remaining C libraries which can be found share at least one of
the following problems: They were developed for a project and are not actively
maintained any more or the designer of the library interface used his favorite
database API and tried to adapt other database libraries to this API. In both
cases the results are poor. Either you build your application on an API with an
unknown future or you have to cope with a library whose functions may or may
not be available in the same way depending on the database backend.

To avoid both problems, the OpenDBX library was build from the ground up as a
project of its own which included a rather long design phase for a freely
available Open Source project. It started with an analysis of APIs of all major
database vendors regardless of being Open Source or proprietary to get a feeling
of their similarities. By eliminating all functions that were only available in
one or a few native database libraries, a core set remained. The basic
functions of all native libraries were unified to one function call and all of
these functions had to prove its value before they were accepted as part of the
interface.

The result was a set of functions that can be implemented without
problems and have to be implemented by backends handling native database
libraries. Two additional functions for managing database specific options
were included and one for testing available capabilities. Capabilities
are sets of functions which do not belong to the essential basic set but
provide features which might be worth using such as prepared statements or
large objects.

All efforts resulted in a very clean and lightweight database C API where all
functions behave in the same way regardless of the backend and with the support
of standards such as the SQL 2003 data types. Developers don’t have to care
about the pitfalls of each native API any more but can concentrate on their
real work.

The future of the OpenDBX project is bright. Currently it provides backends for
MySQL, PostgreSQL, SQLite and SQLite3 and the next development release will
include backends for the Firebird database server and MSSQL/Sybase support via
the FreeTDS backend. The PowerDNS project already contains a backend which
uses the OpenDBX library and it has already proven its

superior performance
over the application specific database backends.

The OpenDBX library is already included in the FreeBSD ports system and will be
part of the Debian repository in the near future. The next milestone is now to
define the capability set for prepared statements.”

Link: linuxnetworks.de