Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recreating DBC nightmare
Message
From
17/04/1998 15:23:28
Raul Davila
Davila Programming Services
Toa Alta, Puerto Rico
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Recreating DBC nightmare
Miscellaneous
Thread ID:
00093014
Message ID:
00093014
Views:
60
Hi:

I've always been used to work with free tables since FPDOS 2.0
Until now I've always used a small routine to check if any of
the tables were "accidentally" erased and prompt the user
if the table should be recreated.

Databases are making this process a nightmare!

1. If a table is erased you can't do a REMOVE TABLE, VFP will complain
that the table is not on the disk and cannot remove it from the DBC.
2. If I create the table while the DBC is open VFP complains that there is already a table with that name in the DBC.
Actually the table is added but it is not opened, when I USE it and recreate the index an error remains in the DBC

After 3 mugs of coffee and a pack of Marlboros I found this:
Given MYDATA.DBC contains TABLE1.DBF which is index on field F1

** Emulate the "table accidentally erased by user dilemma"<g>
ERASE TABLE1.DBF
ERASE TABLE1.CDX

OPEN DATA MYDATA
CREATE TABLE TABLE1 (F1 C(5))
** error 1571 is triggered, I trap it and don't let the user know what happened.
** Although the error is triggered the table is created and added to the DBC.
** Usually CREATE TABLE leaves the table opened but in this case it doesn't.
USE TABLE1 && CREATE TABLE did not leave it open
INDEX ON F1
** error 1561 is triggered. "Database is invalid. Please validate."
** VALIDATE DATA will not fix the problem unless RECOVER is used.
** Needless to say RECOVER cannot be used within a program!!!

The table and the index seem to be usable but the error inside the DBC will remain.

IMHO the perfect solution would be to do a VALIDATE DATA RECOVER programmatically, another one for the Tahoe wishlist.
Sorry for the long post, but I guess it's better 1 long post with a lot of info that a long thread with all the info scattered. :)

Any ideas are welcome and greatly appreciated.

TIA
R. Davila
DBA / Network Administrator
Administracion de Fomento Comercial
Gobierno de Puerto Rico

Still waiting for FoxPro for LINUX
Next
Reply
Map
View

Click here to load this message in the networking platform