ASELOBJ()

Display Database, List Database

These commands show you the contents of the current database, listing all tables and views, their fields, indexes, relations, and other properties, but not stored procedures.

Usage

DISPLAY | LIST DATABASE          [ TO PRINTER [ PROMPT ]            | TO [ FILE ] cFileName [ ADDITIVE ] ]         [ NOCONSOLE ] 
Most of the information shown in the listing is available from either ADBOBJECTS() or DBGETPROP(). However, the index information can only be extracted by opening the individual tables and using the TAG(), KEY() and other index functions.

This means there's one case where you'll want to parse the output of LIST DATABASE—when a table is trashed and you can't open it to find index information. Even then, it doesn't give you everything you need, just the tag name and whether or not it's a candidate key. A better solution is to use the GENDBC utility provided with Visual FoxPro in the first place—it creates a program which, when run, re-creates your database. We recommend you make a habit of running it against a database every time you change its structure. Call it insurance. (Be forewarned: In VFP 3 and VFP 5, we know of at least one case where GENDBC can't provide you a perfect replica. Adding a FOR condition to a primary key is reasonably complex and GENDBC doesn't handle it right.)

These commands are fairly forgiving. If you issue them without an open database, you're prompted to choose one.

In VFP 3, the query that produces a view sometimes gets cut off in the listing produced by this command. You can see the problem by opening the TasTrade sample database and issuing DISPLAY DATABASE. Then, check the *SQL lines for the views. The problem appears to be fixed in later versions.

Example

OPEN DATA TasTrade LIST DATABASE TO DATLIST.OUT NOCONSOLE MODI COMM DATLIST.Out  && leave wordwrap off ERASE DATLIST.Out

See Also

ADBObjects(), Candidate(), DBGetProp(), Descending(), Display and List, For(), Key(), Primary(), Relation(), Tag(), Target()


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net