MySQL C++ API (mysqlcppapi)
Introduction
mysqlcppapi is a C++ wrapper for the MySQL C API library.
It is a branch of the MySql++ project, but it has diverged significantly
for the following reasons:
MySQL++ is aggressively optimised for speed, but optimisation should happen
after the design is mature, and that optimisation should be targeted. Premature
optimisation obscures the design and prevents it from improving.
MySQL++ provides too many ways to do things instead of deciding on
an interface. Again, this obscures the design.
MySQL++ uses preprocessor macros to an extent that is unacceptable in a
C++ library.
These considerations mean that the interface has changed significantly
and some areas of functionality have been removed completely because they
are not maintainable. Some of this functionality may be added in future
versions if it can be implemented in a sensible way. New types of interfaces
should be added by subclassing or aggregating the existing simple classes
rather than complicating the existing interfaces.
As of mid-2005 the MySQL++ library is in new hands and is much improved.
It is worth noting that MySQL++ is more actively maintained than mysqlcppapi
and it might be a better choice to use.
Here are the major changes:
All objects are classes with constructors and destructors, so all data
is initialized.
Reference-counting is used to allow sharing of the various object instances and underlying connections, avoiding segfaults
or complicated memory management.
All classes are in the mysqlcppapi namespace
There is now no public member data.
Many methods have been un-inlined, allowing a much clearer file structure.
The 'custom' and stored query interfaces have been removed because they
made excessive use of preprocessor macros and perl-generated code.
Exceptions are no longer optional - they are part of the design.
The fields classes have been completely replaced.
If you disagree with these design decisions then please ignore this
library and continue with the MySQL++ code base. I created this branch
because I needed it for my own use.
New functionality:
The FieldInfo class can generate the text needed to create a field in a
MySQL query.
The FieldInfo::sql() method will prepare a field value for a MySQL query.
The Connection can supply a list of tables and the field information for
any table.
Download
You can download mysqlcppapi from here.
A standalone example project is also available.
Required Libraries
MySQL client library.
Development
The CVS repository, mailing
list, bug tracker, and task manager are at
sourceforge.
The CVS snapshot is available here.
Authors
Use the mailing
list. If you email me directly about mysqlcppapi then I will ignore you.
Current maintainer:
Jonathan Wakely
mysqlcppapi v1.7.1 (branch of MySql++ 1.7) to v1.9.3:
Murray Cumming
MySql++ versions 1.2 and higher (1.7):
Sinisa Milivojevic
Michael Widenius
MySql++ versions before 1.2:
Kevin Atkinson