• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1287
  • Last Modified:

Visual FoxPro database viewer

I want a Visual Fox pro viewer or editor which will show me the primary keys and foreign keys.  

Thanks for your help.
0
resolver1
Asked:
resolver1
  • 3
  • 3
  • 2
  • +1
4 Solutions
 
jrbbldrCommented:
By doing a Google search for   visual foxpro viewer   you will find a number of tools which could support Viewing a Visual Foxpro data table.

But I seriously doubt that they will get you the more schema specific detail such as Primary Keys and Foreign Keys info.

What is your use for this info?    
Perhaps if we knew what you were trying to do we might be able to assist you better.

Good Luck

   
0
 
resolver1Author Commented:
?Thanks for your reply

im trying to understand the relationships between the tables to report on the data.  Its a very old application which has a lot of data but not much way in terms of reporting.  Its not very complex database but it would make it easier to understand if i knew the primary keys to the table.

The reason i posted was to ask experienced experts in FoxPro how they would go about this task.
0
 
pcelbaCommented:
What file do you have? DBF + DBC? If you hace DBC then the best viewer is Visual FoxPro itself. Command MODIFY DATABASE will show everything you need.

BUT the DBC file existence does not automatically mean relations are stored inside. Relations can be established in the code and you have to find them by reading it line by line...
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
jrbbldrCommented:
Its a very old application

With, as you say, the application being old, there is likely to not be a DBC 'database' files.

Instead you might have just 'free' data tables (DBF files) with their associated Memo files (FPT files) and/or Index files (IDX or CDX files).

I'd recommend that instead of trying to figure out how things are being done by looking at the data tables, you instead look at the source code of the application to see what they are doing in regards to setting specific Indicies Active within individual data tables (for the Child tables) and what they are doing to set up the Relation (for the Parent table).    

They could be using one Relation for one situation and a totally different Relation for another situation.  Without looking at the code, it would be very difficult to tell.

As Pavel has indicated above, getting a copy of Visual Foxpro would be the best approach - both to viewing the schema details of the data tables and to investigate the source code.

If you get a copy and have questions, feel free to come back and ask.

Good Luck






0
 
Olaf DoschkeSoftware DeveloperCommented:
As you say the application and database is old, you could even have data without relations and primary or foreign keys. Fox2x DBFs only support candiate indexes, which can be taken as good as primary keys, as they also don't allow double values, but the concept of relations, or referential data integrity is up to the ffox programmer, until DBCs with RI generator were introduced.

As pavel said, the definition of primary/foreign keys and relations is not forced, even with DBCs. But well, even SQL Server doesn't force you to define a primary key on a table.

And as pavel said, if in doubt, even if there are relations you still would need to consider code handling this different than you deduct from the table schema.

You can do, as many reverse engineering software does and imply a foreign key with the same name as the primary key. Field with the suffix ID being keys etc. There actually should be such software capable to read any database via ODBC driver or via OLEDB Provider.

For example, Office Visio has a database reverse engineer wizard. Rational Rose and ErWin are enterprise tools I once was able to use, in an internship of a bank.

I know ADOX.Catalog works on an adodb.connection to a dbc done via the vfp oledb provider. It will be able to list tables, views, and such, including fields, indexes and their types.

Pavel is of course right, with foxpro at hand you can most easily see the database and table structures and get at meta data. If you or your company has an MSDN subscription, I think vfp is still downloadable.

Bye, Olaf.



 
0
 
resolver1Author Commented:
spot on they are free data tables (DBF files) with  Memo files (FPT files) and Index files (IDX).

Im interested in the Visio reverse engineering as i have that at my disposal. i didn't realize there was reverse engineering tools out there.   Any tips? i'll take a look at viso, that will be useful to diagram so i can work out step by step. i've already created a ODCB connection.  


Your suggestions has been very useful, thanks everyone for your input!
0
 
Olaf DoschkeSoftware DeveloperCommented:
As you have no DBC there is no use for reverse engineering. You're confronted with just a bunch of tables. About the same as a raid is not a beautiful raid, if it's just a bunch of disks (JBOD).

The comparison is flawed. But no reverse engineering will help you there, there are no relations defined in DBFs, FPTs or IDX, just the tables, fields and indexes. Best bet is, visio can connect to the tables via ODBC as a directory of free tables and you can get a llist of tables, their fields and indexes. You could also see if there are unique "candidate" indexes, that could be seen as primary keys, but no foreign keys, no relations.

1. Set up an odbc dsn to a directory of free tables. If you don't have the foxpro odbc driver, download it from http://msdn.microsoft.com/en-us/vfoxpro/bb190233

2. In Visio: On the File menu, point to New, point to Database, and then click Database Model Diagram.
3. On the Database menu, click Reverse Engineer.

That should get you somewhere, but as we already predicted as the worst case of a DBC not being present, at no surpise, you don't have relations. You need to get a hands on the code to check out sql or set relation or other hints on how the data joins.

Good luck.

Bye, Olaf.
0
 
jrbbldrCommented:
You need to get a hands on the code to check out sql or set relation or other hints on how the data joins.

I agree with Olaf.  

As we have said above the data tables themselves cannot tell you anything about how they might be used within the code.  

Again, one Relation might be used (with or without FILTERS) for Report #1 and a totally different Relation might be used for Report #2.   The report data might be created on-the-fly with a SQL Query or in some totally different manner.  
The flexibility of Foxpro is great, but it can also present a challenge due to the wide variety of equally effective ways of approaching acquiring data 'sets' for reports,etc..

Sure, with the data table structure known, you might make some educated guesses, but there is no certainty that is how things are really being done.

Get a copy of Visual Foxpro (or hire a VFP contractor/consultant) to examine the code.

Good Luck

0
 
resolver1Author Commented:
Reverse engineering in visio saved me a long time, worked a treat.  Thank you.  I've set the primary key/fk relationships myselfs.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now