Link to home
Start Free TrialLog in
Avatar of WoodyJ007
WoodyJ007

asked on

Paradox Lock Files...

Hi Guys,
   Does anyone know how I can find out how many locks paradox has at any one time?

I think there is a 64 limit or something.  I would like to check the count so I can see what portion of some code (rather crap code) is locking more tables.

Cheers
Woody.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
from the mentioned helpfile, don't forget to add the bde-unit into the uses clause

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;
about the limt, it depends on the paradoxversion but is about 1024 for one table
Avatar of WoodyJ007
WoodyJ007

ASKER

Just the job.

I was trying to close this yesterday but the EE server was down for ages!

Cheers
Woody.