Maintaining Data Integrity (Magic xpa 4.x)
Magic xpa provides you with an improved data manipulation mechanism that reduces the possibility of lost updates that may occur in a stateless environment like the Web.
Two additional settings let you fine tune the data manipulation statements that are sent to the database.
The identity modify row mechanism lets you finely define which parts of an updated record should be used to verify that the record is valid for updating.
The options for the Identify Modified Row column, available as a property of a data source in the Data repository or of a data source entry in a task, are:
-
Position – Magic xpa verifies the existence and validity of the updated record by verifying that the position of the updated record is the same as the original record. (The position of a record is the record unique identifier, such as RowID in Oracle.) Given that the record position is validated, meaning that the record exists, the record is updated. Using this option means that when two users update the same record simultaneously, only the last modification committed is kept.
-
Position and Updated Fields – Magic xpa verifies the existence and validity of the updated record by verifying that the position of the record is the same as the original record, and that only the original values of the columns that were updated are the same as of the record that is about to be updated. If the record position and the original values of the updated columns are validated, the record is updated. Using this option means that several users may simultaneously update different columns of the same record, and all these users will have their modifications updated and kept.
-
Position and Selected Fields – Magic xpa verifies the existence and validity of the updated record by verifying that the position of the record is the same as the original record, and that the original values of all columns selected for the current task are the same as of the record that is about to be updated. If the record position and the original values of the selected columns are validated, the record is updated. Using this option means that several users may simultaneously update the same record from different tasks where different columns are selected, and all these users will have their modifications updated and kept.
The differential update mechanism lets you set numeric columns that will be updated by adding or subtracting only the modification to the original value. This means that several users may update the same numeric column of the same record simultaneously while maintaining the integrity of the data.
The setting is available as the Update Style property of a numeric column in the Data repository and as a property of the selected numeric column in a task.
You should carefully consider the proper setting of these properties. Here are some basic rules:
Records updated by a single user at a single time
When the nature of a data source or task dictates that only a single user may update an individual record at one time, you can set the Identify modified row property of the data source or the task respectively to Position.
Different record segments updated by several users at a single time
When the nature of a table or a task dictates that several users may update different columns of an individual record at one time, you may set the Identify modified row property of the data source or the task respectively to Position and updated fields.
Records of different task views updated by several users at one time
If the records are segmented by different tasks with different selected columns, you can enable different users to update the same record from the different tasks. Set the Identify modified row property of the data source or the task to Position and selected fields.