The design of the business object layer, the middle tier, is largely independent of how the data is retrieved from disk and how it is presented to the end user. The fact that they can be implemented as abstract classes or interfaces yields the big advantage of using this approach: The implementation classes for a given interface are all structured identically and can be created quickly cookie-cutter style from one another. Another benefit that project managers like: a lot of serious coding can be underway before the user-interfaces are stablized.
Business object classes use instantiations of the database object.
I have identified 4 business object class types defined as interfaces. Not all classes needed by the application will fit into these categories. Other classes will be created for special purposes but whether it is worthwhile to define abstract classes for them can be decided by the project architect.
Each major table needs one or more these business objects. A particular implementation doesn't need to be coded until the need for it has been identified.
Supports Maintenance activities on the table
All major tables will need the maintenance object if their data is to be maintained interactively by users. This object contains all the functionality needed to navigate and update the table.
Name | Access | Description |
objRS | Get | (Object) Reference to Recordset object. Normally not needed. Provided for special cases where a data control needs to be connected to the recordset. |
Name | Parms | Return | Description |
InitQuery | Restore BaseQuery, WhereClause, OrderClause to default value | ||
BuildRS | Success(Boolean) | Execure the BuildRS method of the Database Object | |
DBAction | ActionType (integer) | Success(Boolean) | Navigate or update database |
GetRowArray | ParamArray | Success(Boolean) | Load ParamArray with values of memory variables containing current record fields |
LetRowArray | ParamArray | Success(Boolean) | Load memory variables with contents of Param Array |
DateCheck | Success(Boolean) | Performs a datestamp validation concurrency check | |
RecordStatus | Status(Integer) | 1 = First Row, 2 = Last Row, 3 = One Row, 0 = None of the above |
Lookup table (ListBox) Support
This object creates an array of table keys and names or descriptions. It is used when a lookup table (e.g. listbox) is needed to create a foreign key reference to this table from another table. Its connection to the database is normally destroyed as soon as the array is created.
Name | Access | Description |
ArrayIndex | Let, Get | (integer) Current referenced element in array |
ArraySize | Get | (integer) Number of rows in array |
Name | Parms | Return | Description |
LoadLookupTbl | WhereClause(String) OrderClause(String) |
Success(Boolean) | Loads memory array with recordset |
GetRowArray | ParamArray | Success(Boolean) | Load ParamArray with values of fields of current record |
Single row retrieval by key
This object retrieves a single row using a physical or logical key as a passed parameter. It can be used for existence tests and other oneshot retrievals. Its connection to the database is destroyed as soon as the array is created.
Name | Access | Description |
Name | Parms | Return | Description |
FindPhysical | PhyKey(Long), RowArray(VarArray) |
Success(Boolean) | Loads array with row fields identified by passed physical key |
FindLogical | LogKey (String), RowArray(VarArray) |
Success(Boolean) | Loads array with row fields identified by passed logical key |
This is a retrieval only object that takes a report identifier, query, or stored procedure as its passed argument. It maintains only a temporary connection to the database and passes its results back as a one or two dimensional variant array.
One of these can be created for each report identified by the system. The implementing classes could be named by report numbers or mnemonic codes.
Name | Access | Description |
ArrayIndex | Let, Get | (integer) Current referenced element in array |
ArraySize | Get | (integer) Number of rows in array |
Name | Parms | Return | Description |
ExecReport | ReportId (Integer) | Success(Boolean) | Uses pre-defined instructions associated with the report id to run a query or stored procedure. |
ExecQuery | QueryName(String) | Success(Boolean) | Runs a query or stored procedure named in the passed parameter |
ExecSQL | SQLStmt | Success(Boolean) | Runs the SQL Statement contained in the passed parameter |
GetRowArray | Fields(Row, ParamArray) |
Success(Boolean) | Loads the parameter array with field values for the row number indicated |