Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get foreign keys
Message
From
07/06/2022 05:08:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
06/06/2022 08:28:24
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01684430
Message ID:
01684439
Views:
58
>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

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform