BBjOpenFileInfo::forceClose

Description

In BBj 6.0 and higher, this BBjOpenFileInfo method closes a file that might be held open by some other user. 

NOTE: This method has the potential to crash an application and/or corrupt a database. Use this feature only with extreme caution.

Syntax

Return Value

Method

void

forceClose()

Parameters

None.

Return Value

None.

Remarks

None.

Example

rem ' BBjOpenFileInfo::forceClose Example

rem ' Force a file closed via BBjOpenFileInfo

states = unt
open (states)"states.dat"

input "Enter User ID: ",userid$
if userid$ = "" then userid$ = "admin"
input "Enter Password: ",password$
if password$ = "" then password$ = "admin123"
admin! = bbjapi().getAdmin(userid$,password$)
vector! = admin!.getOpenFileInfos()
if (vector!.size()) then
    for i=0 to vector!.size()-1
        print fill(72,"=")
        info! = vector!.get(i)
        print "File Name: ",info!.getFilename()," (",str(i+1),")"
        print "  Open ID: ",info!.getIDString()
        print "  User ID: ",info!.getUser()
        print "Host Name: ",info!.getHost()
        print "   Locked: ",fnyesno$(info!.isLocked())
        print "Extracted: ",fnumeric$(info!.getExtracted())
        print " Advisory: ",fnyesno$(info!.isAdvisoryLocking())
        print " Readonly: ",fnyesno$(info!.isReadOnly())
        print "Open Type: ",info!.getOpenTypeString()
    next i
endif

print "Force which file closed? (1.."+str(vector!.size())+"): ",
input i
if (i and i<=vector!.size()) then
    vector!.get(i-1).forceClose()
    print "File ",vector!.get(i-1).getFilename()," was forced closed."
endif

print fid(states)

escape

def fnyesno$(boolean)=iff(boolean,"Y","N")
def fnumeric$(number)=iff(number>=0,str(number),"None")

See Also

BBjAPI

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.