guides:programming:programmers_reference_manual:lock_routine

Lock routine

Provides a method for coordinating access to tables, rows, or columns by setting locks

Lock(tablename, key, columnlist, locktype)

The Lock routine has the following parameters.

ParameterDescription
TablenameSpecifies the name of the table to lock.
KeyKey of the row to lock. If null, the entire table is locked.
columnListAn @fm delimited list of columns to lock. If the columnList is null the entire record is locked.
LocktypeSet one of four lock types:

locktype - Description
0 - Exclusive lock.
1 - Shared lock.
2 - Exclusive coordinated lock (row and column locks only).
3 - Shared coordinated lock (row and column locks only).

Since the Lock routine uses the Lock statement, it is more efficient to use the Lock statement in a BASIC+ script.

/* Lock and unlock specific columns within a row */

declare subroutine lock, unlock

 

table = 'PRODUCTS'

row = '3542-5-310-1'

cols = 'DESCRIPTION':@fm:'PRICE'

locktype = ""

 

Lock(table,row,cols,locktype)

status = Get_Status(errCodes)

If status Then

   FSMsg(errCodes)

End

 

* Do Some Processing

 

call Unlock(table,row,cols,locktype)

status = Get_Status(errCodes)

If status Then

   FSMsg(errCodes)

End

 

/* Lock and unlock a row */

 

declare subroutine lock, unlock

 

table = 'PRODUCTS'

row = '3542-5-310-1'

cols =%%''%% 

locktype = ""

 

Lock(table,row,cols,locktype)

status = Get_Status(errCodes)

If status Then

   FSMsg(errCodes)

End

 

* Do Some Processing

 

Unlock(table,row,cols,locktype)

status = Get_Status(errCodes)

If status Then

   FSMsg(errCodes)

End
  • guides/programming/programmers_reference_manual/lock_routine.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1