The Main Routine
This code sample shows how to use the classes VVContact and VVContactRepository. 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("", "t1out.txt", "t1err.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, customerTableName); //10
customerPool.mailingLabels(outStream); //11
closeStreams("", "t1out.txt", "t1err.txt");
return 0;
} //12
Here is a line-by-line description of the program:
This program is really quite short, considering all that it accomplishes. Lines //10 and //11 do most of the work. A detailed examination of the code behind these lines is important for understanding how the DB Interface Module is best used.