Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 9 without changing foxbase tables 1

Status
Not open for further replies.

SBTBILL

Programmer
May 1, 2000
515
US
Anyone have experience with opening Foxbase files with VP9. I'm nervous that if I do this the Foxbase program that they feed will lose the ability to open them. Haven't seen any memo files.
 
As long as you don't modify the structure in any way you should be fine. Note that VFP will have to work without indexes (or may mess up the Foxbase indexes if you use them).
 
So use SQL select to be safe or run the entire file?
 
There isn't a one size fits all rule.

I'd probably lean procedural because VFP does "on the fly" indexing in memory when you run a SQL query. That adds overhead. But it's fast as all get out running procedural code. But if you need an *ordered* file and can't use indexes, that's a problem. (Sometimes you can just copy/SELECT the rows you want, ordered the way you want and all will be well. Other times, it'll be more expedient to DO WHILE NOT EOF().)

But it depends on the size of the data sets and the use you'll make of them. Try both! Pick the one that works best.
 
The only thing that seems dangerous to me is VFP prompting for changing the structure of a DBF you open via menu File->Open. Otherwise a USE or SQL-SELECT shouldn't harm, I don't see how there can be a non prompted unconfirmed and silent change of files. If there is a structure change, it'll most certainly be in the header already, and thus you'd expect a rewrite of the whole file. That's nothing that can be done in split seconds, assuming the files have grown quite large already.

You can simply answer your own question by doing USE or SQL-Queries on file copies. Why don't you simply do that? If that works without modifying the table format, what is there left to fear?

How you can tell, there is no modification? Well, if you just select data nothing should change in the file, so if FILETOSTR(originalfile)==FILETOSTR(copiedfile) after a USE and close or after a SELECT query, then you're fine, aren't you? If you UPDATE you'd expect the change only to be in the updated record(s) and if you insert you'd only expect new bytes in the file, aside of the EOF byte moving to the new EOF. And you can inspect that using FOPEN/FREAD.

You can really answer that on your own just doing a little experimenting.

Bye, Olaf.
 
You actually can change the structure unprompted. Just create an index tag.

Code pages may also be an issue, so SET CPDIALOG OFF.

One thing you might consider is USE ... NOUPDATE wherever possible.
 
Thanks. A significant problem is I don't have copies of the current in production files so I can't do some of the testing you are suggesting. I've been thinking I should get that. However, both your responses have been a help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top