Category : Files from Magazines
Archive   : CUJ9201.ZIP
Filename : 1001034A
// Test for the Pinnacle Database List Class
//
// Copyright 1991, David Brumbaugh
//
//////////////////////////////////////////////////////
#include "paylist.h"
#include
main()
{
// Test the more abstract Class
Pfm_List db("payroll.db","Employees");
// Create Some Records
db.add();
db.replace("First","John");
db.replace("Last", "Jones");
db.replace("Pay", 11.25);
db.replace("Days",245L);
db.add();
db.replace("First","Ben");
db.replace("Last", "Franklin");
db.replace("Pay", 111.25);
db.replace("Days",3L);
db.add();
db.replace("First","George");
db.replace("Last", "Washington");
db.replace("Pay", 1111.25);
db.replace("Days",4L);
// Then Retreive Them
char first[10], last[20];
long days;
double amount;
db.top();
do
{
cout << db.get("First",first) << " "<<
db.get("Last",last) << " "<<
db.get("Pay",amount) << " ";
db.get("Days",&days);
cout << days << '\n';
db.next();
} while(! db.at_end());
cout << '\n';
amount = 100.00;
if (db.find("Pay",">",&amount))
{
do
{
cout << db.get("First",first) << " "
<< db.get("Last",last) << " "
<< db.get("Pay",amount) << " ";
db.get("Days",&days);
cout << days << '\n';
} while(db.findnext());
}
amount = 11.25;
cout << '\n';
if (db.find(&amount))
{
cout << db.get("First",first) << " "
<< db.get("Last",last) << " "
<< db.get("Pay",amount) << " ";
db.get("Days",&days);
cout << days << '\n';
}
// Now Test the application specific class
// Create Some More Records
employee emp[] = {{"Kirk","James",17.01,5},
{"Solo","Han",12.34,4},
{"Hammer","Mike",36.24,36},
{"Hill","Dixon",19.46,30}},
*empPtr, empBuffer;
PayList pl(db.DBHandle());
for(int x=0; x < 3; ++x)
{
pl.add(emp[x]);
}
// Then Retrieve Them Again
pl.top();
do
{
pl.get(empBuffer);
cout << empBuffer.first << " " <<
empBuffer.last << " "
<< empBuffer.pay_rate << " ";
cout << empBuffer.days_worked << '\n';
pl.next();
} while(! pl.at_end());
cout << "\n Done \n";
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/