The Main Routine
The following is the main routine for the tutorial. The line numbers correspond to the comments that follow the code.
#include <rw/db/db.h> //1
#include "conrep.h" //2
#include "tututil.h" //3
int main(int argc, char** argv) //4
{
associateStreams("t3in.dat", "t3out.txt",
"t3err.txt"); //5
RWDBManager::setErrorHandler(outputStatus); //6
RWCString serverType, serverName, userName,
password, databaseName, pstring; //7
initializeDatabaseArguments(argc, argv, serverType,
serverName, userName, password,
databaseName, pstring); //8
RWDBDatabase aDB = RWDBManager::database
(serverType, serverName, userName, password,
databaseName, pstring); //9
VVContactRepository customerPool(aDB, customerTable); //10
VVContact aCustomer; //11
while (aCustomer.read(inStream)) { //12
customerPool.insert(aCustomer); //13
outStream << aCustomer.name()
<< " has been added to the customer table."
<< endl; //14
}
closeStreams("t3in.dat", "t3out.txt", "t3err.txt");
return 0;
} //15