Database-Dependent and Database-Independent Interface Classes

The interface classes are divided into classes that contain a pointer to a database-dependent implementation and those that do not. In general, classes that model database concepts, like RWDBTable and RWDBSelector, have pointers to database-dependent implementations, while classes that model database-independent concepts, like RWDBBlob and RWDBExpr, do not. Table 158 shows the class hierarchy of the public classes of the DB Interface Module. Note that the class implementations may also use private inheritance.

Table 158. The public class hierarchy of the DB Interface Module

Database-Independent Classes

Database-Dependent Classes

RWDBBlob

RWDBBulkInserter

RWDBColumn

RWDBBulkReader

RWDBConnCallback

RWDBCompoundSelector

RWDBCritFormDefinition

RWDBConnection

RWDBCritFuncDef{n} i.e.
RWDBCritFuncDef0,
RWDBCritFuncDef1, etc.

RWDBCursor

RWDBDatabaseCallback

RWDBDatabase

RWDBDuration

RWDBDeleter

RWDBExpr

RWDBEnvironmentHandle

     RWDBAssignment

RWDBInserter

     RWDBBoundExpr

RWDBPhraseBook

     RWDBCollectableExpr

RWDBReader

     RWDBCriterion

RWDBResult

     RWDBJoinExpr

RWDBSelector

     RWDBSimpleCaseExpr

RWDBStoredProc

     RWDBSearchedCaseExpr

RWDBSystemHandle

RWDBExprFormDefinition

RWDBTable

RWDBExprFuncDef{n}, i.e.
RWDBExprFuncDef0,
RWDBExprFuncDef1, etc.

RWDBUpdater

RWDBForeignKey

 

RWDBForeignKeyList

 

RWDBManager

 

RWDBMBString

 

RWDBMemTable

 

RWDBMultiRow

 

RWDBNullIndicator

 

RWDBOSql

 

RWDBRow

 

RWDBSchema

 

RWDBStatus

 

RWDBTBuffer<T>

 

RWDBTPtrMemTable<T,C>

 

RWDBTracer

 

RWDBValue

 

Note that all implementation classes of the DB Interface Module database-dependent classes can be considered abstract classes, containing virtual functions. These virtual functions will be overridden in the derived classes that make up the database-dependent Access Modules.

For example, class RWDBDatabase is an abstraction that represents a database. It offers a rich set of semantics: you have access to database objects like tables, views, and stored procedures; you can manage multiple connections; and you can use database definition language (DDL) constructs, among other things.

These semantic elements represent features common to all databases. However, the way a feature is implemented for any particular database depends heavily upon the API provided by the database manufacturer. Consequently, RWDBDatabaseImp, the implementation class associated with RWDBDatabase, is an abstract base class for a family of database-dependent implementation classes—one implementation class for each database manufacturer that SourcePro DB supports. These database-dependent implementation classes make up the Access Module for the particular database. Figure 98 shows this relationship.

Figure 98. How SourcePro DB provides access to multiple databases

The classes RWDBDatabaseImp, RWDBSybCtLibDatabaseImp and RWDBOCIDatabaseImp are discussed here for demonstration purposes only and should not be referenced directly or used by application code.

Notice also from Figure 98 that classes RWDBDatabase and RWDBDatabaseImp reside in the DB Interface Module, while RWDBSybCtLibDatabaseImp and RWDBOCIDatabaseImp reside in separate DB Access Modules. This is the key to database portability in SourcePro DB. The DB Interface Module —and therefore, your application—doesn't care which databases it works with. The Interface Module serves as a software backplane for plugging in different Access Libraries interchangeably. When using shared libraries or DLLs, you can even plug in Access Libraries at runtime without relinking your application.