Here is a brief description, link with more details below:
------------------
What is it:
The database template library is STL for databases. This free open source
package makes working with ODBC databases look like working with STL by
providing standard compliant iterators and containers that map to database
tables.
Why is it cool:
1. By closely following the C++ standard we gain significant leverage since
we can plug right in to all the algorithms in the STL standard library and
link them right up to database tables.
2. The database template library is designed to be PORTABLE across
compilers, databases and platforms so you don't get locked into a single
vendor. Currently it runs under:
MSVC 6 & .NET,
Borland C++ 5.5 and 6 on NT and
GCC 2.96 to 3.1 under Linux with unixODBC.
(and we hope to add Sun Forte and HPUX soon).
Why does closely following C++ standard make life easier? Because we can
take advantage of all the C++ standard libraries in a portable way. Here is
the complete code to read a table to cout with error handling:
////////////////////////////////////////////////////////////////////////////
//////////
#include "DTL.h"
using namespace dtl;
using namespace std;
int main() {
try {
// Connect to the database
DBConnection::GetDefaultConnection().Connect("UID=example;PWD=example;DSN=ex
ample;");
// Create a container to hold records from a query.
// In this case, the query will be "SELECT * FROM DB_EXAMPLE"
DynamicDBView<> view("DB_EXAMPLE", "*");
// Read all rows from the database and send to cout
copy(view.begin(), view.end(), ostream_iterator<variant_row>(cout, "\n"));
}
catch (std::exception ex) {
cout << ex.what()
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
//////////
Anyway, I think this provides a nice alternative to proprietary database
abstractions based around MFC or BDE which may be of interest to this group.
Here is a link to the homepage for more information:
http://dtemplatelib.sourceforge.net/index.htm
[ Send an empty e-mail to c++-...@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]