|
<< Click to Display Table of Contents >> Delphi Examples: DbiOpenLockList |
![]() ![]()
|
Return a list of locks acquired on a specific table.
This example uses the following input:
fDbiOpenLockList(Table1, LockList);
The procedure is:
procedure fDbiOpenLockList(Tbl: TTable; var LockList: TStringList);
var
TmpCursor: hdbicur;
Lock: LOCKDesc;
rslt: dbiResult;
begin
Check(DbiOpenLockList(Tbl.handle, True, True, TmpCursor));
Check(DbiSetToBegin(TmpCursor));
LockList.Clear;
repeat
rslt:= DbiGetNextRecord(TmpCursor, dbiNOLOCK, @Lock, nil);
if (rslt <> DBIERR_EOF) then begin
LockList.Add('Lock Type: ' + IntToStr(Lock.iType));
LockList.Add('User Name: ' + StrPas(Lock.szUserName));
LockList.Add('Net Session: ' + IntToStr (Lock.iNetSession));
LockList.Add('Session: ' + IntToStr (Lock.iSession));
LockList.Add('Record Number: ' + IntToStr (Lock.iRecNum));
end;
until (rslt <> DBIERR_NONE);
Check(DbiCloseCursor(TmpCursor));
end;