Thanks for this Dennis!
A small tweak to work with non-embedded. Add your driver prefix as needed:
Code:
Procedure CheckLocks Global Boolean bAliasTablesOnly
Handle hTable
String sTableName sRootName
Integer iFileMode
Boolean bIsAlias
Move 0 to hTable
Repeat
Get_Attribute DF_FILE_NEXT_OPENED of hTable to hTable
If (hTable > 0) Begin
Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTableName
Get_Attribute DF_FILE_ROOT_NAME of hTable to sRootName
Move (Trim(Uppercase(sTableName))) to sTableName
Move (Trim(Uppercase(sRootName))) to sRootName
If (sRootName contains "SQL_DRV:") Move (Replace("SQL_DRV:",sRootName,"")) to sRootName
If (sRootName contains "MSSQLDRV:") Move (Replace("MSSQLDRV:",sRootName,"")) to sRootName
Get_Attribute DF_FILE_MODE of hTable to iFileMode
If (sRootName <> sTableName) Begin
Move True to bIsAlias
End
Else Begin
Move False to bIsAlias
End
If (bIsAlias or not(bAliasTablesOnly)) Begin
Show (String(hTable) + " ")
Show ((If(bIsAlias, "(Alias) ","")) + sTableName + ": ")
If (iFileMode = DF_FILEMODE_ORIGINAL) Showln "Original"
Else If (iFileMode = DF_FILEMODE_DEFAULT) Showln "Default"
Else If (iFileMode = DF_FILEMODE_NO_REREAD) Showln "No Reread"
Else If (iFileMode = DF_FILEMODE_NO_LOCKS) Showln "No Locks"
Else If (iFileMode = DF_FILEMODE_NO_EDITS) Showln "No Edits"
Else If (iFileMode = DF_FILEMODE_NO_DELETES) Showln "No Deletes"
Else If (iFileMode = DF_FILEMODE_NO_FINDS) Showln "No Finds"
Else If (iFileMode = DF_FILEMODE_NO_CREATES) Showln "No Creates"
Else If (iFileMode = DF_FILEMODE_READONLY) Showln "Read Only"
Else If (iFileMode = DF_FILEMODE_SINGLE_USER) Showln "Single User"
End
End
Until (hTable = 0)
End_Procedure