sx_LockCount

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_LockCount

VB Declaration

Declare Function sx_LockCount Lib "Apollo9.dll" () As Integer

C Declaration

USHORT FAR PASCAL sx_LockCount(VOID);

Description

Retrieves the number of locks presently in place. Use in conjunction with sx_DBRlockList to manage the lock list.

 

Return Value

An integer representing the number of record locks in place.

 

VB Example

' test multiple records

Dim iCount As Integer

Dim iRet As Integer

Dim i As Integer

Dim DynamicArray() As Long

 

iRet = sx_Rlock(3)

iRet = sx_Rlock(5)

iRet = sx_Rlock(2)

iRet = sx_Rlock(7)

Debug.Print sx_Locked(2)

Debug.Print sx_Locked(3)

Debug.Print sx_Locked(5)

Debug.Print sx_Locked(7)

iCount = sx_LockCount()

ReDim DynamicArray(iCount)

sx_DBRlockList DynamicArray(0)

For i = 1 To iCount

sx_Unlock DynamicArray(i - 1)

Debug.Print sx_Locked(DynamicArray(i - 1))

Next

C Example

void ProcessRecords(void)

{

USHORT uiCount;

SHORT i;

LONG lLocks[10];

// using the current work area, test multi locks

sx_Rlock(3);

sx_Rlock(5);

sx_Rlock(2);

sx_Rlock(7);

uiCount = sx_LockCount();

sx_DBRlockList((LONGP)lLocks);

for (i = 1, i <= uiCount, i++)

sx_Unlock(lLocks[i]);

return;

}

See Also

sx_DBRlockList, sx_Rlock, sx_Unlock