Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RI builder - what we had discovered
Message
De
01/04/2005 11:44:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01000705
Message ID:
01000707
Vues:
39
I don't use the builder but I see that as developer's own error who sets an FK to allow nulls and yet restricts inserts. As someone said 'nulls are evils'.
Cetin

>Hi everybody,
>
>With the VFP built-in RI Builder the following behavior occurs:
>
>If you have a restricted insert and try to insert a fk which doesn't exist in the parent table, VFP gives an error "Trigger failure".
>If you try to insert the existing value, it works fine.
>If you try to insert NULL as a fk, it allows to insert it. It happens because of the bug in the builder itself. The error "data type mismatch" is generated on the seek command. This error is handled by the rierror procedure and at the end it allows to insert this value. So, it's a bug which produces a desired result at the end.
>
>=========================================================
>We switched to Steve Sayer's/Doug Henning's _RI_Handler. This code doesn't allow NULL values to be inserted in the FK. It does select count(*) from the parent table to see, if the passed foreing key exists in the parent. This could be easily fixed by adding a check for NULLS in the Restrict_Update and Restrict_Insert procedures (which I did yesterday).
>But I think that instead of select count we can use INDEXSEEK with .f. as a second parameter. If we switch to indexseek, we would not need macro. What do you think?
>The other problem I found is that it leaves all the tables open. I think, it should close all talbes it opened internally. This is not hard to fix as well.
>
>Finally, it currently loops through all RIs to find out the RI for the particular table. I'm thinking, this code could be changed to use ASCAN instead. In our case we have 252 relations, so I think, it's going to speed up the process. What would be your opinion here?
>
>--------------
>Finally, if I try to put my insert into TRY/CATCH block, I'm getting "Procedure cancelled" error in case of the failure in the trigger. I believe it happens because we have ON ERROR and RETURN .f. inside the trigger code. E.g. if we're having nested Error handling and we try to return .f. from the inner error, we would have this "Procedure cancelled" error. I think, it would happen every time we have return .f. inside the inner error statement, not necessarily for triggers. Is it a bug in VFP or it's a feature?
>
>Thanks a lot in advance.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform