Data-Driven Intranet

Standard Database Interface

Back to Architecture Page
To Business Object Interface Page

Summary

 


Where is the Standard Database Interface Used?

The objects of the database layer are created and destroyed by middle-tier business objects as needed. The business object creates a recordset or resultset variable and passes it to RSBuild to be populated. It is the middle-tier's responsibility to close records

For example, if the entire application uses DAO, all you need is the DAO implementation of this interface. If a remote ODBC connection to an SQL Server database is needed, an RDO implementation of the same interface needs to be created.

The properties and methods listed below should be all that the business object middle-tier needs to access the database.

 

Top of Page

Rowset Interface Properties

 

Name Access Description
RowCount Get (Long) Number of rows in recordset
RStatus Get (Integer) Status of the recordset
TargetBM Let, Get (String) Target bookmark
TargetKey Let, Get (Long) Target primary key
TargetWhere Let (String) Where clause for target row
If found, sets TargetBM and TargetKey
BaseQuery Let, Get (String) Select statement (w/o Where or Order By)
WhereClause Let, Get (String) Where clause concatenated to BaseQuery
OrderClause Let, Get (String) Order By clause concatenated to Base Query
CurrentBM Get (String) Bookmark of current row
StoredProc Let (String) Stored procedure name used in the query

 

Notes on properties:

  1. RStatus values include NoRows, EOF, BOF, OneRow, FirstRow, LastRow and Other
  2. StoredProc is used in PassThru (SP) queries. Otherwise, BaseQuery, WhereClause and OrderClause are concatenated to build a query.
  3. Setting TargetKey also sets TargetBM

 

 

Top of Page

 

Rowset Interface Methods

 

Name Parms Return Description
RSBuild Recordset,
optnl DataSource (string),
optnl RecordsetType
Success (Boolean) Open a recordset
RSMove NewRow (int const) Success(Boolean) Navigate (options include Next, Prev,
First, Last, ToBookmark
LoopNext   New row found (Boolean) Execute a MoveNext. Return True until EOF
SavePosition   Success(Boolean) Save current bookmark
RestorePosition   Success(Boolean) Restore current record to saved bookmark
RSAddNew   Success(Boolean) Execute an AddNew
RSEdit   Success(Boolean) Execute an Edit (if applicable)
RSUpdate   Success(Boolean) Execute an Update
RSDelete   Success(Boolean) Execute a Delete
KeyToBM Primary Key(Long) Bookmark(String) Get the Bookmark for a record
Set the TargetBM property with it
FindIt WhereClause(Str) Success(Boolean) Find (first) record returned by specified where clause
RSClose   Success(Boolean) Close the recordset

 

Notes on Methods:

  1. RSBuild takes a recordset or resultset reference defined by the calling business object and populates it, using BaseQuery, WhereClause and OrderClause to build the query.
  2. TO DO: enhance for pass-thru queries to stored procedures.
  3. TO DO: RSBuild should be enhanced to optionally destroy the database connection as soon as the recordset is created.
  4. SavePosition and RestorePosition use a separate private bookmark variable not accessible via public property.
Top of Page


Back to Architecture Page

1