Skip to content

Client Interaction

This section describes standard mechanisms as to how to create, update or remove records in the server from the client.

Data transport

Data transport is handled with the Attribute String. Both the client and the server can pack and unpack an Attribute String.

Server records

The server uses records instead of the Attribute Strings. All DML (Data Manipulating Language), create, modify and remove operations in the server are actioned using records. The attribute string is transformed to a server record when the server receives an Attribute String. A server record is defined as:

  • record_   <table_name>%ROWTYPE;

This declaration means that all columns in the table exists in the record.

Indicator Records

An Indicator Record is a type of server record. This record contains all columns from the table but instead of the actual data it contains a Boolean value if the attribute is changed or not. It should be used internally in the generated server framework methods.

Fetching data

The client fetches data from database views using SQL. Many records can be fetched at the same time if needed, for example in an overview form. The attributes objid and objversion in a view must be fetched to the client to be able to update or remove a record. These two attributes are used by the server framework for identification, locking and version control.

Manipulating data

The actions New__, Modify__ and Remove__  are used for manipulating data. Please note that these methods have double underscores, and they should not be mixed up with the server methods which have triple underscores. They can be called using action parameters which are set to CHECK or DO. The client normally calls the server, first of all using action CHECK, and then again using action DO. The CHECK action can sometimes be omitted, see Client Information for further information.

Creating a new record

A new record is created in this way:

  1. User press new.
  2. Fetch the entities default values by calling New__ method in PREPARE mode.
    The server calls Prepare_Insert___ to fetch the default values.
  3. User interaction by adding other values like descriptive attributes and foreign keys.
  4. User saves the form.
  5. Client calls New__ method in CHECK mode.
    The server call Unpack___ and unpacks the attribute string into a server record and an indicator record.
    The server call Check_Insert__ and checks that all values in the attribute string are correct.
  6. If CHECK mode does not pass, then a warning message is sent to the client and the following steps will not be performed.
  7. If CHECK mode passes then the client calls New__ method in DO mode
    The server calls Unpack___ and unpacks the attribute string into a server record and an indicator record.
    The server calls Check_Insert__ and checks that all values in the attribute string are correct.
    The server calls Insert___ and creates a new record in the entity.
  8. The server returns objid, objversion and automatic values like server generated attributes and/or server generated primary keys back to the client in the attribute string format. Other information is sent to the client in the Info_ parameter, which can be displayed by the client if required, see Client Information for more information.

Modifying a record

Updating a record is done in this way:

  1. User modifies the record in the client.
  2. User saves the form.
  3. Client calls Modify__ method in CHECK mode.
    The server fetches the old record.
    The server calls Unpack___ and unpacks the attribute string into a server record and an indicator record.
    The server calls Check_Update__ and checks that all values in the attribute string is correct.
  4. If CHECK mode does not pass, then a warning message is sent to the client and the following steps will not be performed.
  5. If CHECK mode passes then the client calls Modify__ method in DO mode.
    The server fetches the old record.
    The server calls Unpack___ and unpacks the attribute string into a server record and an indicator record.
    The server calls Check_Update__ and checks that all values in the attribute string is correct.
    The server calls Update___ and updates the entity.
  6. The server returns objid, objversion and automatic values like server generated attributes and/or server generated primary keys back to the client in the attribute string format. Other information is sent to the client in the Info_ parameter, which can be displayed by the client if wanted, see Client Information for more information.

Removing a record

Removing a record is done in this way:

  1. User press delete.
  2. User saves the form.
  3. Client calls Remove__ method in CHECK mode.
    The server locks the record.
    The server calls Check_Delete__ and checks that it is valid to remove the record.
  4. If CHECK mode does not pass, then a warning message is sent to the client and the following steps will not be performed.
  5. If CHECK mode passes then the client calls Remove__ method in DO mode.
    The server locks the record.
    The server calls Check_Delete__ and checks that is is valid to remove the record.
    The server calls Delete__and deletes the record.
  6. Information is sent to the client in the Info_ parameter, which can be displayed by the client if wanted, see Client Information for more information.