release
Release database controls.
release{/mod}
release/e{/mod} {Entity}
Example: release/e ORDERS.SALES
Qualifiers
Qualifier | Description |
---|---|
/e | Releases the controls for the current or specified entity. |
/mod | Marks each released occurrence as
modified. This ensures that these occurrences are inserted in the database at the next
store operation. If the primary key of each occurrence is not changed before the data is stored, a 'duplicate key' error will occur at the store operation. Note: The release/mod statement includes an implicit setocc "*",-1 to fetch all selected occurrences. |
Parameters
Parameter | Data Type | Description |
---|---|---|
Entity | String | Entity whose controls are to be released. If omitted, the controls for the current entity ($entname) are released. |
Return Values
If EntityName does not exist, $status is not set; $error is 0145, and the corresponding message is displayed.
If EntityName does exist, the usual values returned in $status during database interaction apply.
Value | Meaning |
---|---|
0
|
Data successfully released. |
-3
|
Exceptional I/O error (hardware or software). |
-16
|
Network error: unknown. |
Value | Error constant | Meaning |
---|---|---|
-2 through
-12 |
<UIOSERR_*>
|
Errors during database I/O. |
-16 through
-30 |
<UNETERR_*>
|
Errors during network I/O. |
-1102
|
<UPROCERR_ENTITY>
|
The entity name provided is not a valid name or the entity is not painted on the component. |
Use
Allowed in all component types.
Description
The release statement releases the data in the component (for the fetched occurrences, $totocc) from database controls. Each occurrence is marked in the hitlist as a non-database occurrence. Used without the /e switch, all occurrences in the component are released.
Uniface treats the released data as if it had just been entered by the user; in particular, this means that the primary key field can be modified. When the store statement is executed, occurrences modified by the user are inserted rather than updated. The release statement is sometimes used in the store trigger.
Keep the following in mind when using release:
- Any locked database occurrences are not unlocked; they remain locked until a commit or rollback is performed.
- An occurrence in the component that has been removed (for example, with the structure editor function ^REM_OCC), but not yet stored at the time of the release, remains in the hitlist and is available in the component.
Note: Prior to Version 6, the first occurrence became the current occurrence following a release. Beginning with Version 6, the last fetched occurrence becomes the current occurrence following a release. It is a good idea to use setocc to establish the new current occurrence.
The following example checks to see if any data
in the form has been retrieved from the database ($formdb equals
1
). If so, it releases database controls on this data so that it can be modified and
inserted as new occurrences.
trigger clear if ($formdb = 1) release message "Control released; data available as default" return (0) else clear return (0) endif end; clear