Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Querying DBC Information
Message
From
06/08/2002 14:20:56
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00686638
Message ID:
00686670
Views:
28
>Hi All,
>I want a sanity check. How many of you have tried this?
>
>Open a database. Instead of using ADBObjects() to query the DBC, use SQL to do the same thing while the DBC is already open.
>
>Run the following code:
>open database (home()+'\samples\tastrade\data\tastrade') shared
>use (home()+'\samples\tastrade\data\tastrade.dbc') again alias dbc_tastrade shared
>select objectname from dbc_tastrade where parentid in ;
>   (select objectid from dbc_tastrade where upper(objectname) = 'CUSTOMER' ;
>      and upper(objecttype) = 'TABLE') ;
>   and upper(objecttype) = 'FIELD'
>use in dbc_tastrade
>The above query circumvents having to open the customer table and issuing an AFIELDS() on it simply to get a list of fields.
>
>Because the DBC is simply another table, this makes sense. It's just something I have never tried (before today).

"Hacking" the metadata - getting information from the underlying table - is often used to do modifications for forms or reports, in cases where the built-in editing tools fail.

In this case, even if your method gives correct results, I would prefer ADBObjects(), because MS will try to keep backward-compatibility for ADBObjects(), but not (necessarily) for the table structure. That is, although it doesn't seem likely to me, your code might fail in VFP 8 or 9, because of some change in the fields.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform