Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make a copy of a DBC during runtime
Message
From
24/05/2008 08:31:58
 
 
To
23/05/2008 20:58:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01319312
Message ID:
01319338
Views:
24
This message has been marked as the solution to the initial question of the thread.
>Any suggestions?

oFS=createobject("Scripting.Filesystemobject")
oFS.Copyfile()

Or do some slight modifications of gendbc.prg to make it work on an open database:

-change CLOSE DATABASE in line 256 to SET DATABASE TO
-comment out line 289 COMPILE DATABASE (the database objectcode should be up to date anyway
and we want a copy, nothing changed or recompiled)
-change line 290 to USE (m.g_cFullDatabase) AGAIN
-change line 305 OPEN DATABASE ... EXCLUSIVE, instead of reopening it we do...
SET DATABASE TO (m.g_cFullDatabase)
...as we haven't closed the database in line 256.

Maybe I've overseen something, but I did these steps on a fresh and original version of gendbc.prg of VFP9. The general idea is to keep the database open and to not make anything which needs exclusive access.
Now that the script does not need exclusive access to the databse it copies, you can modify it as needed. You eg don't want to copy views or whatever.

Then DO gendbc.prg WITH "createdbc.prg" and then CD DestinationDirectory and DO createdbc.prg

Now you will have th DBC/DCT/DCX files right, you may erase all DBFs and CDX or append data to them instead of copying the DBFs of the DBC.

Bye, Olaf.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform