Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is this bug in VFP7 SP1 fixed in VFP8?
Message
From
13/12/2002 03:44:54
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Is this bug in VFP7 SP1 fixed in VFP8?
Miscellaneous
Thread ID:
00732572
Message ID:
00732572
Views:
85
In Re: Overwriting/Deleting a file... Thread #732410 Message #732434 Michel Fournier has found a bug in VFP7 SP1 that allows overwriting of a table that VFP has opened non-exclusively, by another process. Can anyone who has the VFP8 Beta installed test the following code to see if it has been addressed?
* W2KBugTest.PRG

#DEFINE hcCurrDir		SYS(5) + CURDIR()

MD _Test1
MD _Test2

CREATE TABLE _Test1\Test ;
	(cTest C(10))

INSERT INTO Test ;
	(cTest) ;
	VALUES ;
		("Test 1")

USE IN Test

CREATE TABLE _Test2\Test ;
	(cTest C(10))

INSERT INTO Test ;
	(cTest) ;
	VALUES ;
		("Test 2")

CLOSE DATABASES ALL

SET EXCLUSIVE OFF

USE _Test1\Test

* Try to copy _Test2\Test.dbf over top of _Test1\Test.dbf while the latter is open:

* Following line should fail, because target file is in use:
* Following line DOES fail with EXCLUSIVE OFF or ON, so is commented out here:
*!*	COPY FILE _Test2\Test.DBF TO _Test1\Test.DBF

* Try the File System Object (presumably the same as what underlies Windows Explorer):
loFSO = CREATEOBJECT("Scripting.FileSystemObject")
loFSO.CopyFile(hcCurrDir + "_Test2\Test.dbf", hcCurrDir + "_Test1\Test.dbf")

* Note that the preceding CopyFile call fails if SET EXCLUSIVE is ON

=MESSAGEBOX("Test table _Test1\Test.DBF has been overwritten while open," + CHR(13) + ;
	"but its cTest value is still: " + Test.cTest, ;
	0 + 64 + 0, ;
	"Step 1")

USE IN Test
USE _Test1\Test

=MESSAGEBOX("Test table _Test1\Test.DBF has been closed, and re-opened." + CHR(13) + ;
	"Its cTest value is now: " + Test.cTest, ;
	0 + 64 + 0, ;
	"Step 2")

CLOSE DATABASES ALL

ERASE _Test1\Test.DBF
ERASE _Test2\Test.DBF
RD _Test1
RD _Test2
Test environment was VFP7 SP1 on Windows 2000 Professional SP3, no post-SP3 hotfixes. All test data written to a local hard drive (not a network drive).
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Next
Reply
Map
View

Click here to load this message in the networking platform