There are two models for locking data in a database:
In most scenarios, Optimistic row locking is more efficient and offers higher performance.
Pessimistic row locking is useful if there are a lot of updates and relatively high chances of users trying to update data at the same time. Please keep in mind that the resource is locked from the time it is first accessed in a transaction until the transaction is finished, making it inaccessible to other transactions during that time. Therefore, if one program user attempts to make changes to the row that is being edited by another user, it will be impossible for the first user to add their changes to the database until the second user finishes working with that row’s data.
Note: Before proceeding, get acquainted with the Settings Levels section of LyciaLowCode Settings page (the concept of scopes is essential for configuring multiple interactions and the multitable support).
The definitions like LET <setting_variable>.<setting_name> = <value> refer to the InteractForm_Settings level, while LET <setting_variable>.views["<db_table_name>"].<setting_name> = <value> refers to the View level.
This setting can be defined for:
InteractForm_Settings level: Yes
View level: Yes
Setting format:
<InteractForm_Settings>.pessimistic_locking INT
<InteractForm_Settings> here is the name for the settings variable you assign.
Example:
LET rec_settings.pessimistic_locking = 1 #Pessimistic locking enabled