Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get foreign keys
Message
De
07/06/2022 05:08:35
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
06/06/2022 08:28:24
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01684430
Message ID:
01684439
Vues:
59
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform