Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Restoring deleted records
Message
From
21/02/2006 17:04:14
Mike Yearwood
Toronto, Ontario, Canada
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097592
Message ID:
01097916
Views:
23
>I think this code would be extremely dependent on whether the file was fragmented or not. If the file is fragmented, there's no guarantee that the next physical sector would contain data that used to belong to the file.

I don't think so Fred. If the PACK was run and there's now a .BAK file, it may have been written by the operating system as a non-contiguous set of chunks. The operating system figures out which chunk contains byte # whatever as the file is traversed. This must be the case or no non-contiguous word document could be re-streamed into it's original form.

Be that as it may, if the pack has been done and there is now a .BAK file, it should be a simple matter to rename the .bak to .dbf and append the "deleted" records back into the new file.

I avoid all such low-level manipulations of the DBF and the CDX like the black plague. It's difficult enough to ensure data integrity now, without some low-level hacking going on.

I also don't believe giving the user the ability to delete is safe. It's better to manage record deletion and recovery using a datetime field. Then delete anything over a year old and pack - only as maintenance activities.

That way records that might have been maliciously "deleted" by some user of the application are still there, and under our control, not the users.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform