LockRow

Name

LockRow — Set lock/authorization for specific row in table

Synopsis

integer LockRow ( text a_schema_name , text a_table_name , text a_row_key , text an_auth_token , timestamp expire_dt ) ;

integer LockRow ( text a_table_name , text a_row_key , text an_auth_token , timestamp expire_dt ) ;

integer LockRow ( text a_table_name , text a_row_key , text an_auth_token ) ;

Description

Set lock/authorization for specific row in table <authid> is a text value, <expires> is a timestamp defaulting to now()+1hour. Returns 1 if lock has been assigned, 0 otherwise (already locked by other auth)

Availability: 1.1.3

Examples

SELECT LockRow('public', 'towns', '2', 'joey');
LockRow
-------
1

--Joey has already locked the record and Priscilla is out of luck
SELECT LockRow('public', 'towns', '2', 'priscilla');
LockRow
-------
0