LOCKlockset_identifier
ON {field_identifier
|expression
}[, ...] FROMstream_identifier_i
[ERROR INTOstream_identifier
];
or
UNLOCKlockset_identifier
ON {field_identifier
|expression
}[, ...] FROM
stream_identifier [ERROR INTOstream_identifier
];
lockset_identifier
-
A unique identifier (name) for a lockset previously defined through the CREATE LOCKSET statement.
field_identifier
-
The unique identifier (name) for a tuple field that is a component of the lock.
expression
-
An expression that is a component of the lock.
stream_identifier
-
The stream that passes into LOCK or UNLOCK and from which the lock key values needed to obtain or release a lock are extracted. This stream is unaltered by passage through LOCK or UNLOCK.
You can append an ERROR INTO clause just before the closing semicolon. The StreamSQL ERROR INTO clause is analogous to the Enable Error Output Port check box for operators and adapters in EventFlow applications.
Use ERROR INTO with the name of a stream, which must already exist. This sets up an Error Port for this operator, which is much like a local catch mechanism for errors from this operator.
See Using Error Ports and Error Streams for a discussion of StreamBase error handling mechanisms.
Important
The Lock and Unlock statements and the Lock Set data construct are deprecated as of StreamBase 7.2.0 and will be removed in a future release. Do not design new applications that use this feature. Contact StreamBase Technical Support if you need help with replacing this feature in an existing application.
In the LOCK and UNLOCK statements, lockset_identifier
names the lock set (previously declared in a CREATE LOCKSET statement) that will manage the lock. The field_identifier
or expression
entries following the ON clause are the input stream tuple fields or values that identify the lock. The number and types
(but not necessarily the names) of the entries following the ON clause must match the number and type (but not necessarily
the names) of the fields in the lock set.
The FROM clause entry, stream_identifier
, is the name of the input stream. Like the table stream queries, the LOCK and UNLOCK statements do not identify the output
stream that will capture their output. LOCK and UNLOCK generate a stream and can be used anywhere a stream expression is acceptable.
As an alternative, the output could be captured in a stream, as illustrated in the following code fragment.
CREATE [OUTPUT] STREAMstream_identifier
; LOCK ... INTOstream_identifier
;
Or
CREATE [OUTPUT] STREAMstream_identifier
; UNLOCK ... INTOstream_identifier
;