DECLARE_CLASS(dbPeople)
dbChar LastName;
dbReal Salary;
dbPeople :
LastName(80, "Last Name", kIndexCompress),
Salary("Salary", kIndexed)
{};
};
// define the actual database - one connection contains many
tables
dbConnect_ctree theDb;
dbPeople People;
// open a database
theDB.openConnection("Test.db");
People.LastName = "Dent";
People.search(People.LastName == "Dent" || People.Salary >= 50000);
People.union_with(anotherPeopleCollection);
// or, using operator syntax
People += anotherPeopleCollection;
Patients.search(Patients.PatientCode = "Dent001");
if (Patients.count()==1) {
Patients.Visits->newRecord();
Patients.Visits->Date = "25/1/96";
Patients.Visits->Why = "Flu";
Patients.Visits->newRecord(); // caches dirty record created
above
Patients.Visits->Date = "May 26th"; // flexible date parsing
Patients.Visits->Why = "Flu";
Patients.saveRecord(); // propagates save to new Visits records
}
People.search(People.LastName == "D*t");
dbSorter AccountsOrder;
AccountsOrder << reverse(Accounts.LastSale) <<
Accounts.Company << Accounts.Branch;
People.setSortOrder(AccountsOrder);
Features coming in v1.3:
- keyword indexing
- phonetic indexing