Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBC's Referential Integrity
Message
From
03/11/1998 10:52:33
 
 
To
03/11/1998 08:02:51
Roberto Cysne
Banco do Nordeste S.A.
Fortaleza, Brazil
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00153861
Message ID:
00153943
Views:
24
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…)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform