Boost logo

Boost :

From: Corwin Joy (cjoy_at_[hidden])
Date: 2001-06-02 15:02:07


Well, perhaps the best way to explain in few words is to compare the
"simple" example we give of using DTL versus the one that RW DBTools.h++
gives:

A First Example, Reading and Writing Records in a Table:

As our first example, we show what the code would look like to open a table
and read a set of rows from the database.

////////////////////////////////////////////////////////////////////////////

#include "dtl.h"
using namespace dtl;

// Connect to the database
DBConnection::GetDefaultConnection().Connect(
         "UID=example;PWD=example;DSN=example;"
  );

// 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"));

////////////////////////////////////////////////////////////////////////////

Here is the corresponding DBTools.h "simple" example that
they use in their advertising.
I think we compare favorably :-)!

Example 1. DBTools.h++ marketing example
// Select * from table1 (all rows from table1) using DBTools.h++
#include <iostream.h>
#include <rw/db/db.h>
int anInt;
RWCString aString;
float aFloat;
int main ()
{
   RWDBDatabase aDB = // Open the database
       RWDBManager::database("ODBC", "Q+E_paradox", "", "",
       "c:\\paradat");
   RWDBTable aTable = aDB.table("TABLE1"); // Get the table
   RWDBSelector aSelector = aDB.selector(); // Get a selector
      aSelector << aTable; // Specifies SELECT * FROM (every row)
   RWDBReader aReader = aSelector.reader(); // Get a reader, and
   while (aReader()) { // print out each row
      aReader >> anInt >> aString >> aFloat;
      cout << anInt << '\t' << aString << '\t' << aFloat << endl;
   }
   return 0;
}

----- Original Message -----
From: "md656" <md656_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, June 02, 2001 1:29 PM
Subject: Re: [boost] Interest in Database Template Library?

> So, how one can compare your DTL to RW DBTools.h++?
>
> Mohammed
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk