CB++ (CommonBase Database Access Library for C/C++)
====

This library was written in 1989 as a basis for storing C++ objects in
a relational database. The development of such a system was stopped in
1990 because of problems with the MS-DOS environment used in this time.
My involvement in various user interface projects here in the institute
and otherwhere made it sleep until last week.
When reading comp.databases news I saw some interrest on a library
for database access and after posting a followup to a related article
I got a lot of responses.

Okay, here is it. It is only the database access layer of the projected
object storage system but it has some useful features which are provided
by commercial tools out there:

* Builds on the C language interface of a database, there is no need
  for a precompiler (like embedded SQL - which is totally unusable in
  combination with C++, at least it was three years ago...)
* Very simple to use. Unlike the native C interfaces of the databases
  it is as simple as embedded SQL or some 4th generation languages.
* Makes applications portable among different SQL databases. The library
  itself is relatively easy to port as the database vendor specific code
  is separated into a single C++ class which makes up only a limited part
  of the library.

The current release was extracted from our old DOS archives. I remember
that it worked stable with the Gupta SQL Server for DOS/MS-Windows and
Oracle. The OS/2 SQL server (someone told me that it is another sybase
server??) version also worked but had problems with opening files when
connected to the database.

The 'plain C' interface worked only with the old MS-DOS linker which had no
different linkage styles for C and C++. It could be fooled with declaring
C externals matching to the cfront generated C++ member functions of
the SqlMgr class. (file cbinter.h) If someone is interrested it would
be easy to provide real C wrapper functions and the init/terminate
code which got lost somewhere.

I did some face-lifting to the code to compile with today's C++ (2.1, but
it should also be accepted by 3.x) and tested it on a SUN SPARC
running SunOS 4.1.3 and Oracle 6.

Bugs:
-The SQL parser should be improved. It currently has the restriction
 that bind variables are only recognized if followed by a comma and/or
 a white space character, i.e.
    "insert into items (name, price) values (:string, :int)"
 won't work while
    "insert into items (name, price) values ( :string, :int )"
 does.
-Since I have done a lot of minor changes the other servers will not
 compile out of the box - have a look at the oracle version.
-Incomplete error handling. CB++ has it's own error codes (needed for
 portability) but the tables aren't initialized in either server code.

Besides this there are currently no more known bugs in CB++ (an I hope you
will not report too much of them :-). There are problems with the Oracle
library or documentation on the SPARC when binding program variables of type
float but they are not specific to CB++ (even the Oracle demo application
dumps core when compiled with C++) - any hints are welcome.

Because of the very limited time I can spend on this subject there exists
no documentation for CB++ at the moment. Please have a look at the 
sqlmgr.h file and the sample sources, then you should know everything needed
to use it in your application.

I'm planning to write a few pages about usage in programs and about writing
server interfaces, if there is something new it will be announced it in
comp.databases and comp.lang.c++. Maybe that I'll use the stuff for a
commercial project next year. (this would mean to continue work on the
object storage system and it would also speed up the improvement of CB++
a lot...)

Please mail me about your expierience with CB++, feel free to ask about
everything and please don't flame about the implementation - it was one of
our first attempts to write such tools in C++ (provide better solutions
instead :-)


---------------------------------------------------------------
Bernhard Strassl              University of Vienna
bernhard@ani.univie.ac.at     Dpt. for Applied Computer Science
                              and Information Systems
---------------------------------------------------------------