Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP relationships and NULLS allowed
Message
De
03/11/1998 13:40:29
 
 
À
02/11/1998 22:50:19
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00153763
Message ID:
00154046
Vues:
17
>Jeff,
>I just did this:
>used a table
>did a seek for .null. on a table using an index on a (non-null) character field
>Got data mismatch error
>modified the field structure to allow nulls
>Redid the search--no error.
>I grant you it wasn't a foreign key.
>
>So, I guess my question is: does your child table's fk allow nulls? Also, the seek you paraphrase would be odd. Is it accurate?
>
>>It does not seem possible to define a VFP database relationship where the child table has "insert restrict" and "nulls allowed" on the foreign key column.
>>
>>I wish to have a child table INVLIVE where the foreign key column CASE_ID may be null. But if CASE_ID is not null, then it is to be a valid value within the parent CASE table.
>>
>>When I specify the rule of insert restrict, the generated stored procedure has a line like if seek( lcChildID, pcParentWorkArea) which generates an error of datatype mismatch because lcChildID is NULL. The entire stored procedure does not mention or take into account NULLs.
>>
>>Is there anyway to modify how VFP generates trigger code besides modifying it after the fact?

I will doble check my table structure to allow NULLs as that is required. The seek command comes right out the generated Trigger code. I only added spaces for readibility.

if seek( lcChildID, pcParentWorkArea)

Second and more important, is the SEEK() returns .f. meaning the trigger will fail. If the Child table has NULL in the foreign key and the column allows NULLs the SEEK() shouldn't even occur. It should be more like:

if IsNull( lcChildID) and DBGetProp( ChildTableForeignKeyColumn, "Field", "DefaultValue") = ".NULL."
llRetVal = .t.

else
seek(....
endif
------------------------------
Jeff King
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform