Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data base validation leaves DBC open
Message
De
24/08/2007 11:16:22
 
 
À
15/08/2007 09:50:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Stonefield
Divers
Thread ID:
01248088
Message ID:
01250226
Vues:
32
Hello Doug

Having problems on a different front now. After using the following code I am unable to delete a folder that has SDT.* files in it. OS complains that "File is in use by another person or program". How can I make sure that SDT stuff is closed and free to delete?
parameters thisfolder
	local retval
        retval = "OK"
        
	set default to (thisfolder)
	open database iepoint excl

	oMeta = newobject('DBCXMgr', 'DBCXMGR.VCX')
	oMeta.SetDatabase(dbc())

	if oMeta.oSDTMgr.NeedUpdate('ALL')
		if not (oMeta.oSDTMgr.Update('ALL'))
			retval = "ERROR SDTMgr.Update('ALL')"
		endif
	endif

	if not (oMeta.oSDTMgr.Reindex('ALL',.t.,.t.))
		retval = "ERROR SDTMgr.Reindex('ALL')"
	endif

	if not (oMeta.oSDTMgr.Reindex('ALL',.t.,.t.))
		retval = "ERROR SDTMgr.Reindex('!ALL')"
	endif
	
 	oMeta.SetDatabase('')
	release oMeta

	set database to iepoint
	pack database
	close database all
	flush

	set default to (thisform._startup_path)

return retval
>Hi Darrell.
>
>>After running the following code, the iePoint.dbc is apparently still "open" in the file system even though VFP says it is not. Subsequent attempts to ZIP up iePoint.dbc with another VFP routine give a read error.
>>
>>Any ideas as to what it going on?
>>
>>parameters thisfolder
>>
>> set default to (thisfolder)
>>
>> open database iepoint excl
>> oMeta = newobject('DBCXMgr', 'DBCXMGR.VCX')
>>
>> oMeta.SetDatabase(dbc())
>>
>> IF oMeta.oSDTMgr.NeedUpdate('ALL')
>> oMeta.oSDTMgr.Update('ALL')
>> ENDIF
>>
>> oMeta.oSDTMgr.Reindex('ALL',.T.,.t.)
>> oMeta.oSDTMgr.Reindex('!ALL', .T.,.t.)
>>
>> set database to iepoint
>> pack database
>> close database all
>> flush
>>
>> set default to START_UP_PATH
>>
>>return "OK"
>
>DBCXMgr lives in a private datasession where it keeps its own copy of the DBC open. Although oMeta is going out of scope when this code ends and the DBC should be closed as a result, it's possible that's not happening. I suggest using oMeta.SetDatabase('') before the end of the code to ensure it's closed in DBCXMgr's datasession.
>
>Also, I noticed you're not checking the return values of either Update or Repair, which means you don't know whether they succeeded or not. I suggest you do that.
>
>Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform