RELEASE statement
- Last Updated: October 18, 2024
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Verifies that a record complies with mandatory field and unique index definitions. It clears the record from the buffer and unites it to the database if it has been changed.
Syntax
|
- record
- The name of a record buffer.
To use RELEASE with a record in a table defined for multiple databases, you must qualify the record's table name with the database name. See the record definition in the Record phrase reference entry for more information.
- NO-ERROR
- The NO-ERROR option is used to prevent the statement from raising
ERRORand displaying error messages.For the
RELEASEstatement, as an exception to the general rule, if a unique index constraint is violated theNO-ERRORclause is ignored when validating the record. An error is raised before any changes are saved to the record to avoid damaging any indexes.
Example
The following example uses a browse widget to scan Customer records.
Records within the browse are read with NO-LOCK. If you choose the Update
Customer button, the CHOOSE trigger starts a transaction and applies an
EXCLUSIVE-LOCK to the Customer record. When you have completed any
updates, the procedure displays the new values in the browse widget and then executes a
RELEASE statement. This ensures that the lock is released when the
transaction ends.
r-rels.p
|
If you omit the RELEASE statement in this example, the
EXCLUSIVE-LOCK is downgraded to a SHARE-LOCK at the end
of the transaction. This prevents other uses from updating that record. The
SHARE-LOCK is released when you change the iteration of the browse.
Notes
- An
ERRORoccurs if the validation of the record fails. This can happen only with newly created records. - If a record has been modified, the
RELEASEstatement causes aWRITEevent and fires any relatedWRITEtrigger to execute. AllWRITEtriggers execute before the record is actually written. If aWRITEtrigger fails (or executes aRETURNstatement with theERRORoption), the corresponding record is not written or released and theERRORcondition is raised for theRELEASEstatement. - See Develop ABL Applications for more information on transactions.