[comp.lang.c++] C++ interfaces to Relational Databs

stt@inmet.inmet.com (12/07/89)

With regard to interfacing C++ and SQL...

The SQL/Ada Module Extensions Design Committee (SAME-DC), headed
by Marc Graham of the Software Engineering Institute,
has designed an interface language 
("Abstract Module Description Language" -- AMDL)
for interfacing "modern" high level languages with SQL.
It supports user-defined data types, safe handling of
"null"ness, automated error handling, etc.
As is obvious from the name of the committee, our focus
has been on Ada.  However, much of the work could be applicable
to other strongly-typed languages.

AMDL works roughly as follows:

The SQL Schema is
augmented with specifications of user-defined "domains" (roughly
data type) to be associated with each column of an SQL table.
The SQL operations needed for a particular application
are defined in one or more "operation modules" which
correspond roughly to the ANSI SQL Module language, but
with stricter semantics based on the additional domain information
(i.e., without an explicit conversion (aka "cast"), it is not
permissible to join across columns of distinct domains).
Application-specific views/cursors/iterators may be defined much
more concisely than in the ANSI SQL Module language.

Error handling is specified via mappings from the SQLCODE to
a user-defined enumeration of status values, and/or exceptions.
Null-ness is handled by bundling the null-ness information into
an abstract data type which supports three-valued logic
(i.e. A < B is true, false, or unknown if either A or B is null),
and detects attempts to use null values inappropriately.
This is handled in Ada via private types, but could easily be
handled in C++ using classes.

Contact Marc Graham at the SEI, Carnegie Mellon University, Pittsburgh, PA,
for more info on AMDL, or the SAME design committee.

S. Tucker Taft
Intermetrics, Inc.
Cambridge, MA  02138