Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBC's Referential Integrity
Message
De
03/11/1998 10:52:33
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
03/11/1998 08:02:51
Roberto Cysne
Banco do Nordeste S.A.
Fortaleza, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00153861
Message ID:
00153943
Vues:
23
Hi, Roberto:

Here's some code I've been playing with. It's intended to initialize the foreign keys in tables. It uses the idea that I think you are talking about.
FUNCTION GetParentID
LPARAMETER cParentAlias
IF PCOUNT() < 1 .OR. ;
   TYPE( cParentAlias + '.id' ) <> 'U'
	RETURN .NULL.
ENDIF
cChildAlias = IIF( PCOUNT() < 1, ALIAS(), UPPER( cChildAlias ) )
DIMENSION aRI[1]
SET DATABASE TO (CURSORGETPROP( 'database', cChildAlias ))
ADBOBJECTS( aRI, 'Relation' )
LOCAL ni, cChildKey, cParentKey
FOR ni = 1 TO ALEN( aRI, 1 )
	IF aRI[ni,1] = cChildAlias .AND. ;
	   SUBSTR( aRI[ni,5], 3, 1 ) = 'R' .AND. ;
	   USED( aRI[ni,2] )
		SELECT (aRI[ni,2])
		SET ORDER TO (aRI[ni,4])
		cParentKey = TRIM( KEY() )
		SET ORDER TO
		SELECT (cChildAlias)
		SET ORDER TO (aRI[ni,3])
		cChildKey = TRIM( KEY() )
		SET ORDER TO
	   REPLACE (cChildKey) WITH ;
	   		   EVAL(aRI[ni,2] + '.' + cParentKey) IN SELECT(cChildAlias)
	ENDIF
NEXT ni
RETURN
>>>Is there some way to list the DBC’s referential integrity by a program ?
...snip
>DBGETPROP() is Ok for Triggers and other properties, but I specific refer to the relation integrity type between the tables of a DBC. (one to one, one for many, etc…)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform