Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get foreign keys
Message
From
07/06/2022 05:27:36
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
07/06/2022 05:08:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01684430
Message ID:
01684442
Views:
32
>>Hi All,
>>
>>while trying to fix a corrupted DBC I need to redo some indexes. There is just the DBC, nothing else. While I know to get the information about the tags via ATAGINFO(), how do I get information about foreign keys? This is odd. I know I can mimic low level through the DBC, but is there nothing build in?
>
>Found this in my gen_dex.prg:
>
	nTotal_Relations = ADBOBJECTS(aAll_Relations, "Relation")
>	lcRelString=""
>	FOR m.nLoop = 1 TO m.nTotal_Relations
>		lcRelString = lcRelString + c_Tab + c_Tab + "ALTER TABLE '" + aAll_Relations[m.nLoop,1] +;
>			"' DROP FOREIGN KEY TAG " +;
>			aAll_Relations[m.nLoop,3]  + crlf
>	ENDFOR
>
>...which is the part which reads them from the dbc and generates code to drop them; then this generates code to recreate them:
>
	lcRelString=""
>	FOR m.nLoop = 1 TO m.nTotal_Relations
>		lcRelString = lcRelString + c_Tab + c_Tab + "ALTER TABLE '" + aAll_Relations[m.nLoop,1] +;
>			"' ADD FOREIGN KEY TAG " +;
>			aAll_Relations[m.nLoop,3] +;
>			" REFERENCES " + ;
>			IIF(" " $ aAll_Relations[m.nLoop,2], ["], []) + ;
>			aAll_Relations[m.nLoop,2] +;
>			IIF(" " $ aAll_Relations[m.nLoop,2], ["], []) + ;
>			" TAG " + aAll_Relations[m.nLoop,4] + crlf
>	ENDFOR
>
Hi Dragan!

Thank you, looks close. :)

Lutz
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform