OOFILE | Downloads | Purchasing | Press | Services | Company Information | Soapbox | References | F.A.Q. | HOME

dbViews

A very important feature of OOFILE, the dbView allows us to output only a given set of fields from our table(s). This effectively means that if we wish, we can restrict what we see of our database to this view while still maintaining the possibility of seing all the fields. This can be very useful when you have a large number of unneccessary fields or you only wish to see a small amount of information from each record (for example first and last names). dbViews can also incorporate fields from related tables.

A dbView is very easy to use. We must start by declaring your dbView variable.
For example:

   dbView myView;        

We then pass in the fields that we wish to see. We use the operator<< just as though the dbView were cout.
For example (assuming a table myTable1 that has at least 2 fields named firstname and lastname).

   myView << myTable1.firstname << myTable1.lastname;  

The dbView is now ready to pass along to cout.
For example:

   cout << "The names are: \n" << myView;  

The dbView will provide a view of the given fields regardless of the state of the underlying database. This means that  searching or sorting the database may change what a dbView shows. For example, if you declare a dbView then perform a search on the database that reduces the current selection, you will see the specified fields of only those records that have been selected.


dbViews and report writing

It is important to note that reports only accept dbViews. See Report writer for more.


dbView examples
Adding fields  ooftst01
Creating a dbView  ooftst01
Passing in false ooftst04
Printing multiple tables using a dbView ooftst02
Used by report-writer - plain character - columnar  ooftst04
Used by report-writer - plain character -PageWise ooftst04
Used by report-writer - simple HTML reports ooftst14
Used with cout - predefined  ooftst01
Used with cout - temporary in list of expressions  ooftst01

 

Feature index

(c) Copyright A.D. Software 1994-2000 (All Rights Reserved).
Last Updated: 9th September 2001