Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The referential integrity builder. Is it good ?
Message
From
20/08/1999 15:20:15
Bruno Di Lalla
Bdl Computer Consulting
Greely, Ontario, Canada
 
 
To
20/08/1999 09:22:38
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00255629
Message ID:
00256028
Views:
29
>I can tell you this:
>I´m working with vfp 6.0 and I´m building an app wich have some compound indexes. I used the RI builder and it warns that these indexes *might* not function as expected.
>Through the preliminary test, it seems to be working fine; but I will check it out to see if further problems appear.
>Also check thread # 248243 dated jul 30/99 to know about a bug I discovered in the RI builder.
>
>>>I once read that theyre was a bug in the referential integrity builder in VFP 3.0 (which I am using right now). The bug was supposedly caused by RI compound indexes.
>>>
>>>Is it true ?
>>>
>>>In the coming weeks I will be beginning to work with VFP 6 (with SP3). What does it look like with the RI builder in that version ?
>>
>>I don't use compound primary indexes, so I can't tell you from experience, but I can repeat what I've read over and over: the RI builder does NOT work with compound primary indexes.

I use compound indexes as primary keys extensively in my database. As mentionned above, the RI builder does give out a warning that these indexes may not behave as expected. Here's an example were it will not work:
parent table1 has:
field1 is a string
field2 is a date
Primary key is field1+DTOC(field2)
child table2 has
field1 is a string
field2 is a date
and other fields
Foreign key is field1+DTOC(field2)

Using the RI builder to cascade updates of table1 to table2 will fail. If I remember correctly, you will get a data type mismatch error.

However, I do the following without any problems:
parent table1 has:
field1 is a string (5 chars)
field2 is a string (10 chars)
Primary key is field1+field2
child table2 has:
field1 is a string (5 chars)
field2 is a string (10 chars)
and other fields
Foreign key is field1+field2

Using the RI builder to cascade updates of table1 to table2 works correctly in this scenario. Notice that corresponding fields must be of the same length in both tables for this to work.

Therefore, the warning RI builder gives is legitimate, but if you understand the limitations, I believe you may safely ignore it. I have an application which has been in production for months and uses compound indexes with as many as 8 fields without any problems!

Please let me know if your experiences prove me wrong.
Bruno Di Lalla
Consultant
BDL Computer Consulting
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform