Tables
In many ways, class RWDBTable is the fundamental data structure of the DB Interface Module. The implementation of tables in the DB Interface Module parallels the relational view of data. In A Guide to the SQL Standard (see Appendix A), Date says of the table expression in SQL:
“...in many ways [the table expression] can be regarded as being at the top of the syntax tree... the whole point is, precisely, that the expression does evaluate to a table...”
Class RWDBTable represents a tabular collection of data. A base class from which a family of classes derive, RWDBTable provides an interface for the following types of tables:
*The database table: a handle for a table physically stored in a database.
*The derived table: representing a SQL query as a table, which can be used in other queries instead of a database table.
*The memory table: a collection of rows that resides in program memory.
*The result table: the result of a query, corresponding to an SQL table expression, which is transient, existing only while data is being retrieved.
The physical location of the data is transparent to RWDBTable clients. The interface to the data is the same, whether it resides in persistent storage or in program memory, or is completely transient.
NOTE: RWDBTable provides a uniform view of tabular data. The interface to the data is the same wherever it is stored.
RWDBTable instances are produced by RWDBDatabase instances and by instances of a class, RWDBResult, which is introduced in Result Tables.. As you will see, the basic SQL operations SELECT, INSERT, DELETE, and UPDATE are handled by the classes RWDBSelector, RWDBInserter, RWDBDeleter, and RWDBUpdater, respectively. These classes in turn produce instances of class RWDBResult. Thus, all data manipulation operations result in a sequence of tables, which your application may read or not, as you see fit.
RWDBTable provides a variety of data manipulation and data definition services. This chapter and Chapter 5, The Data Manipulation Classes, cover the basics; the SourcePro API Reference Guide provides a complete listing of its features.