|
Data Access Layer
Overview
In BAAN applications, the 4GL engine provides the default functionality for a session. Changes or additions to the default functionality for a session are programmed in a UI-script (for UI specific tasks) and DAL (for Business Logic related tasks)
Programmers create a user interface (UI) script to change the default behavior of a session and a DAL script to program all the logical integrity rules for a particular table. So the DAL ensures the logical integrity of the database. As in previous versions of the software, the database server ensures the referential integrity of the database.
The DAL script for a particular table has the same name as that table. It is implemented as a DLL that can be accessed by user interface scripts (via the 4GL engine), by other DALs, and by external programs (via the Common Data Access Server (CDAS). The following diagram illustrates the overall relationship of these components.

Database integrity checks
The following are examples of some logical integrity rules that could be programmed in a DAL script:
- When customers have reached their credit limit, they cannot order further items.
- If the invoice for an order has been printed, the order cannot be changed.
- If the current VRC of a user is not equal to the package VRC of the program script, the script cannot be compiled.
Programming database integrity checks in a separate DAL script has two main advantages:
- Code reuse: The integrity rules do not have to be replicated in each session that uses a particular table.
- External access: External applications can access the database via the CDAS and the DAL.
For an overview of the interaction between the user interface, the 4GL engine, and the DAL, see DAL, UI, and STP interaction.
Business methods
In addition to performing data integrity checks, the DAL provides business methods for handling non-interactive database modifications such as printing sales orders or posting all orders to history.
A business method is a function that performs a task that involves manipulating and/or checking one or more tables in the database. The function is programmed in a DAL script and can be called directly from a UI script. It must be programmed in the DAL script of the most relevant table.
Users can activate a business method with a single command. There is then no further user interaction. The UI script calls the relevant function in the DAL script. The function performs all operations to complete the required task. The user must wait until the business method finishes before continuing with other tasks. However, if a progress window is provided, the user can cancel the business method by clicking on the Cancel button.
The UI script starts a business method by calling the dal.start.business.method() function
Related topics
|