Appendix B. DAME Database Interfaces

Table of Contents
The DatabaseIf Interface
The RecordSetIf Interface

DAME can be used with multiple databases. This is possible because DAME generates code that uses a set of interfaces. The DAME library for Oracle™ and Postgresql implements these interfaces. Even though only the DatabaseIf is visible to user of DAME application there are two interfaces that are available through DAME - DatabaseIf and RecordSetIf This chapter shows you how you can make use of these interfaces.

The DatabaseIf Interface

The DatabaseIf is the primary interface available to a particular database. All the associated objects are created using the DatabaseIf. Let us look at the DatabaseIf definition.


            class DatabaseIf {
                virtual RecordSetIf* CreateRecordSet (const std::string& sqlStatement) = 0 ;
                bool SetAutoCommit (bool bCommit) ;
                bool GetAutoCommit() const ;
                virtual void Commit (void) = 0 ;
                virtual void Rollback (void) = 0 ;
                virtual void StartTransaction (void) = 0 ;

A DatabaseIf object models a connection to the database in real world. The construction of this object will be different for different databases as we have seen in the examples earlier. A user can execute multiple SQL statements using the same database connection. For each such SQL statement the user requests the DatabaseIf object to create a record set object. A constructed of DatabaseIf object should have a open database connection associated with it.