This is an optional add-on library to LIBCXX, which adds
classes and templates that use
the unixODBC library
and provide SQL access to any database server with an
ODBC driver.
Install LIBCXX first, and see its documentation for more information
on building with LIBCXX.
Then
install this library, and
use the following classes and templates after
linking with -lcxxsql
.
There's also direct support for inserting and
fetch fixed precision mpf_class
values
from the GMP library.
First, an environment object enumerates configured ODBC drivers and data sources. A connection object establishes a connection or a login to a database, and executes individual statements, which update table content or fetch resultsets.
A statement object can be used only by one thread a time. The environment and connection objects are generally thread safe. Note, though, that transaction scope affects an entire connection. A thread that starts a transaction puts all statements executed by other threads within the same transaction. When using transactions, it's generally easier to have a separate connection object for each thread.
The SQL database interface
sub-component of LIBCXX SQL Library implements an XML schema
for describing the SQL database schema, and supplies a stylesheet
that creates classes which construct and execute SQL queries
using an object-oriented interface. Execute
SELECT
,
INSERT
, and
UPDATE
SQL, with complex joins, without
writing a single character's worth of literal SQL, with
the SELECT
producing a beginning and an ending
iterator over input sequences that iterate over the
SELECT
ed rows.